[GraphHopper] Testing a simple graph

Peter K peathal at yahoo.de
Mon Feb 17 07:13:51 UTC 2014


Hi Andreas,

ah, ok. That is a (current) limitation of the location index that no
recursive search is triggered if nothing is found.

Regards,
Peter.

> OH! I am sorry.
> I didn't set the resolution correctly! The grid cells have been too small.
>
> Thank you.
>
>
> 2014-02-17 7:24 GMT+01:00 Andreas Fischer
> <fischer.andreas.atf at googlemail.com
> <mailto:fischer.andreas.atf at googlemail.com>>:
>
>     Hmm... not quite. Result of findNetworkEntries() still returns 0
>     entries.
>
>     Do you get a result when loading the test-osm3.xml and call
>     findNetworkEntries()?
>
>
>     2014-02-14 23:49 GMT+01:00 Peter K <peathal at yahoo.de
>     <mailto:peathal at yahoo.de>>:
>
>         Try setInMemory(true, true) instead of setInMemory(true, false)
>
>         Regards,
>         Peter.
>
>         BTW: This was recently changed and now just reads
>         setInMemory(true)
>
>         > Hi There,
>         >
>         > I want to test an algorithm which i wrote on a very simple
>         graph (like
>         > the test.osm in the storage test cases).
>         > My algorithm uses location indexes. My algo first gets all nodes
>         > nearby by calling findNetworkEntries(lat, lon).
>         > This usually works on my external built graph (e.g. on my
>         smart phone)
>         > but it does not work if i just load an OSM file with
>         GraphHopper via
>         > setInMemory(true, false)
>         >
>         > My code is equivalent to the GraphHopper test case:
>         >
>         > private static final String testOsm3 =
>         > "./src/test/resources/com/graphhopper/reader/test-osm3.xml";
>         > private static final String ghLoc = "./target/tmp/ghosm";
>         > private GraphHopper gh;
>         >
>         > @Before
>         > public void setUp(){
>         >   Helper.removeDir(new File(ghLoc));
>         > }
>         >
>         > @After
>         > public void tearDown(){
>         >   gh.close();
>         >   Helper.removeDir(new File(ghLoc));
>         > }
>         >
>         > @Test
>         > public void myAlgoTest(){
>         >   gh = new GraphHopper().setInMemory(true,
>         > false).setEncodingManager(new EncodingManager("CAR"))
>         >
>         > .setGraphHopperLocation(ghLoc).setOSMFile(testOsm3);
>         >   gh.importOrLoad();
>         >
>         >   myAlgoDoesFancyStuff();
>         > }
>         >
>         > The problem is, that it seems that it didn't create any location
>         > indexes and findNetworkEntries() returns 0 entries.
>         > What is the easiest way to create the location indexes that
>         i get
>         > findNetworkEntries() working?
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140217/1a7969f1/attachment.html>


More information about the GraphHopper mailing list