[GraphHopper] Load a custom edge weight

Peter graphhopper at gmx.de
Sat Feb 28 20:21:41 UTC 2015


Hi Rossano,

while import you'll have to store the mapping from osm node to internal
node, then you can easily do what you proposed. A more generic solution
would be to use GPS locations instead of OSM nodes to specify the
weighting and then using the location index to lookup the closest edge.

Then you have the edgeId to weight mapping which you could either put
into the edge directly, or just use a double array where the edgeId is
the index. Or use DataAcess which is a storable array for many purposed.

Regards,
Peter


On 27.02.2015 23:08, Rossano Schifanella wrote:
> Hi there,
>
> suppose I have an external file with this format
>
> OSM_NODE_ID1    OSM_NODE_ID2    w1
>
> where OSM_NODE_ID1 and OSM_NODE_ID2 are two OSM node ids and w1 is a
> double that represents a custom weight. What I'd like to do is:
>
> 1) Find the edge gh_edge_id in the GraphHopper internal data structure
> that corresponds to the the edge OSM_NODE_ID1->OSM_NODE_ID2
>
> 2) Create a data structure that maps the relation
>
> gh_edge_id    w1
>
> in a way that at runtime in a custom Weighting class I can retrieve
> the value w1 when the corresponding edge is visited.
>
> Which is the best approach to tackle this problem?
>
> Thanks a lot for your support.
>
> Rossano
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper




More information about the GraphHopper mailing list