[GraphHopper] Get direction of an edge using CH
Peter K
peathal at yahoo.de
Mon Oct 28 13:53:09 UTC 2013
Hey Robert,
why do you think you need to reverse something if you do:
hBase = getHeight(baseNode)
hAdj = getHeight(adjNode)
heightDiff = hAdj - hBase
Where positive means increasing height from base to adjacent node. And
if you come from the adjacent node it will be the opposite as intented (?)
Regards,
Peter.
> Okay, sorry I don't get it.
> We store the height of each node in the graph. When we route we
> calculate the hight difference between base- and adjacent node (in our
> customized weightCalc) of the edges.
> How can i be sure to use the right sign for the height difference
> [heightDiff *= (reverse ? -1 : 1)] ?
> The reverse boolean is where the magic happens. But how? (see comment
> in your mail below)
>
> Thanks in advance,
>
> Regards,
> Robert
>
> Am 28.10.2013 12:50, schrieb Peter K:
>> If you need it in WeightCalculation you can additionally pass e.g. the
>> baseNode for the 'direction' of the iterator state:
>>
>> getWeight( EdgeIteratorState edge ) {
>> return getHeight(edge.getEdgeId, edge.getBaseNode)
>> }
>>
>
>> Keep in mind that the direction of the edge iterator does not
>> necessarily reflect the direction of a street. It it just the direction
>> of the exploration of the graph:
>>
>> base<-----adjacent1 #how to get the direction of the arrow (base
>> ----> adj [edge access not reverse], base <---- adj [reverse])
>> \---> adj2
>> \_ adj3
>>
>> Regards,
>> Peter.
>>
>>> Since we route height-data weights we need to know in which direction
>>> we're entering/visiting the edge. It matters because we need to know
>>> if we're going up or down. The path object is not yet created (during
>>> routing process).
>>>
>>> Thanks in advance,
>>>
>>> Robert
>>>
>>> Am 28.10.2013 11:11, schrieb Peter K:
>>>> What is your usecase? In the latest version the edgeId list will be
>>>> hidden in the Path object.
>>>>
>>>> Peter.
>>>>
>>>>
>>>>> Hi Peter,
>>>>>
>>>>> I need to find out in which direction i am passing the edges while
>>>>> routing using contraction hierarchies. Is there an easy way to get
>>>>> the
>>>>> direction?
>>>>> The Graphhopper version i'm using is from 18th of September.
>>>>> Sorry, i am sure that this question has been answered many times ;)
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Robert
>>
More information about the GraphHopper
mailing list