Fetch OpenStreetMap road, waterway, and water-body data for a bounding box.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tiny_osm-0.1.0.tar.gz.
File metadata
- Download URL: tiny_osm-0.1.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae795dd870931830b7ce46a072316c24c7229dd6207b700a95545e765b26afc0
|
|
| MD5 |
08174f7fc127ede3967c1c714b97802c
|
|
| BLAKE2b-256 |
b5d9830ace9bbe32c62ff8401b2fd2cf95cf1dc3035ac5467e822e64e6a9e658
|
Provenance
The following attestation bundles were made for tiny_osm-0.1.0.tar.gz:
Publisher:
release.yml on cheginit/tiny-osm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tiny_osm-0.1.0.tar.gz -
Subject digest:
ae795dd870931830b7ce46a072316c24c7229dd6207b700a95545e765b26afc0 - Sigstore transparency entry: 1316322512
- Sigstore integration time:
-
Permalink:
cheginit/tiny-osm@ad332fd6cfc8656206e00d8ea2693c67909a7d6a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cheginit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ad332fd6cfc8656206e00d8ea2693c67909a7d6a -
Trigger Event:
push
-
Statement type:
File details
Details for the file tiny_osm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tiny_osm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fcbf7a7c4db6a6414668426e0b75e53925da241bfc8eeba32dd648ee9e0a5e5
|
|
| MD5 |
869b8f808ce48bdf5cdacda26156b970
|
|
| BLAKE2b-256 |
75d04d8cd4d4bf89f51265ca464b7a1aea283e5a0beb2f2adc9039db9ad58c94
|
Provenance
The following attestation bundles were made for tiny_osm-0.1.0-py3-none-any.whl:
Publisher:
release.yml on cheginit/tiny-osm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tiny_osm-0.1.0-py3-none-any.whl -
Subject digest:
1fcbf7a7c4db6a6414668426e0b75e53925da241bfc8eeba32dd648ee9e0a5e5 - Sigstore transparency entry: 1316322538
- Sigstore integration time:
-
Permalink:
cheginit/tiny-osm@ad332fd6cfc8656206e00d8ea2693c67909a7d6a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cheginit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ad332fd6cfc8656206e00d8ea2693c67909a7d6a -
Trigger Event:
push
-
Statement type: