Pyroute

From OpenStreetMap Wiki
Jump to: navigation, search
Pyroute
Screenshot of Pyroute
Author: Ojw
Website: http://svn.openstreetmap.org/applications/routing/pyroute/
License: GPL
Platform: win ; linux ; openmoko

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

Videos

The best introduction is probably with screenshot videos

As seen on OpenGeoData!

Download and installing

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

GUI requires pycairo. Everything else just requires python

svn co http://svn.openstreetmap.org/applications/routing/pyroute/
cd pyroute/
python gui.py
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 gui.py

Enjoy!

Pyroute using Windows XP

Running the program

Run gui.py

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.

Features

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

Routing

  • 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

Limitations

  • 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)

Ideas

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.