A toolset for importing, cleaning, and processing Buenos Aires building data from official government sources into OpenStreetMap-compatible format.
This project bridges official Buenos Aires building data with OpenStreetMap by:
- Using authoritative city dataset geometries and attributes
- Cross-referencing with live OSM data to prevent duplicates
- Cleaning and transforming data through SQL migrations
- Generating OSM changefiles chunked by city blocks ("manzanas")
bin/- Helper scripts:download-dataset.sh- Fetches the Buenos Aires urban fabric datasetimport-datasets.sh- Imports city and OSM data into PostgreSQL/PostGISrun-migrations.sql- Executes SQL migration scripts for data transformationexport-geojson.sh- Exports query results as GeoJSON for debugging
examples/- Example GeoJSON files for some of the addressed issuesmigrations/- SQL and Python scripts for data transformationchangesets/- Output directory for generated OSM changefiles
-
Go to Overpass Turbo
-
Paste the following query:
[out:json][timeout:900]; area["name"="Buenos Aires"]["boundary"="administrative"]["admin_level"="8"]->.searchArea; ( way["building"](area.searchArea); relation["building"](area.searchArea); ); out body; >; out skel qt; -
Run the query, then use Export > GeoJSON to save as
data/live-osm-data.geojson -
Run the dataset download script:
bin/download-dataset.shThis script will save the contents to data/tejido.geojson.
Start the database:
docker compose up -dImport the datasets:
bin/import-datasets.shbin/run-migrations.sqluv run migrations/500-create-changefiles.pyChangefiles will be available in the changesets/ directory, organized by city block.
- Docker Compose for PostgreSQL/PostGIS
- Python 3.12+
- uv package manager
- GDAL with ogr2ogr
To visualize the processing results:
bin/export-geojson.sh "SELECT * FROM processed_buildings LIMIT 100" > debug.geojsonThen open the file in QGIS or any GeoJSON viewer.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to:
- Report issues
- Suggest improvements to the processing pipeline
- Add new data cleaning rules
- Enhance documentation