<div dir="ltr">name finding worked, thank you! <div><br></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">>Will work for none CH only. You'll have to tweak the algorithm to accept only edges which are in the bounds:</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px">edgeFilter = new EdgeFilter() {</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> accept(EdgeIteratorState state) {</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> base = state.getBaseNode();</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> adj = state.getAdjNode();</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> int baseLat = graph.getLatitude(base);</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> int baseLon = graph.getLatitude(base);</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px">...</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> return bbox.contains(baseLat, baseLon) || bbox.contains(adjLat, adjLon);</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px"> }</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px">}</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">></span><span style="font-family:arial,sans-serif;font-size:13px">dijkstra.setEdgeFilter(</span><span style="font-family:arial,sans-serif;font-size:13px">edgeFilter);</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>as for creating a box, sorry for being that dumb but where should I put it? I don't want to change the main code structure a lot. </div>
<div>so can I use it inside Graphhopper.java's public GHResponse route( GHRequest request ) method? </div><div>I saw examples but they imply that I create algorithms object manually and I don't want to since I intend to keep the same Graphhopper.java structure (more or less) that's very usable with Android. </div>
<div><br></div><div>Best regards</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 10, 2014 at 11:23 PM, Peter K <span dir="ltr"><<a href="mailto:peathal@yahoo.de" target="_blank">peathal@yahoo.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hey,<br>
<br>
</div><div class="im">
<blockquote type="cite">
<div dir="ltr">>This is called geocoding and not provided by
GraphHopper. Although we<br>
>have some (closed source) prototype we still recommend other
existing
<div>>solutions.</div>
<div><br>
</div>
<div>Isn't there a way then to somehow manually find which
node/edge ID is associated with street name by reading routing
data provided from graphopper.sh script? I only need to figure
out 5-10 street's names associated with their edge/node ids so
that I could manipulate them via hardcoding. I mean, yes, it's
that unpractical and basic but that's my goal here :) <br>
</div>
</div>
</blockquote>
<br></div>
yes, sure: loop over all edges! This extremely expensive and
error-prone as there are multiple identical named streets even in
one city! But you can find the names:<br>
<br>
EdgeIterator iter = getAllEdges();<br>
while (iter.next())<br>
{<br>
iter.getName()<div class="im"><br>
}<br>
<br>
<blockquote type="cite">
<div dir="ltr">>Where the last option probably would be the
simplest one as there is<br>
>already a (hidden) method for it in OSMReader called
isInBounds or just<br>
>use OSM tools like osmosis:<br>
><a href="http://wiki.openstreetmap.org/wiki/Osmosis#Extracting_bounding_boxes" target="_blank">http://wiki.openstreetmap.org/wiki/Osmosis#Extracting_bounding_boxes</a><br>
><br>
>Or do you need to define it per request? What is your
usecase?
<div><br>
</div>
<div>Yes, my usecase would be to define per request: </div>
<div>-First request calculates the fastest path </div>
<div>-Point A is moving inside the map (GPS tracking on) </div>
<div>-Timer should recalculate path each 30s or so</div>
</div>
</blockquote>
<br></div>
Ok, but why would you need to find a path in a subgraph - to limit
search space? Wouldn't it make more sense to re-compute the whole
path (where you could reuse parts of the old result) or if that is
too expensive you could re-compute a path in a bounding box leading
you back to the original path.<div class="im"><br>
<br>
<div><br>
</div>
<div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">>
>* limit the search to only nodes in this area (this is only
possible if</span><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">
no CH is used)</span><br>
</div>
<div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">>
><br>
</span></div>
</div><div class="im"><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">>
how is this possible to implement? <br>
<br>
</span></div></div>
Will work for none CH only. You'll have to tweak the algorithm to
accept only edges which are in the bounds:<br>
edgeFilter = new EdgeFilter() {<br>
accept(EdgeIteratorState state) {<br>
base = state.getBaseNode();<br>
adj = state.getAdjNode();<br>
int baseLat = graph.getLatitude(base);<br>
int baseLon = graph.getLatitude(base);<br>
...<br>
return bbox.contains(baseLat, baseLon) ||
bbox.contains(adjLat, adjLon);<br>
}<br>
}<br>
dijkstra.setEdgeFilter(edgeFilter);<br>
<br>
Regards,<br>
Peter.<br>
</div>
<br>_______________________________________________<br>
GraphHopper mailing list<br>
<a href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/graphhopper" target="_blank">https://lists.openstreetmap.org/listinfo/graphhopper</a><br>
<br></blockquote></div><br></div>