Routing with elevation

De Stéphane Brunner.

Sommaire

Create shape index on srtm data (geotiff)

cd AddEle/tiff
gdaltindex srtm.shp *.tif

Add elevation

cd ..
python addEle switzerland.osm > switzerland-ele.osm

Build osm2postgis (my version)

cd ../osm2pgrouting/
make

Create db

sudo -u postgres createuser -SdR pgrouting
sudo -u postgres createdb -E UTF-8 -T template0 -O pgrouting pgrouting
sudo -u postgres createlang plpgsql pgrouting
sudo -u postgres psql pgrouting -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
sudo -u postgres psql pgrouting -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
sudo -u postgres psql pgrouting -f /usr/share/postlbs/routing_core.sql
sudo -u postgres psql pgrouting -f /usr/share/postlbs/routing_core_wrappers.sql
echo "ALTER TABLE spatial_ref_sys OWNER TO pgrouting;" | sudo -u postgres psql pgrouting
echo "ALTER TABLE geometry_columns OWNER TO pgrouting;" | sudo -u postgres psql pgrouting

Import to postgis (for pgrouting)

./osm2pgrouting -file ../AddEle/switzerland-ele.osm -conf bike.xml -clean > pgrouting.sql
sudo -u postgres psql pgrouting < pgrouting.sql

Create Final table

cd ../AddEle
./getSql | sudo -u postgres psql pgrouting

Copy on other computer

pg_dump -U pgrouting -F c -t edges pgrouting > pgrouting.dump
pg_restore -U pgrouting pgrouting.dump

To solve some issue see: http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS

Outils personnels