--- id: osm2geojson version: "0.3.2" license: MIT license_treatment: permissive maintenance: active --- # osm2geojson — Parse OSM and Overpass JSON License: permissive · Maintenance: active · Downloads: 112.2K/mo ## What it is and what it does osm2geojson is a parser that transforms geographic data from OpenStreetMap and Overpass API into standard GeoJSON or Shapely geometry objects. It accepts both JSON and XML input formats and provides four main conversion functions: json2geojson, xml2geojson, json2shapes, and xml2shapes. The library depends on shapely for geometric operations and requests for API calls. You use it when you have OSM or Overpass data and need it in GeoJSON format for web mapping, or as Shapely objects for geometric analysis. It includes an Overpass API query helper (overpass_call) with automatic retries, and supports customization via options like filter_used_refs, log_level, and polygon feature definitions. The package also exposes a command-line interface for batch conversions. Use it for: - Convert Overpass API query results to GeoJSON for display in web mapping libraries like Leaflet or Mapbox. - Parse OSM XML export files into Shapely geometry objects for spatial analysis or geometric operations. - Query the Overpass API directly and convert results to GeoJSON in a single workflow. - Extract specific OSM feature types (amenities, roads, buildings) and convert to standardized geographic formats. - Build geographic data pipelines that ingest OSM data and output GeoJSON for downstream processing. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts OpenStreetMap and Overpass API data (JSON or XML) into GeoJSON FeatureCollections or Shapely geometry objects with properties. Yes, with conditions. Install if you need to convert OSM or Overpass data to GeoJSON or Shapely objects and accept that the library is in active development (Beta status). No known security vulnerabilities, low install friction, and active maintenance make it a reasonable choice. However, verify that the current API and feature set meet your needs, as the documentation notes ongoing development work and incomplete CLI testing. ## Install pip install osm2geojson uv add osm2geojson poetry add osm2geojson ## Installing osm2geojson Before you install: Low friction: pure Python wheel with only two runtime dependencies (shapely, requests). Repository is active with recent commits and no archived status. License in practice: MIT license is permissive; you may use, modify, and distribute this package freely with minimal restrictions. Quickstart: import osm2geojson # From Overpass JSON geojson = osm2geojson.json2geojson(overpass_json) # From OSM/Overpass XML geojson = osm2geojson.xml2geojson(osm_xml) # To Shape objects (Shapely geometries + properties) shapes = osm2geojson.json2shapes(overpass_json) Verify before relying: - Stability and API maturity: description states 'This library is under development' but classifiers show Beta status; current production-readiness level unclear. - Performance characteristics with large OSM datasets: no documented limits or benchmarks provided. - CLI tool completeness: documentation notes 'Add tests and examples for cli tool' as a to-do item. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 112.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags osm to geojson converter, overpass api parser, openstreetmap json conversion, shapely geometry from osm, osm xml to geojson, overpass query results parser, geographic data format conversion, geospatial-data, openstreetmap, format-conversion [View on SkillFed](https://skillfed.io/packages/osm2geojson) · [View on PyPI](https://pypi.org/project/osm2geojson/)