Extract only buildings data with Python

Hi, I would like to extract only building data (with an API in python).
My intention is to choose an area (with a bounding box) and extract only the buildings. Then I will need the 3D of the buildings in OBJ format (but it’s the next step)

Is such a thing possible in Python?

Thanks :slight_smile:

Extracting building data from OSM is relatively easy – I suspect that Overpass API will suit your needs. You should be able to find Python bindings for that.

Producing 3D buildings from OSM is a different level of complexity. I don’t know a solution for Python, but feel free to look into OSM2World for your needs. Getting the output into Python is going to be a little inconvenient, but it’s a small step compared to the complexity of converting OSM data to OBJ in the first place.

Hi Tordanik,
thanks for your reply. So far I have been using OSM2World to convert my OSM files; but I’m builting an application in Python and I would like to download and create 3D buildings without external tools (and in Python environment).

The way I’m trying now is to download the OSM file via the overpass-api and convert it via osm2geojson to GeoJSON file. Then I will extrude the footprint of the buildings.

I’m aware of the limitations of this procedure but at least it’s a first (small) step.

Updates will follow…

Bye-bye :wink: