As I said in my last post, I’m looking to move to using a pre-built routing library for Freemap walking routes, and of the various options, pgRouting seems to work best for a web app as it’s based on PostgreSQL and PostGIS. Managed to get it properly installed now, and have populated the routing database with OSM data in Hampshire, Wiltshire, West Sussex and Surrey using the osm2pgrouting tool. Performance is encouraging (as in, instantaneous) for trying to find a route from Fernhurst, W Sussex to Older Hill, two and a half miles or so away.
There are, however, one or two “gotchas” with using osm2pgrouting to import the data. Firstly, the pgRouting documentation doesn’t mention the need to load the topology functions. Consequently, the import process fails (silently) at the topology stage as assign_vertex_id() is missing. You need to do this once you have created your database, with the additional command:
psql -U gis -f /usr/share/postlbs/routing_topology.sql routing
(assuming a user of “gis” and database of “routing”).
The other issue is that backslashes in OSM way names cause an error in the import process. You have to modify the source of osm2pgrouting to deal with this; see, for example: this post.