All Projects
AI

OSM Data Scraper

January 2026Ramón García
PythonOSMnxGeoPandasPandasScikit-learnMatplotlibSeaborn
OSM Data Scraper

Abstract

A Python tool that automatically downloads OpenStreetMap features for any city in the world as structured CSV datasets, then applies machine learning pre-processing and visualization plots — delivering clean, analysis-ready inputs for urban ML pipelines without manual data wrangling.

Context / Problem

Urban machine learning projects stall at the data-collection step: querying OpenStreetMap, cleaning geometry inconsistencies, normalizing feature schemas across cities, and generating exploratory plots are all tedious prerequisites before any model training can begin. This tool automates that entire upstream pipeline.

Methodology

Given a city name or bounding box, the scraper queries the OSM Overpass API via OSMnx, downloads all requested feature layers (buildings, roads, land use, amenities, green space), normalizes attributes to a unified schema, and exports CSV files per layer. It then automatically generates a suite of ML-diagnostic plots — feature distributions, spatial heatmaps, correlation matrices — and assembles a merged dataset ready for direct ingestion by Urban Inference or any external model.