Regarding the Direction while preparing the Graph

Hi Everyone,

How can we know the direction of an edge while preparing the graph(in OSMReader)


Every TagParser receives the ReaderWay in the handleWayTags method. The ReaderWay contains the entire point list for the current edge (with all the coordinates). So you could use that to calculate the ‘direction’ of an edge.

This is the code that adds the point list to the way tags:

and you can retrieve it via way.getTag("point_list", default);

Thanks @easbar for the response.

Sorry, my mistake. I meant to ask the direction with regards to road.

For example, a rider can travel from ‘a’ to ‘b’ with edge weight of 10 but from ‘b’ to ‘a’ with the different edge weight of 20. In this regard, could you please explain me how can I know the direction while preparing the edge weight.

With that, I would to influence the edge weight based on the direction


The point list is ‘directed’ in that the forward direction of the edge to be created is parallel to the point list and the backward direction is anti-parallel to that.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.