Skip to main content

A Python implementation of OSRM backend core functionality

Project description

py-osrm-backend

Python 3.8+ PyPI version License: MIT Flask OpenStreetMap Documentation

A Python implementation of core OSRM (Open Source Routing Machine) functionality.

Installation

pip install py-osrm-backend

Features

  • OSM Parsing: Parse .osm XML files to extract nodes and ways
  • Graph Building: Build a routable graph with haversine distance weights
  • Routing: Dijkstra's algorithm for shortest path computation
  • API Server: Flask-based REST API compatible with OSRM-like endpoints

Quick Start

from osrm.extractor.graph_builder import GraphBuilder
from osrm.engine.dijkstra import DijkstraEngine

# Build graph from OSM
builder = GraphBuilder()
graph = builder.build_graph("your_map.osm")

# Route
engine = DijkstraEngine(graph)
distance, path = engine.shortest_path(start_id, end_id)
print(f"Distance: {distance} km, Path: {path}")

Run Tests

python -m unittest discover -s tests -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_osrm_backend-0.1.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_osrm_backend-0.1.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file py_osrm_backend-0.1.1.tar.gz.

File metadata

  • Download URL: py_osrm_backend-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for py_osrm_backend-0.1.1.tar.gz
Algorithm Hash digest
SHA256 28fad56c44ebc1895bb1fd5b1c8ed6c250ef21db133ed9060d68a51b5b037600
MD5 013a1f36a3bb1e1a05e5ea3f6043b981
BLAKE2b-256 92c5b6d473e440ba612a89c0a694c70fa7a90bfc3e49a5d5b7213df337671ee8

See more details on using hashes here.

File details

Details for the file py_osrm_backend-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_osrm_backend-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee9d92bd01aba3ef1d9920d92fec7bb093d7e9b560f214cbab9a3fc80e173ca2
MD5 bfe0d295bb0ebd6d9262d8f9b4469a5b
BLAKE2b-256 61db036f012a71c434612a50cac000f030ca93fad56fc32d5eeb3b82e6a97026

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page