Pre-requisites ============== - Microsoft Windows - MapGuide Open Source 2.5 - PostgreSQL 9.2 - PostGIS 2.0.3 - pgRouting 1.0.7 Instructions ============ 1. Download the GeoBase "National Road Network" dataset for British Columbia (http://geobase.ca/geobase/en/data/nrn/index.html). The file is nrn_rrn_bc_shp_en.zip 2. Create the database "pgrouting_example" using template_postgis_20 3. Enable pgRouting. Run the following SQL on this database: "create extension pgrouting" 4. Unzip the road network dataset 5. From the command line, navigate to the unzipped road network directory and run this command: shp2pgsql -s 4617 -I -S NRN_BC_9_0_ROADSEG.shp roads | psql -d pgrouting_example -U postgres Note the -S switch that instructs shp2pgsql to *not* use multi-linestrings (important!) 6. Run the following SQL on the "pgrouting_example" -- add necessary columns alter table roads add column source integer; alter table roads add column target integer; alter table roads add column length double precision; -- build the network topology select pgr_assign_vertex_id('roads', 0.001, 'geom', 'gid'); update roads set length = st_length(geom); -- create indexes. shp2pgsql already created a geometry index so no need to make one there create index source_idx on roads(source); create index target_idx on roads(target); 7. Load the sample MapGuide package file via Maestro or the MapGuide Site Adminstrator 8. Launch the sample application AJAX Viewer: http://localhost/mapguide/mapviewerajax/?WEBLAYOUT=Library://pg_routing/Layouts/pgrouting_basic.WebLayout&LOCALE=en Fusion: http://localhost/mapguide/fusion/templates/mapguide/slate/index.html?ApplicationDefinition=Library://pg_routing/Layouts/pgrouting_fusion.ApplicationDefinition&locale=en