<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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.<br>
<br>
Regards,<br>
Peter.<br>
<br>
</div>
<blockquote
cite="mid:CAEq=BxDpieCCMuKuF0fLTH-UbS5iy7EGnrcxGCxqZwG0OwxOcw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">Hi,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>
What is the easiest way to do it?</div>
<div><br>
</div>
<div>Now I doing this:<br>
<br>
<div>OSMInputFile file = new OSMInputFile(xmlcontent);</div>
<div>OSMReader k;</div>
<div>GraphHopper instance = new GraphHopper() {</div>
<div><span style="white-space:pre-wrap"> </span>@Override</div>
<div><span style="white-space:pre-wrap"> </span>protected
DataReader createReader(GraphStorage tmpGraph) {</div>
<div><span style="white-space:pre-wrap"> </span>return
initOSMReader(new StringOSMReader(tmpGraph,
xmlcontent));</div>
<div><span style="white-space:pre-wrap"> </span>}</div>
<div>};</div>
<div>instance.setInMemory(true);</div>
<div>EncodingManager manager = new
EncodingManager("foot");</div>
<div>instance.setEncodingManager(manager);</div>
<div>instance.setCHShortcuts("shortest");</div>
<div>instance.setOSMFile(somevalidpathtoFile);</div>
<div>instance.setGraphHopperLocation(somevalidpathtoFile2);</div>
<div>instance.importOrLoad();</div>
<div><br>
</div>
<div>int allnodes = instance.getGraph().getNodes();</div>
<div>GHRequest request = new GHRequest(placesList);<br>
</div>
<div>request.setVehicle("foot");</div>
<div>GHResponse ph = instance.route(request);</div>
<div>
assertTrue(ph.isFound());</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>May be there is a more elegant solution, then overiding
the method?</div>
<div><br>
</div>
<div>Best Regards</div>
<span class="HOEnZb"><font color="#888888">
<div>
Konstantin</div>
</font></span></div>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
GraphHopper mailing list
<a class="moz-txt-link-abbreviated" href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a>
<a class="moz-txt-link-freetext" href="https://lists.openstreetmap.org/listinfo/graphhopper">https://lists.openstreetmap.org/listinfo/graphhopper</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
GraphHopper.com - Fast & Flexible Road Routing</pre>
</body>
</html>