NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi all, two days ago I asked the question entitled: "Data of routes characteristics (nodes, orientation) of a pedestrian walking path". I had no answers, but only a comment, useful and I thanks, but I would like to better formulate the question. I need to know the direction (orientation towards the north) of a straight road, of which you know the street, between two known addresses (e.g. address with house number). I need to know the value with the best possible accuracy. I would like to ask if it is possible to know the value of the direction, that I suppose is stored,  by asking a question to the OSM database without calculating the value through the coordinates of the two points after reading them on the display. As you know it's difficult to position the points on the display very well and this can cause errors Thank you very much

asked 23 Feb '20, 20:51

SergioV's gravatar image

accept rate: 0%

Thanks for the answers. So if I need to know the direction of a stretch of road accurately I have to measure the coordinates of two points belonging to the stretch of road very accurately. I can't read the coordinates of the points on the display where the OSM is represented because it's not an accurate method, unless I zoom in on the map presentation

permanent link

answered 25 Feb '20, 00:03

SergioV's gravatar image

accept rate: 0%

Yes. Drawing a map always incurs a loss of precision. Just how big that loss is depends on many factors, including resolution and zoom level, but also the particular map style and parameters used for drawing (for example, some maps might simplify geometries before drawing). To get best results you would first have to retrieve the data behind the map, e.g. through services like Nominatim or Overpass, and then base your computation on that.

(25 Feb '20, 00:09) Frederik Ramm ♦

In the OSM database, ways (which are used to model streets among others) are mostly a list of nodes. Only the node have coordinates. See the OSM wiki for more details about the OSM.database model.

So no, the direction of the ways is not stored. And they are usually not straight if composed of more than two nodes.

I guess that routers (like graphhopper, OSRM, etc, see the other question) will provide the direction of each segment of a calculated route between two points.

permanent link

answered 24 Feb '20, 23:24

H_mlet's gravatar image

accept rate: 13%

Assuming that:

  • you have two addresses with house numbers
  • OpenStreetMap knows these addresses i.e. Nominatim can actually geocode them to the correct location
  • the road between the two addresses is straight

Then the steps required would be the following:

This will yield precise results independent of display. However, it will give you the angle between the two address points which is not necessarily the angle of the street. If you want to be super precise, you will need to identify the street (possibly through an additional geocoding request) and retrieve its geometry, then drop the perpendicular from each of the address points to the street geometry, and use the resulting points that lie on the street for the angle calculation. This will be harder if for any reason the street should consist of multiple parts in OSM.

There is no web service that would do this work for you.

permanent link

answered 23 Feb '20, 21:00

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 23 Feb '20, 20:51

question was seen: 1,787 times

last updated: 25 Feb '20, 00:09

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum