Project

General

Profile

Shapefiles

Command line

Typical import:

shp2pgsql -s 32644 AV_wells_UTM44N.shp wells | psql -U avgis -d avgis -h server.gis.av

The "-s 32644" parameter sets the geo reference system ID, which is not detected automatically, apparently. Shapefiles in the AV project use 32644 (http://spatialreference.org/ref/epsg/wgs-84-utm-zone-44n/) as the coordinates system.

Postgres can use a file where passwords are stored ($HOME/.pgpass), it's handy to set it like so:

server.gis.av:5432:avgis:avgis:the_password

QGis

Qgis can be used to import Shapefiles to the database. It's dead easy, just drag and drop the files (from the Browser Panel -> Home/...) to the database connection.

However, there are 2 issues:

1. it doesn't set the geometry features metadata to the proper SRID (32644 in our case), leading to difficulties fetching the proper coordinates.

One way around it is to force the geomety in the imported tables with the Postgis UpdateGeometrySRID function, like so:

psql -U avgis -d avgis -h server.gis.av -c "select UpdateGeometrySRID('public', 'wells', 'geom', 32644) ;" 

2. It imports geometries as "multi", aka points are defined as MultiPoint. Not sure at this early stage (of writing) what are the consequences, Gisaf assumes that single points are stored as "Point".