Load routing data

The data we use for routing is the  GeoBase “National Road Network” dataset for British Columbia (nrn_rrn_bc_shp_en.zip). It is available in shape file format and can be loaded into PostgreSQL using “shp2pgsql”. A long list of attributes comes with the road network data, but most of them do not contain data. For this routing workshop we will only keep “gid”, “id” and “the_geom”.

To overlay the route with Google Maps the data has been reprojected to EPSG 54004 meanwhile you better use: EPSG 900913)

    Column    |       Type       | Modifiers 
--------------+------------------+-----------
 gid          | integer          | 
 id           | integer          | 
 the_geom     | geometry         | 

Import a clip (Victoria Downtown area) of the British Columbia road network data.

A table named “victoria” will be created automatically.

psql -U postgres routing
\i /home/pgrouting/RoutingData/victoria.sql

(The network extent is “-13737893, 6141906, -13728396, 6151394”)

Add the geometry column:

ALTER TABLE victoria RENAME COLUMN the_geom TO geom;
SELECT AddGeometryColumn('victoria','the_geom',54004,'MULTILINESTRING',2);
UPDATE victoria SET the_geom=geom;
ALTER TABLE victoria DROP COLUMN geom;