1#/bin/sh 2 3# don't launch directly this script 4# use 'make install-demo' to do so 5 6PGBIN=@POSTGIS_BIN@ 7PGSHARE=@POSTGIS_SHARE@/contrib/postgis-1.5 8PGUSER=postgres 9SHP2PGSQL=@SHP2PGSQL@ 10DB=tinyows_demo 11 12if [ -d @POSTGIS_SHARE@/contrib/postgis-2.0 ]; then 13 PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.0 14elif [ -d @POSTGIS_SHARE@/contrib/postgis-1.5 ]; then 15 PGSHARE=@POSTGIS_SHARE@/contrib/postgis-1.5 16else 17 echo "Unable to find PostGIS dir in @POSTGIS_SHARE@/contrib/" && exit 1 18fi 19 20echo "Create Spatial Database: $DB" 21su $PGUSER -c "$PGBIN/dropdb $DB > /dev/null 2> /dev/null" 22su $PGUSER -c "$PGBIN/createdb $DB" 23su $PGUSER -c "$PGBIN/createlang plpgsql $DB" 24su $PGUSER -c "$PGBIN/psql $DB < $PGSHARE/postgis.sql" 25su $PGUSER -c "$PGBIN/psql $DB < $PGSHARE/spatial_ref_sys.sql" 26 27echo "Import layer data: world" 28$SHP2PGSQL -s 4326 -I demo/world.shp world > _world.sql 29su $PGUSER -c "$PGBIN/psql $DB < _world.sql" 30 31echo "Import layer data: france_dept" 32$SHP2PGSQL -s 27582 -I -W latin1 demo/france.shp france > _france.sql 33su $PGUSER -c "$PGBIN/psql $DB < _france.sql" 34 35rm _world.sql _france.sql 36