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