This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to find out way direction

1

Hi,

i'm using the overpass api to query for ways around a given gps position with the ultimative aim to extract maxspeed values. However, i came across a way that had different maxspeed tags for forward and backward direction. Now how do i find out, wich direction (i.e. heading in degrees) is forward and which is backwards for a given way(-segment)? Is there some general rule to that like increasing node ids or similar? regards,d

asked 04 Jul '13, 12:24

dlr_ts's gravatar image

dlr_ts
21112
accept rate: 0%


One Answer:

2

It is just the sorting of the nodes. "A way is an ordered list of nodes […]" (way in wiki; emphasis by me). Also see: the methods to see the direction (rather targeted towards mappers).

answered 04 Jul '13, 12:46

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554
accept rate: 18%

edited 04 Jul '13, 12:51

does "ordered" refers to node-id (numerical ordering) or is the order in which the nodes appear in the xml-output is meant?

(04 Jul '13, 12:53) dlr_ts
3

no, there is no numercial ordering. The node ids (numbers) are not related to a way, they are independent object identifiers. If a node is also used by other ways (e.g. way intersections) the ways list the same node id.

The direction is set by the "order in which the nodes appear in the xml-output".

(04 Jul '13, 12:57) aseerel4c26 ♦

Source code available on GitHub .