Pyroutelib2

From OpenStreetMap Wiki
Jump to navigation Jump to search

A command-line/library version of pyroute, which uses a Tile data server and pyrender-style cache directory to load tiles of map data on-demand as the possible routes venture into new areas

Installing

Source code: https://svn.openstreetmap.org/applications/routing/pyroutelib2/

Installing goes very simple on Linux run the command

 svn co https://svn.openstreetmap.org/applications/routing/pyroutelib2/

An alternative repository which supports Python 3 and the new v0.6 API (using osmapi package) can be found at https://github.com/gaulinmp/pyroutelib2. Install using:

 git clone https://github.com/gaulinmp/pyroutelib2

Usage

See the test suite at the end of route.py for sample usage in python

To create a GPX route, run:

$ python routeAsGpx.py 
Usage: routeAsGpx.py lat1 lon1 lat2 lon2 transport

Transport can be found in weights.py (car, cat, foot, horse, cycle)