[GIS] Transit routing using pgrouting as core routing engine

osm2pgroutingpgroutingpostgis-2.0postgresqlrouting

I'm a student and I'm working on a project. The aim is given two sets of coordinates (origin & destination) route through the map to determine the optimum path using public transportation and of course walking edges.

I read about GTFS, but it's too complex, I don't care about transit schedule, time, etc. My only aim is to provide the user with a graphical representation of the shortest path, and the cost will only be the length of edges multiplied by the fare of mode of public transportation (e.g. length in kilometres * bus fare per kilometre), edge length multiplied by the average speed of the mode of transportation (e.g. length in kilometres * bus average speed by kilometre), besides, my country hasn't yet provided any GTFS data yet.

I've decide to use PostgreSQL, PostGIS and pgRouting to do this. Here's my idea and what I've done so far.

first: download an OpenStreetMap extract taken from http://metro.teczno.com/#manila.

then: convert the XML OSM data to a routable database using osm2pgrouting tool.

I've done this using Cgywin since I'm using Windows, but encountered some error though, I think? see my results below:

> reference nd=[some digits] has no corresponding node entry...
  Nodes table created 
  2create ways failed: 
  Types table created 
  Way_tag table created 
  Relations table created 
  Relation_ways table created 
  Classes table created
  Adding tag types and classes to database... 
  Adding relations to database... 
  Adding nodes to database...
  Adding ways to database...
  Creating topology...
  NOTICE:  CREATE TABLE will create implicit sequence "vertices_tmp_id_seq" for serial column "vertices_tmp.id"
  CONTEXT:  SQL statement "CREATE TABLE vertices_tmp (id serial)" 
  PL/pgSQL function "assign_vertex_id" line 14 at EXECUTE statement
  '######################### 
  size of streets: 1072190
  size of splitted ways : 2281124
finished

Don't know exactly if this kind of result should concern me but I tried to do some routing. Seems working so far, if you have any comments on my osm2pgrouting result, I would appreciate the help.

Any way after converting the XML data, load QGIS application and load the ways table using DB Manager PostGIS plugin to convert the table to a shapefile, I will then enable labelling to see the edge id of each edge. then I will start tracking which edges are used for public transportation, (given that I already have a physical map which contain routes)

then: I will create a new table or multiple tables that will establish relationship between the "way" table and my public transportation data.
I haven't decided their structure yet, but that's the idea.

Now using pgRouting, I'm going to execute a shortest path query which will only route on edges that are also transit edges and walk-able by foot (footway).

Now my question is:

Am I on the right track here or am I missing something or there is something wrong with my idea?

Please I would really appreciate suggestions, corrections etc. and if there are things that would help me in making light to this project of mine.

Best Answer

There is no error in your osm2pgsql output. It only gives a notice that it creates a vertices table with a serial column.

When the routing result looks fine, then the import and topology went well. You probably should check if you imported all ways you want to use and adjust the configuration file accordingly.

For multi-modal routing though (if you care about bus and train schedules), the standard shortest path functions won't work. There was a Google Summer of Code project, which implements a multi-modal routing (available in a branch of the Github repository), though you have to compile pgRouting yourself and it's not much tested.

Related Question