@echo off cls rem rem script to build demonstration geodatabase on windows for MDweb 1.6 rem echo -------------------------------- echo MDweb spatial database creation echo --------------------------------- set /p bdmdweb=Name of MDweb spatial database ? : if("%bdmdweb%")==("") goto bd_vide set /p lwpostgis_path=absolute path for lwpostgis.sql file (with lwpostgis.sql in the path) ? : if("%lwpostgis_path%")==("") goto lwpostgis_vide set /p spatial_ref_sys_path=absolute path for spatial_ref_sys.sql file (with spatial_ref_sys.sql in the path) ? : if("%spatial_ref_sys_path%")==("") goto spatial_ref_sys_vide rem test de l'existence des chemin if not exist "%lwpostgis_path%" set lwpostgis_path="c:\Program Files\postgresql\8.1\share\contrib\lwpostgis.sql" if not exist "%lwpostgis_path%" goto false_path_lwpostgis :test_spatial if not exist "%spatial_ref_sys_path%" set spatial_ref_sys_path="c:\Program Files\postgresql\8.1\share\contrib\spatial_ref_sys.sql" if not exist "%spatial_ref_sys_path%" goto false_path_spatial_ref_sys :db_creation echo ---------------------------------------------------------- echo name of spatial database : %bdmdweb% echo path for lwpostgis.sql file : %lwpostgis_path% echo path for spatial_ref_sys.sql file : %spatial_ref_sys_path% echo ----------------------------------------------------------- pause pg_dump -d %bdmdweb% -U postgres > backup-%bdmdweb%.sql dropdb %bdmdweb% -U postgres createdb %bdmdweb% -E LATIN1 -U postgres -T template0 createlang plpgsql %bdmdweb% -U postgres psql -d %bdmdweb% -U postgres -f "%lwpostgis_path%" psql -d %bdmdweb% -U postgres -f "%spatial_ref_sys_path%" psql -d %bdmdweb% -U postgres < geo-demo16.sql goto end :bd_vide echo ---------------------------------------------------- echo you don't input the name of MDweb spatial database echo ---------------------------------------------------- pause goto eof :lwpostgis_vide echo ------------------------------------------------------ echo you don't input the name path for lwpostigs.sql file echo ----------------------------------------------------- pause goto eof :spatial_ref_sys_vide echo ------------------------------------------------------------ echo you don't input the name path for spatial_ref_sys.sql file echo ----------------------------------------------------------- pause goto eof :false_path_lwpostgis echo ----------------------------------------------- echo the path %lwpostgis_path% don't exists ... echo ----------------------------------------------- pause goto eof :false_path_spatial_ref_sys echo ------------------------------------------------- echo the path %spatial_ref_sys_path% don't exists ... echo ------------------------------------------------- pause goto eof :eof echo -------------------------------------------------- echo the spatial database creation was aborted echo -------------------------------------------------- pause exit :end echo ------------------------------------------------------ echo the spatial database creation is successful echo ------------------------------------------------------ pause