PyrouteLib

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — PyrouteLib
Afrikaans Alemannisch aragonés asturianu azərbaycanca Bahasa Indonesia Bahasa Melayu Bân-lâm-gú Basa Jawa Baso Minangkabau bosanski brezhoneg català čeština dansk Deutsch eesti English español Esperanto estremeñu euskara français Frysk Gaeilge Gàidhlig galego Hausa hrvatski Igbo interlingua Interlingue isiXhosa isiZulu íslenska italiano Kiswahili Kreyòl ayisyen kréyòl gwadloupéyen kurdî latviešu Lëtzebuergesch lietuvių magyar Malagasy Malti Nederlands Nedersaksies norsk norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português português do Brasil română shqip slovenčina slovenščina Soomaaliga suomi svenska Tiếng Việt Türkçe Vahcuengh vèneto Wolof Yorùbá Zazaki српски / srpski беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް
Pyroute in cycle mode, avoiding big roads and giving a quiet cycle route through back-streets and cycle paths (see image description for more details)
Shown with tiles@home images in the background

This page is about running pyroute from the command-line, or using it as a library from Python programs. For the graphical interface, see Pyroute

Background info

See the original web page: http://almien.co.uk/OSM/Routing/

Download and installing it

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

Installing goes very simple on Linux run the command

 svn co http://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

Running the program

Simple routing

Run the command:

route.py osmfile.osm startnode endnode transportType

To get a list of nodes

Route to OSM or GPX file

To produce an OSM XML file containing the route (for loading into JOSM, or rendering using osmarender etc:

routeAsOsm.py osmfile.osm startnode endnode transportType description

To get a GPX XML file, that you can upload to your GPS:

routeAsGpx.py osmfile.osm startnode endnode transportType description

Test if an OSM file is compatible

To test if it can load an OSM file, and how long it takes:

loadOsm.py dataFile.osm transportType

Original-style pyroute

Will generate a PNG image showing all the streets, the route, and highlighting the roads and nodes that it considered routing along (good debug tool for routing algorithms)

pyroute.py dataFile.osm node1 node2