TinyOSM: Lightweight OpenStreetMap GeoJSON Fetcher
Fetch OpenStreetMap data for a bounding box as GeoJSON. One function, one dependency, minimal footprint.
Why
OSMnx is the go-to tool for working with
OpenStreetMap data in Python. It handles street-network analysis, building footprints,
amenity lookups, graph-theoretic routing, and more. But it pulls in geopandas,
shapely, and networkx, a heavy dependency stack, that can be slow to install in
constrained environments like AWS Lambda, minimal Docker images, or CI runners.
tiny-osm exists for the narrower case where you just need OSM features as clean
GeoJSON. It ships with presets for roads, waterways, and water bodies, and accepts any
Overpass QL tag-filter for custom queries. It has one runtime dependency (httpx),
installs in seconds, and returns standards-compliant GeoJSON that works with any
downstream tool such as geopandas, shapely, or even a JavaScript map library.
tiny-osm |
osmnx |
|
|---|---|---|
| Dependencies | 1 (httpx) |
7+ (geopandas, shapely, networkx, ...) |
| Output format | GeoJSON dicts | GeoDataFrames/networkx graphs |
| Scope | Any Overpass tag-filter | Full OSM toolkit |
| API surface | 1 function | Dozens of modules |
Installation
pip install tiny-osm
Or with conda/pixi:
pixi add tiny-osm
Tip: If
orjsonis installed,tiny-osmuses it automatically for faster JSON parsing of Overpass API responses.
Usage
import tiny_osm
# Each call returns a GeoJSON FeatureCollection dict
bbox = (-97.75, 30.25, -97.70, 30.30)
highways = tiny_osm.fetch(*bbox, osm_filter=tiny_osm.OSMFilters.HIGHWAY)
waterways = tiny_osm.fetch(*bbox, osm_filter=tiny_osm.OSMFilters.WATERWAY)
water_bodies = tiny_osm.fetch(*bbox, osm_filter=tiny_osm.OSMFilters.WATER_BODY)
# Load into geopandas (optional - tiny-osm doesn't require it)
import geopandas as gpd
gdf = gpd.GeoDataFrame.from_features(highways, crs=4326)
# Custom Overpass QL filter
parks = tiny_osm.fetch(*bbox, osm_filter='["leisure"="park"]')
Filters
osm_filter |
What it queries |
|---|---|
OSMFilters.HIGHWAY |
highway=* ways (excluding areas, abandoned, planned, raceway) |
OSMFilters.WATERWAY |
waterway=* ways |
OSMFilters.WATER_BODY |
Closed water features: ponds, lakes, reservoirs, detention/retention basins |
| any string | Raw Overpass QL tag-filter (e.g. '["amenity"="restaurant"]') |
What it handles
- Auto-subdivides large bounding boxes into tiles
- Retries across multiple Overpass API mirrors with automatic failover
- Assembles multi-polygon relations (ring stitching, hole assignment)
- Deduplicates elements across tile boundaries
- Applies the OSM polygon-features rule tree (area=yes/no, coastline exceptions, etc.)
Contributing
Contributions are welcome! See CONTRIBUTING.md for details.
License
MIT License. See LICENSE for details.
Metadata
Release files for tiny-osm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tiny_osm-0.1.0.tar.gz | 1.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tiny_osm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.4 MB
Release files / tiny_osm-0.1.0.tar.gz
| Download URL | tiny_osm-0.1.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae795dd870931830b7ce46a072316c24c7229dd6207b700a95545e765b26afc0
|
|
BLAKE2b-256 checksum How to use checksums |
b5d9830ace9bbe32c62ff8401b2fd2cf95cf1dc3035ac5467e822e64e6a9e658
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logRelease files / tiny_osm-0.1.0-py3-none-any.whl
| Download URL | tiny_osm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fcbf7a7c4db6a6414668426e0b75e53925da241bfc8eeba32dd648ee9e0a5e5
|
|
BLAKE2b-256 checksum How to use checksums |
75d04d8cd4d4bf89f51265ca464b7a1aea283e5a0beb2f2adc9039db9ad58c94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency log