From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Pyroute
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 беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް
Screenshot of Pyroute
Author: Ojw
License: GNU General Public License
Platforms: Windows, Linux, and Openmoko Linux
Language: English
Source code:
Programming language: Python 2.x

Routing tool, predecessor of rana

This page is about the graphical version of pyroute for mobile phones. For the command-line interface, see PyrouteLib

pyroute is a routing program written in Python by Ojw, and a mobile phone GUI for maps, GPS, and routing.

It is currently being replaced by rana, which does the same thing but with more loosely-coupled modules

Running [slowly] on OpenMoko


The best introduction is probably with screenshot videos

As seen on OpenGeoData!

Download and installing

Source code:

GUI requires pycairo. Everything else just requires python

svn co
cd pyroute/
The view menu, showing some things we'd like to display on the map

For Windows XP (as of January 2008)

It is known to work using the following steps:

1) Download and install python (version 2.5 is known to work), available from here.

2) Create a folder and download pyroute into it (see instruction above), e.g. c:\data\pyroute. Revision 6290 is known to work.

3) Download and install pycairo, available from here

It is known to work with the Glade/GTK+ for Windows Toolkit binary version 2.10.7-1, with pycairo bundled, available from here

4) Download and install pygtk, available from here

Look for "Latest news" section for "PyGTK all-in-one installer for win32 Tuesday 13 February 2007" and download the executable file (not sure what is the exact version) from here

5) Open the Windows shell

6) Change directory to the pyroute folder, e.g. cd c:\data\pyroute

7) Key in: python


Pyroute using Windows XP

Running the program


After it downloads some map images, it will either detect GPSD, use a pair lat,lon from a file pos.txt, or start with a map of Reigate.

  • Drag the main map window to pan the map. Use +,- icons to zoom
  • Click on the top-left corner of the screen to get the menu.
  • Click on the map to set your position there (if no GPSD is detected), or to create a route.

Before routing, you need to download some OSM data for the area. In the menu, go to "Download > DownloadRoute" to fetch the area around your current position from OSM ( note that this is not around the centre of the map view!). Download may take a while, depending on how dense the OSM data is.

If you forget to download the OSM data, routing will just be a straight line.


Data source Displayed as
Position Connects to GPSD on default port Red dot
Waypoints Load from GPX. Auto-saves to same file. Add new ones via menu Name in green text. Can view full list in menu
Tracklogs Load/save (GPX) Record from GPS Yellow lines
Sketches Load/save (GPX) Sketch on map Yellow lines
Map images Download on demand from Osmarender, Mapnik, OpenAerialMap (with caching) Background image (scaled)
Routes Can't load or save. Can create, if OSM data is available Thick red line
OSM vector data Can't load or save. Can download for a small area around current position Not displayed
GeoRSS Can download at startup (hardcoded URLs, no caching) Same as waypoints
Geonames (wikipedia) Can download at startup (hardcoded URLs, no caching) Same as waypoints
OSM points of interest Not available Not displayed


  • A*
  • Loads OSM files with SAX
  • Can load a city in "not unreasonably slow" time
  • Probably not scalable much beyond city-size routing
  • But doesn't require a database server to be available!
  • Theoretically it can cache the routing tables once parsed, but this doesn't seem to be much quicker than loading the OSM file again
  • Should be able to handle most of the transport types on Routing profiles
  • Is currently optimised for cyclists (since I am one) pedestrians, and regular* cars

* a 'regular' car is one with no width, no height, and no weight, hence can drive down any road. You may have met this car in the GCSE 'applied mathmatics' course ;)

Idea for a menu to download data


  • Doesn't store routing data when you exit and restart the program
  • Cached map images never deleted
  • Doesn't store your position on the map when you exit and restart
  • GeoRSS disabled by default (because it doesn't cache the downloads yet)


See Pyroute share server for some social and collaborative ideas that pyroute could implement relatively easily (dependent on network availability of course)
Download corresponding images from Open Aerial Map or from the NASA Blue Marble image set and overlay OSM data on top.