Library for simple routing on OSM data
Project description
pyroutelib3
A continuation of pyroutelib2. Routing on OSM data in Python 3.
OSM Data tiles is stored in tilescache/
Usage
from pyroutelib3 import Router # Import the router
router = Router("<transport mode>") # Initialise it
start = router.findNode(lat, lon) # Find start and end nodes
end = router.findNode(lat, lon)
status, route = router.doRoute(start, end) # Find the route - a list of OSM nodes
if status == 'success':
routeLatLons = list(map(router.nodeLatLon, route)) # Get actual route coordinates
Transport Modes: car, cycle, foot, horse, tram, train
Statuses: success, no_route, gave_up
Offline Routing
If you want to use pyroutelib3 offline or on custom .osm file, you just need to add a second argument to Router: Path to the specific osm file.
from pyroutelib3 import Router
router = Router("<transport mode>", "<path-to-.osm-file>")
# Continue on doing like in the example above
Starting from 1.5 pyroutelib3 now accepts other file formats then OSM XML: .osm.gz, .osm.bz2 and .osm.pbf. However, one has to inform pyroutelib3 what kind of file was provided, like so:
from pyroutelib3 import Router
router = Router("<transport mode>", "<path-to-file>", localfileType="<xml/gz/bz2/pbf>")
More info
For more advanced info on using pyroutelib3 (like cusotmizing way costs) take a look at the wiki: https://github.com/MKuranowski/pyroutelib3/wiki.
Changes from pyroutelib2
- Porting to python3
- Making pyroutelib a package
- Custom transport types
- Handling the access keys
- Turn restrictions
- Offline routers (load only local osm file)
License
pyroutelib3 is distributed under GNU GPL v3.
Copyright 2007, Oliver White Modifications: Copyright 2017-2018, Mikolaj Kuranowski - Based on https://github.com/gaulinmp/pyroutelib2
pyroutelib3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
pyroutelib3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with pyroutelib3. If not, see http://www.gnu.org/licenses/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyroutelib3-1.7.0.tar.gz
.
File metadata
- Download URL: pyroutelib3-1.7.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cdbc71be1fd9419ce8ccb081df7f4b92caac9eff5325654e9279361b2e835b6 |
|
MD5 | 07da87b4630b4bdeed781313879c3fb6 |
|
BLAKE2b-256 | 422505d9da7eb93bd01fd10de5e9e8dbab9bb030f53013a67bdc1ae02c015e6b |
Provenance
File details
Details for the file pyroutelib3-1.7.0-py3-none-any.whl
.
File metadata
- Download URL: pyroutelib3-1.7.0-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78bc6ce2624ba77c86e91d0eb7fae4c0287949376e86bc67286df3679138f7fb |
|
MD5 | d59b584d86cbdcf6fddedd13cbb9b16f |
|
BLAKE2b-256 | b632a773333034c15fb51eda9648159af50d86815a803f7272708493f3ec1590 |