Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. GeoJSON
  3. osm2geojson

osm2geojson

MITPythonv1.0.0rc1

A Python library for converting OpenStreetMap and Overpass API XML/JSON data into GeoJSON format.

GitHubGitHub
113 stars18 forks0 contributors

What is osm2geojson?

osm2geojson is a Python library that converts OpenStreetMap (OSM) and Overpass API data from XML or JSON formats into GeoJSON. It solves the problem of integrating raw OSM data into modern mapping applications and GIS tools that require the GeoJSON standard, providing a clean and programmable interface for this transformation.

Target Audience

Geospatial developers, data scientists, and GIS professionals who work with OpenStreetMap data and need to convert it into GeoJSON for visualization, analysis, or integration with other mapping libraries.

Value Proposition

Developers choose osm2geojson because it offers a dedicated, well-tested Python solution for OSM-to-GeoJSON conversion with support for both XML and JSON inputs, direct Overpass API querying, and the flexibility of intermediate Shapely geometry objects.

Overview

Convert OSM and Overpass XML/JSON to GeoJSON

Use Cases

Best For

  • Converting OSM XML exports to GeoJSON for web mapping
  • Processing Overpass API query results into GeoJSON features
  • Integrating OpenStreetMap data into Python-based GIS workflows
  • Creating custom geospatial data pipelines that require GeoJSON output
  • Educational projects teaching OSM data processing and conversion
  • Building tools that need to manipulate OSM geometries with Shapely

Not Ideal For

  • Projects built on non-Python stacks (e.g., JavaScript/Node.js) that need client-side OSM conversion
  • High-performance batch processing pipelines requiring optimized C++ or Rust backends for large datasets
  • Teams needing GUI-based tools for non-technical users to convert OSM data without coding

Pros & Cons

Pros

Dual Format Support

Handles both OSM/Overpass XML and JSON inputs, offering flexibility for various data sources as highlighted in the README's key features.

Shapely Geometry Integration

Provides intermediate Shape objects with Shapely geometries, enabling advanced geometric operations and custom processing before GeoJSON conversion, demonstrated in the examples.

Direct Overpass Querying

Includes a helper function to execute Overpass API queries with automatic retries, simplifying the workflow from data fetching to conversion, as shown in the usage section.

Customizable Conversion Options

Offers parameters like filter_used_refs and polygon_features for fine-tuned control, allowing developers to tailor output based on specific needs, detailed in the API reference.

Cons

Development Stage Limitations

Explicitly marked as 'under development' in the README, with a ToDo list indicating missing features like support for complex multipolygons and comprehensive CLI tests, which could affect stability.

Performance Scalability Issues

As a Python library, it may struggle with very large OSM datasets due to in-memory processing, and the README lacks performance benchmarks or streaming options for efficiency.

External Dependency Management

Relies on external data files for polygon features and area keys that require manual updates via scripts, potentially introducing maintenance overhead and compatibility risks.

Frequently Asked Questions

Quick Stats

Stars113
Forks18
Contributors0
Open Issues2
Last commit4 days ago
CreatedSince 2019

Tags

#python-library#geojson#shapely#geospatial#gis#osm#overpass-api#openstreetmap#data-conversion

Built With

s
shapely
M
Mypy
P
Python
R
Requests
R
Ruff
p
pytest

Included in

GeoJSON2.5k
Auto-fetched 7 hours ago

Related Projects

topoJSONtopoJSON

An extension of GeoJSON that encodes topology! 🌐

Stars4,903
Forks683
Last commit1 year ago
superclustersupercluster

A very fast geospatial point clustering library for browsers and Node.

Stars2,339
Forks303
Last commit24 days ago
geojson-vtgeojson-vt

Slice GeoJSON into vector tiles on the fly in the browser

Stars2,040
Forks279
Last commit22 days ago
fionafiona

Fiona reads and writes geographic data files

Stars1,245
Forks220
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub