July 30th, 2024

Open Source Tools to Query OpenStreetMap

OpenStreetMap offers extensive geographical data, but its size complicates usage. Tools like Overpass Turbo, osm2pgsql, DuckDB, and QLever facilitate querying, each with unique advantages for data analysis.

Read original articleLink Icon
Open Source Tools to Query OpenStreetMap

OpenStreetMap (OSM) is a comprehensive dataset that includes a wide range of geographical features. However, its vast size, with the entire planet file exceeding 1,931 GB uncompressed, can make it challenging to work with. To facilitate querying and analyzing OSM data, several open-source tools are available.

Overpass Turbo is a web-based tool that allows users to filter OSM data using a procedural query language. It is user-friendly, offering a wizard for constructing queries in natural language, but has limitations on query size and duration. osm2pgsql, combined with PostGIS, enables users to load OSM data into a PostgreSQL database for complex geospatial queries. While it offers fast query performance, it requires an initial data import, which can be time-consuming.

DuckDB is a newer option that allows direct querying of compressed OSM files without the need for prior data loading. It features an experimental function, ST_ReadOsm(), which shows promising performance, especially with larger datasets. QLever transforms OSM data into an RDF format, enabling SPARQL queries to extract specific information, such as finding Italian restaurants in a given area.

Each tool has its pros and cons, with Overpass Turbo being accessible and easy to use, osm2pgsql providing robust SQL capabilities, DuckDB offering speed without extensive setup, and QLever allowing for knowledge graph queries. These tools collectively enhance the usability of OSM data for various projects and analyses.

Link Icon 3 comments
By @dang - 4 months
We respawned this post (see https://news.ycombinator.com/item?id=41173001) because this was too old for the second-chance pool (https://news.ycombinator.com/item?id=26998308).
By @wcedmisten - 4 months
Hi everyone, author here!

I love making projects with OSM, but it can be challenging to figure out how to analyze the data. So I wrote the article I wish existed to help make it a little easier!

By @starsep - 4 months
Another option is GeoDesk https://www.geodesk.com/