PostGIS function pgsql2shp
|The example below is using the staging area database.|
One of the geotables need to be included in the table/view that you are exporting:
You do not need to include longitude and latitude columns for points in the SQL view since it is the column shape that will be used when creating the shape file.
The mandatory column to include in the export is called shape
- Create a SQL view or use one of the existing GIS views
- Open the command / DOS prompt
- Go to C:\IMSMAng\pgsql\bin
- Run the command pgsql2shp with the following parameters
- -f the name of the resulting shape file
- -h host name
- if the Staging area database is on your computer than use localhost
- -u user
- use imsma
- -P password
- use password
- database name
- SQL view or table name
- The export files are created in C:\IMSMAng\pgsql\bin (dbf, prj, shp and shx)
If you would like to export all rows then you only need to refer to the SQL view/table by the name of it.
If you would like to export only some of the rows then you need to add SQL statement.
The number of rows exported will be shown when the export is done
|If the Output shape type is Unknown or Null then there is something wrong with the SQL view/table. Most likely the mandatory column shape is not included.|