Skip to main content

Cython wrapper of osrm-backend to be used in Python

Project description

pyosrm

Cython wrapper of osrm-backend to be used in Python.

Installation

Installing via pip

You can install using pip:

pip install pyosrm

This method is available only for Linux, since there is no wheel built for MacOS or Windows.

Installing from source

First things first, osrm-backend needs to be installed.

To install osrm-backend, follow the instructions in the official repository. There is also a wiki tutorial for other platforms. Don't use Mason, otherwise you will get some nasty segfault errors on your python code.

Clone the repository and make sure Cython is installed. Then proceed to install locally via pip:

pip install .

Or, if you want to build inline:

python setup.py build_ext --inplace

Usage

It is most likely you will need to install osrm-backend first to pre-process the data, since this package does not provide the cli tools to do it yet. Follow the instructions in the project wiki to pre-process the data using the desired algorithm (CH or MLD).

To create a PyOSRM object, you need to pass the path to the pre-processed data, and the algorithm (default 'CH' or 'MLD').

import pyosrm
router = posrm.PyOSRM("tests/data/ch/monaco-latest.osrm")

Route

To use the Route API, you just need to pass a list of coordinate pairs in format [lon, lat]. The easiest way to get the result is by using the RouteResult.json method, which formats the data in a easily serializable dictionary like the original API result object.

from pyosrm import PyOSRM, Status
router = PyOSRM("tests/data/ch/monaco-latest.osrm", algorithm='CH')
result = router.route([[7.419758, 43.731142], [7.419505, 43.736825]])
if result.status == Status.Ok:
    print(result.json())

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyosrm-0.0.2-cp38-cp38-manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8

pyosrm-0.0.2-cp37-cp37m-manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m

pyosrm-0.0.2-cp36-cp36m-manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m

pyosrm-0.0.2-cp35-cp35m-manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.5m

File details

Details for the file pyosrm-0.0.2-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyosrm-0.0.2-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for pyosrm-0.0.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4e5c306dcd17cd168f942cd8f45a4862b1ae0fb85abc3ff3668bfaafc09a53d
MD5 62614bb584ed249bd38e7cd094b00219
BLAKE2b-256 e4655c57065c8b8cf9a9443fa062ffb3ee821d1c6013d931d8bb03943a88384a

See more details on using hashes here.

File details

Details for the file pyosrm-0.0.2-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyosrm-0.0.2-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for pyosrm-0.0.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad963773c30d41a18cbde464c877f5db4ccb27c6975597b66edb2bb8d12ccdb8
MD5 41eb5fdc71ed111da204624c4a9e6707
BLAKE2b-256 8f405e48e9bd3d864d13b04ec5bb5d890ceaaaafe79fd5d91332d947ae240717

See more details on using hashes here.

File details

Details for the file pyosrm-0.0.2-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyosrm-0.0.2-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for pyosrm-0.0.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c87ad1d329e2638b54160eda1ac42aabff8474d54b4db16c9e75e0e606c6ebd5
MD5 914f13fe99090d54e8ee8104d5a0cd47
BLAKE2b-256 a58c4f194098e4d053fbc817063c2703017fd4c7f4775eb549775f54fad5934f

See more details on using hashes here.

File details

Details for the file pyosrm-0.0.2-cp35-cp35m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyosrm-0.0.2-cp35-cp35m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for pyosrm-0.0.2-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96731f5137f2d91d95cb13e44a4029d2579b8f21b53bcd36646bf52fdd06dc53
MD5 1a1a38dbd4aa710e6a169a19b13ab5d0
BLAKE2b-256 24ddfb2c31011a6fcdc9091082822df855191d533fea930e7f418dd22d35672d

See more details on using hashes here.

Supported by

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