Skip to main content

🌍 osm-simplify

osm-simplify is a lightweight, dependency-minimal Python library designed to make querying OpenStreetMap (OSM) data effortless. Whether you are building local search features, geographic data parsers, or offline mapping applications, this library bridges the gap between raw map data and clean, ready-to-use Python objects.


💡 Why Use osm-simplify? (The Benefits)

Working directly with OpenStreetMap's Overpass API or raw .osm XML files can be tedious, requiring complex query syntax and error-prone XML parsing. osm-simplify solves this by giving you:

  • Zero Heavy GIS Bloat: Avoid installing massive, hard-to-configure geographic libraries like GDAL or GeoPandas just to find nearby places.
  • Smart Dual-Mode Engine: Query live public Overpass servers with built-in failover, or seamlessly switch to parsing local .osm XML files offline when you're without internet or testing locally.
  • Automatic Tag Expansion: You don't need to write complex Overpass QL syntax. Simple presets (like Category.FOOD or Category.PARK) automatically expand behind the scenes to capture relevant nodes, ways, and boundaries.
  • Instant Distance Sorting: Search results are instantly cleaned up, converted into structured Place data classes, and sorted by physical distance from your target location.
  • Built-in Memory Caching: Remembers recent queries to ensure fast repeat lookups without spamming public servers.

🚀 Installation & Local Clone

You can install the package directly from PyPI:

pip install osm-simplify

Or if you want to perform a local clone for development:

git clone https://github.com/DoguH72/osm-simplify.git cd osm-simplify pip install -e .


📖 Quick Start

Here is how simple it is to find nearby restaurants or historical monuments around a location:

import os from osm_simplify import GeoFinder, Category

1. Initialize your search anchor (via address or direct coordinates)

spot = GeoFinder.from_address("Piazza Castello", "Turin")

(Optional) Attach a local .osm XML file for offline fallback

if os.path.exists("sample_lib.osm"): spot.local_file = "sample_lib.osm"

2. Find nearby food spots within 500 meters (automatically sorted by distance!)

restaurants = spot.get_nearby(Category.FOOD, radius_m=500)

for place in restaurants: print(f"- {place.name} ({place.subtype}): {place.distance_m}m away")

3. Find the single closest monument

closest = spot.get_closest(Category.MONUMENT, radius_m=1000) if closest: print(f"Closest Monument: {closest.name} @ {closest.distance_m}m")


🛠️ Custom Change (Custom Categories)

Need something specific that isn't in the default presets? You can define custom search filters on the fly:

CUSTOM_CAFE_FILTER = { "name": "cafes", "overpass": ('["amenity"="cafe"]',) }

cafes = spot.get_nearby(CUSTOM_CAFE_FILTER, radius_m=600)


🧩 Core API Reference

  • GeoFinder: The core spatial engine handling online API requests, failovers, and offline XML traversal.
  • Place: A clean dataclass representing a location point (.name, .category, .subtype, .lat, .lon, .distance_m, .to_dict()).
  • Category: Pre-configured presets (Category.FOOD, Category.PARK, Category.MONUMENT, etc.).
  • OverpassServerError: Custom exception raised when public mapping mirrors are overloaded.

📄 License

Distributed under the MIT License. Feel free to use, modify, and adapt it for your own projects!

Metadata

Release files for osm-simplify 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osm-simplify 1.1.0
File Size Uploaded Provenance Actions
osm_simplify-1.1.0.tar.gz 14.4 kB Without provenance Details for osm_simplify-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for osm-simplify 1.1.0
File Interpreter ABI Platform Actions
osm_simplify-1.1.0-py3-none-any.whl Python 3 none any Details for osm_simplify-1.1.0-py3-none-any.whl

Total release size: 26.5 kB

Release files / osm_simplify-1.1.0.tar.gz

Download URL osm_simplify-1.1.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
57bf99246ff43bc67c185c999f02c75a83267640ded4c2ca21a63c08db1483ca
BLAKE2b-256 checksum
How to use checksums
87683530db68beaeeba3221610cde5d56031e40029ab7fae05472d55f6bd7ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / osm_simplify-1.1.0-py3-none-any.whl

Download URL osm_simplify-1.1.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
772c683ea16a0f188dbfe511f8f8ad8059ccdee7f0d64a595b9cdb1954342c0a
BLAKE2b-256 checksum
How to use checksums
db4c19b05eaaea8c575caf73d5518b35f1a69b17846c2f48a075cdf589b8c195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for osm-simplify 1.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page