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 |
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. answered 02 Apr '21, 15:52 Frederik Ramm ♦ 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
|