Pregunta

I need to store first parent of any Location entity in a mySQL database. So at the end I'll have a complete hierarchy. For example I need to know Berlin is part of Germany and store Germany as first parent of Berlin in the table. How can I query OSM for such information?

¿Fue útil?

Solución

You can't query OSM directly for this information. Of course OSM contains such information, mainly through boundary relations and admin_levels. But the exact hierarchy between different elements has to be calculated first.

Geocoders for OSM can be used to obtain these information. The currently most popular one is Nominatim. You can install your own Nominatim instace by either importing the whole planet or an country or area extract. Then you can try to obtain these information via the database created by Nominatim.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top