[GraphHopper] Load a custom edge weight
Rossano Schifanella
schifane at di.unito.it
Mon Mar 2 21:44:10 UTC 2015
Peter,
thanks for the hint, I used the location index to find the closest edge
and it worked. I have a couple of additional questions:
- After having implemented a custom weight, I'm wandering if it's
possible to set a threshold in the length or travel time over which a
tentative path is discarded (e.g., using astarbi)? Note that the
implemented custom weight doesn't use distance nor speed as measure.
- What is the meaning of the method getMinWeight when, for example,
astarbi is used?
- Is it possible to specify more than a value for the property
graph.flagEncoders (e.g., BIKE, FOOT) ? When I tried I got this
exception: java.lang.IllegalStateException: Multiple encoders are
active. cannot return one:bike,foot
What am I doing wrong?
Thanks a lot!
Regards,
Rossano
On 2/28/15 9:21 PM, Peter wrote:
> 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
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
More information about the GraphHopper
mailing list