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

# Reading of OSM database parameters

 0 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 11●4●4●5 accept rate: 0%

 1 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: geocode location 1 (resulting in lat1, lon1) geocode location 2 (resulting in lat2, lon2) calculate bearing (or heading) angle betwen lat1,lon1 and lat2,lon2 using a suitable formula (e.g. https://www.igismap.com/formula-to-find-bearing-or-heading-angle-between-two-points-latitude-longitude/) 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. answered 23 Feb '20, 21:00 Frederik Ramm ♦ 82.5k●92●720●1273 accept rate: 23%
 0 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. answered 24 Feb '20, 23:24 H_mlet 5.4k●17●81 accept rate: 13%
 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 answered 25 Feb '20, 00:03 SergioV 11●4●4●5 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 ♦

### Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "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:

×223
×118
×59
×25
×7

question asked: 23 Feb '20, 20:51

question was seen: 1,780 times

last updated: 25 Feb '20, 00:09

### Related questions

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