[GraphHopper] Load a custom edge weight
Peter
graphhopper at gmx.de
Wed Mar 4 17:25:06 UTC 2015
If you turn off simplification while import, yes
(hopper.setWayPointMaxDistance). Although still not identical as you can
get rounding differences
Peter
On 04.03.2015 18:13, Rossano Schifanella wrote:
> Are those coordinates exactly the ones in the OSM node data without
> any kind of processing?
>
> Thanks
> Rossano
>
> On 3/4/15 1:41 PM, Peter wrote:
>> edgeState.fetchGeometry() gives you all the geometry
>>
>> or use nodeAccess.getLat/Lon(edgeState.getBaseNode/AdjNode) to get only
>> the end points
>>
>> Peter
>>
>> On 04.03.2015 13:36, Rossano Schifanella wrote:
>>> That was the problem! I didn't specify the vehicle with setVehicle
>>> when a GHRequest was created.
>>>
>>> I have another quick question: is it possible through the
>>> LocationIndex or something similar to have for each edge in the graph
>>> the coordinates (lat, lon) of the end points?
>>>
>>> Thanks!
>>> Rossano
>>>
>>>
>>> On 3/4/15 1:26 PM, Peter wrote:
>>>>> In my case CH is turned off and I still get this exception when I
>>>>> issue a routing request. Do you think is it possible?
>>>> This should not happen - maybe this was a bug. Do you explicitly
>>>> specify
>>>> the vehicle in the request?
>>>> And is it still the case with the current master?
>>>>
>>>> Peter
>>>>
>>>>>> Regards,
>>>>>> Peter
>>>>>>
>>>>>> On 02.03.2015 22:44, Rossano Schifanella wrote:
>>>>>>> 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
More information about the GraphHopper
mailing list