[GraphHopper] Adding custom weight to edge

Peter graphhopper at gmx.de
Mon Mar 9 10:07:15 UTC 2015


Hi Markus,

you can use a method like this. Try QueryResult.closestEdge.getEdge
instead of the edgeIds from the EdgeIterator of that query point as they
are 'virtual edges'.

But be aware that if you reimport from a new OSM file you will need to
re-do the edgeID mapping.

Regards,
Peter

On 08.03.2015 15:07, Markus wrote:
> Hey,
>
> I'm having an Android App and bunch of GPS points I'm loading them 
> from a server. Each GPS point has a weighting value assigned and should alter 
> the weight of an edge they belonging to. 
>
> I'm struggling with assigning my data to the right edges to use them for the 
> path calculation.
>
> I'm using getLocationIndex() findClosest() and assign the weight to the edge 
> and store this data in a Map during an AsyncTask.
> In the weight calculation I'm checking if the edge in my Map is the same as 
> the one graphhopper is handling at the moment and if so add the weighting to 
> the calculation.
>
> But the edges stored in the Map are different from the once I get with 
> getEdge() from EdgeIteratorState (the doc also states that I shouldn't make 
> any  assumptions about the concrete values).
> Is there a way to get the EdgeID so I can store my information in the Map?
>
> Is there a nice way to solve that?
>
>
> Thx Markus
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper




More information about the GraphHopper mailing list