<div dir="ltr">Okay, I figured it out and it was really silly - I was putting latitutes instead of longtitutes when forming a bbox.. I still have one big question due to bbox but I'll put into another message for future reference since it's not relevant with the topic<div>
<br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 11, 2014 at 6:07 PM, mythex3cutioner . <span dir="ltr"><<a href="mailto:mizantropy@gmail.com" target="_blank">mizantropy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">uhh, sorry for the spam.<br>i've tried it like this: <div><br></div><div><div>EdgeFilter edgFilt = new EdgeFilter()</div>
<div> {</div><div> @Override</div><div> public boolean accept( EdgeIteratorState edgeIterState )</div>
<div> { </div><div> baseLat = graph.getLatitude(fromRes.getClosestNode()); //fromRes - user's current position</div><div> baseLon = graph.getLongitude(fromRes.getClosestNode()); </div>
<div> adjLat = graph.getLatitude(toRes.getClosestNode()); //toRes - destination</div><div> adjLon = graph.getLongitude(toRes.getClosestNode());</div><div class="im"><div> BBox bbox = new BBox(baseLat, baseLon, adjLat, adjLon);</div>
</div><div> return bbox.contains(baseLat + baseLat*0.5, baseLon + baseLon * 0.5) || bbox.contains(adjLat + adjLat * 0.5, adjLon + adjLon * 0.5);</div><div> </div><div><br></div>
<div>
}</div><div> }; </div></div><div><br></div><div>yet it didn't even start algorithm - I think it found no usable nodes/edges</div><div><br></div></div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br>
<div class="gmail_quote">On Sat, Jan 11, 2014 at 6:04 PM, mythex3cutioner . <span dir="ltr"><<a href="mailto:mizantropy@gmail.com" target="_blank">mizantropy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div class="gmail_extra"><span style="color:rgb(80,0,80)">>No. First not in the method (in some outer scope instead) and second with your own limits not with the edge properties. Again: I have no idea what >you are trying ...</span></div>
<div class="gmail_extra"><br></div></div><div class="gmail_extra">I've tried to set a bounding box like this:</div><div><div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">
On Sat, Jan 11, 2014 at 6:02 PM, mythex3cutioner . <span dir="ltr"><<a href="mailto:mizantropy@gmail.com" target="_blank">mizantropy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Well, I'm absolutely new to the maps & Android so sorry if I bother you. <div>
I'm trying to manipulate some routing algorithms, basically, 'implement' my own one but just for presentation purposes. </div>
<div><br><div>My final goal's flowchart would look something like this </div><div>-The map is loaded and centered on device's coordinates provided by GPS (can't find .setFocus() on mapsforge, heh;)) (pointA)</div>
</div><div>-User selects a point on the map, marker is added (pointB)</div><div>-Shortest/fastest path is calculated between those two points</div><div>-Second point is selected (pointB) </div><div>-Then the algorithm runs only inside my Bounding Box</div>
<div><br></div><div>Since I've added manual weights to some of the edges, there should be different times for calculations, different routes will be selected, etc. </div><div><br></div><div>This is what I want to show - what are the differences when you apply bounding box or put some insane traffic-weight on the edge while running the same algorithm :) </div>
<div><br></div><div>Best regards </div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 11, 2014 at 5:27 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div dir="ltr"><div>> I mean, just simply like this?<br>
<br></div>
No. First not in the method (in some outer scope instead) and
second with your own limits not with the edge properties. Again: I
have no idea what you are trying ...<br>
<br>
<div><div>> I saw examples but they imply that I create algorithms
object manually and I don't want to since <br>
> I intend to keep the same Graphhopper.java structure (more
or less) that's very usable with Android. <br>
<br></div>
You can extend the GraphHopper class and overwrite the necessary
methods to call setEdgeFilter I think.<br>
</div>
<div><br>
Regards,<br>
Peter.<br>
</div>
<div><br>
</div>
</div><div><div>
<blockquote type="cite">
<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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hey,<br>
<br>
</div>
<div>
<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><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><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>
<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" target="_blank">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>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
GraphHopper mailing list
<a href="mailto:GraphHopper@openstreetmap.org" target="_blank">GraphHopper@openstreetmap.org</a>
<a href="https://lists.openstreetmap.org/listinfo/graphhopper" target="_blank">https://lists.openstreetmap.org/listinfo/graphhopper</a>
</pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
GraphHopper mailing list<br>
<a href="mailto:GraphHopper@openstreetmap.org" target="_blank">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>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>