[GraphHopper] Testing a simple graph

Andreas Fischer fischer.andreas.atf at googlemail.com
Mon Feb 17 06:24:27 UTC 2014


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>:

> 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?
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140217/b30b473b/attachment.html>


More information about the GraphHopper mailing list