[GraphHopper] Fwd: feed Graphhopper with String
Peter K
peathal at yahoo.de
Fri May 16 14:08:40 UTC 2014
Hmmh, indeed it would be better if OSMReader accepts a Reader ... but
this is not easy as we need to read from it twice. So, yes your solution
with cloning the OSMReader functionality would be one way or create a
temporary file from the xmlContent which you then can normally read in.
Regards,
Peter.
> 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
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
--
GraphHopper.com - Fast & Flexible Road Routing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140516/73210050/attachment.html>
More information about the GraphHopper
mailing list