PitchHut
Log in / Sign up
quackosm
7 views
Dive into OpenStreetMap data with QuackOSM and DuckDB!
Pitch

QuackOSM is your go-to open-source tool for effortlessly reading OpenStreetMap PBF files using DuckDB. With its user-friendly Python and CLI interface, you can easily access and analyze geographic data. Whether you're a developer or a data enthusiast, QuackOSM simplifies your journey through the world of mapping!

Description

Introduction to QuackOSM 🦆

QuackOSM is a powerful, open-source tool designed for reading OpenStreetMap (OSM) PBF files through the efficiency of DuckDB. Leveraging advanced database capabilities, QuackOSM redefines how users interact with geographical data.

Key Features

  • Scalable Reading: Effortlessly handle large OpenStreetMap ProtoBuffer (pbf) files.
  • DuckDB Integration: Built on DuckDB's robust architecture with its specialized Spatial extension to facilitate spatial queries.
  • GeoParquet File Format: Convert and save files in the modern GeoParquet file format, ensuring seamless integration with contemporary data cloud solutions.
  • Multithreading Support: Unlike GDAL, which operates in a single-threaded manner, QuackOSM takes advantage of multithreading to significantly improve data processing speed.
  • Geometry-Based Filtering: Filter data by geometry directly, without requiring pre-clip operations like ogr2ogr.
  • Tag Filtering: Flexibly filter data based on specific OSM tags.
  • Caching Mechanism: Employ caching techniques to minimize repeated computations, enhancing performance and efficiency.
  • Python Module & CLI: Access QuackOSM as both a comprehensive Python module and an intuitive command-line interface (CLI) powered by Typer.

Installation

QuackOSM can be easily installed as a pure Python module or with CLI support through pip:

pip install quackosm  
pip install quackosm[cli]  

Usage Examples

QuackOSM offers versatility in usage, whether you're downloading or converting OSM data. Here's a glimpse of how to utilize QuackOSM:

Load PBF File as GeoDataFrame

import quackosm as qosm  
qosm.convert_pbf_to_geodataframe("path/to/your_file.osm.pbf")  

Convert PBF to GeoParquet

gpq_path = qosm.convert_pbf_to_parquet("path/to/your_file.osm.pbf")  
print(gpq_path.as_posix())  

Geocoding and Geometry Conversion

geometry = qosm.geocode_to_geometry("Vatican City")  
qosm.convert_geometry_to_geodataframe(geometry)  

CLI Command Usage

Run QuackOSM directly from your command line for efficient file processing:

quackosm path/to/your_file.osm.pbf  

Conclusion

With QuackOSM, data scientists, geographers, and developers can unlock the potential of geographical datasets with ease and speed. Its powerful features and user-friendly interface stand as a game-changer in the realm of spatial data management.