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

Hi

I need the exact data of a road for a project. Is it possible to read the reference points of a road from OSM? Or rather, where are these reference points located? The goal would be that I then connect these reference points using splines and can then calculate the curvature of the road. For this it would be important to know where the reference points are located (e.g. in the middle of the road). So that I can start from this one spline then calculate the edges of the road.

Thanks a lot for your help!

asked 02 Apr '21, 15:28

martin912's gravatar image

martin912
11112
accept rate: 0%


First, identify the ID of the OSM "way" object that you want to download. (If the road is long, there might be more than one way object.) Then, download https://api.openstreetmap.org/api/0.6/way/ID/full (where ID is the ID you identified earlier). This returns an XML representation of the road and coordinates for all its nodes (what you call reference points). These will usually be in the middle of the road, but don't rely on accuracy too much since the GPS tracks and aerial imagery we use can easily be a few metres off.

If you want to do this for more than just a few roads, the above method will not work as you will be downloading too much data from the API. In that case, it is easiest to download an .osm.pbf file for the region you are interested in and either process that yourself (with e.g. the Osmium library or pyosmium) or load it into a PostgreSQL database with osm2pgsql and take it from there.

permanent link

answered 02 Apr '21, 15:52

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks a lot!

I just want to do that for a small part of a street. I want to analyze a few different street situtations. Is there a opportunity to read out this nodes from the xml file?

(02 Apr '21, 16:32) martin912

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:

×230
×223
×1

question asked: 02 Apr '21, 15:28

question was seen: 4,576 times

last updated: 02 Apr '21, 19:37

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