Thursday, September 22, 2016

Export/Imoprt PostgreSQL database with PostGIS extension

#Run from windows command prompt
#Create dump into dump.sql

C:\Program Files\PostgreSQL\9.4\bin>pg_dump.exe -h localhost -p 5432 -U username dbnameToExport > D:\dump.sql

#Import dump

C:\Program Files\PostgreSQL\9.4\bin>psql.exe -h localhost -p 5432 -U postgres dbnameToImport < D:/dump.sql

Password for user postgres:

Only super user can create PostGIS extension in PostgreSQL.

Reproject Geometry from WGS84 to Web Mercator Aux

ALTER TABLE table_name
            ALTER COLUMN column_name TYPE geometry(MultiPolygon, 3857) USING                        ST_Transform(ST_SetSRID(column_name,4326),3857) ;

 Linux, import Postgresql dump with Postgresql database:
psql -h hostname -d databasename -U username -f dumpfile.sql

PostGIS , PostgreGIS


Post a Comment


© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me