Answer the question
In order to leave comments, you need to log in
Nominatim gives away not all sections of roads. How to solve the problem?
Hey!
The more I understand OSM, the more I get confused.
Task: knowing the coordinates of the point, get the nearest street and display it as a "line" on the map.
1. To draw a line, you need to have an array of points (geojson)
2. Using the Nominatim Api, you can get this very geojson
An example of a reverse request: nominatim.openstreetmap.org/reverse?format=json&la...
But in practice there are problems:
Streets/ roads in OSM are cut into pieces. Therefore, Nominatim returns only a small section of the street.
I try to immediately make a second request to Nominatim, already by the name of the street "Simferopolskaya street, Evpatoria, Evpatoria city district, Republic of Crimea". In response, I get an array of "pieces" of this street. But I noticed that not all sections of the street were returning. There are "holes":
For the third day I've been tinkering, I can't understand anything.
Tell me, please, what am I doing wrong? Maybe there are other ways?
Answer the question
In order to leave comments, you need to log in
No way, it's generally not his task to store all the segments of the streets. This is just probably optimization, where there is only a minimum of segments near the houses along this street. Of course, you can get a list of all segments of the same name in a radius through overpass, but if I'm not mistaken, you asked here before, then you have a finite list of coordinates. IMHO it is worth downloading a database for yourself, doing data preprocessing and storing ready-made streets.
I will answer myself:
1 step. With the help of Nominatim reverse Api - by coordinate we get the name of the nearest street, and its coordinates.
2 step. Using the Overpass API, we are looking for, for example, 5 km from these coordinates, all streets (way) with the same name: [out:json];(way['name'='street_name'](around: 5000, lat, lng ););out geom;
3 step. Profit :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question