August 6th, 2024

Open source tools to query OpenStreetMap

OpenStreetMap offers extensive geographical data but is large and complex. Tools like Overpass Turbo, osm2pgsql, DuckDB, and QLever provide various querying options, each with unique advantages and limitations.

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 the querying of 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, although it 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, but requires an initial data import that can be time-consuming. DuckDB offers a more efficient alternative by allowing direct queries on compressed OSM files without the need for extensive data loading, although it is still experimental. Lastly, QLever enables querying OSM data represented as a knowledge graph using SPARQL, providing a different approach to accessing the data. Each tool has its pros and cons, making them suitable for different use cases depending on the user's needs and technical capabilities.

- OpenStreetMap contains extensive geographical data but is large and complex to manage.

- Overpass Turbo provides a user-friendly interface for querying OSM data but has performance limitations.

- osm2pgsql and PostGIS allow for powerful geospatial queries but require significant setup and data import time.

- DuckDB can query compressed OSM files directly, offering speed and flexibility, though it is still in an experimental phase.

- QLever allows for RDF-based querying of OSM data, providing an alternative method for data access.

Link Icon 4 comments
By @wcedmisten - 4 months
Author here! Happy to answer any questions you all have about this article.
By @mft_ - 4 months
Funny just popped up; I just learned of the existence of overpass-turbo via a geoguessing video on Youtube [0] just this week. Thanks for an interesting article!

[0] https://www.youtube.com/watch?v=rl2Q9xH8e7M

By @kaveet - 4 months
Has anyone else run into big gaps in OSM data? I’ve tried to cobble together a store locator with Overpass Turbo, and even though the queries look correct I’ll still get fewer results compared to Google Maps. Sephora and Walmart locations in the US, for example.