Draw a map of the districts of Budapest using the Overpass API of OpenStreetMap and Python

A map of Budapest. Source: https://hebstreits.com/product/budapest-hungary-downtown-vector-map/
The relation of the 1st district of Budapest. https://www.openstreetmap.org/relation/221984#map=15/47.4969/19.0375

OSM structures

Access OSM objects automatically

Overpass query for I. kerület in Budapest.

Create a polygon of nodes

We aim to have something like this at the end. Source: https://100ujgyulekezet.blog.hu/2013/05/29/budapest_xxiv_20_01_resz_a_xxiv_kerulet_helye
Convex hulls are not fit for the task…
How concavity messes with the “always add the closest” approach

My solution

The resulting borders of the districts of Budapest. https://github.com/morkapronczay/osm_bp_districts/blob/master/base_layer_bp.png

Takeaways

ML&NLP Engineer @ Bold360AI. Text mining and predictive statistics enthusiast.