Skip to main content

A Python implementation of OSRM backend core functionality

Project description

py-osrm-backend

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

Installation

pip install -e .

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.0.tar.gz (13.8 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.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_osrm_backend-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 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.0.tar.gz
Algorithm Hash digest
SHA256 39753fc7e1999c68f2930ca4833ec18a7c71290d7c2c8ce739742104fa64896f
MD5 391268492a988533148ea3dec95d0d5b
BLAKE2b-256 0451580996c36e5c955b67c23227ad04b14cfddcfe24adb02de73cd2fdf67773

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_osrm_backend-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adfe4d4c66c5c14bddf87b22075c2771af612e6f4ee76f8f862a93521c5b0a2c
MD5 a06a34c7a327af3286f4c3d465621955
BLAKE2b-256 5965f68649da5e4da988c7bb3d04053b01acbe5c377fb8aa702b09ab311fd2dd

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