[GraphHopper] Fwd: feed Graphhopper with String

Konstantin Ostrovsky konost at googlemail.com
Fri May 16 13:45:20 UTC 2014


Hi,

I am using your library in my master thesis. In my usage scenario I have
already a String with OSM content and I would like to apply a routing
algorithm on it.

What is the easiest way to do it?

Now  I doing this:

OSMInputFile file = new OSMInputFile(xmlcontent);
OSMReader k;
GraphHopper instance = new GraphHopper() {
 @Override
protected DataReader createReader(GraphStorage tmpGraph) {
return initOSMReader(new StringOSMReader(tmpGraph, xmlcontent));
 }
};
instance.setInMemory(true);
EncodingManager manager = new EncodingManager("foot");
instance.setEncodingManager(manager);
instance.setCHShortcuts("shortest");
instance.setOSMFile(somevalidpathtoFile);
instance.setGraphHopperLocation(somevalidpathtoFile2);
instance.importOrLoad();

int allnodes = instance.getGraph().getNodes();
GHRequest request = new GHRequest(placesList);
request.setVehicle("foot");
GHResponse ph = instance.route(request);
assertTrue(ph.isFound());


May be there is a more elegant solution, then overiding the method?

Best Regards
Konstantin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140516/a349c9a9/attachment.html>


More information about the GraphHopper mailing list