table of contents
other versions
- wheezy 1.5.3-2
- jessie 2.1.4+dfsg-3
- jessie-backports 2.3.1+dfsg-1~bpo8+1
- testing 2.3.1+dfsg-2
- unstable 2.3.1+dfsg-2
- experimental 2.3.2+dfsg-1~exp2
shp2pgsql(1) | PostGIS | shp2pgsql(1) |
NAME¶
shp2pgsql - shapefile to postgis loaderSYNTAX¶
shp2pgsql [ options] shapefile [schema.]tableDESCRIPTION¶
The shp2pgsql data loader converts ESRI Shape files into SQL suitable for insertion into a PostGIS/PostgreSQL database.USAGE¶
The <shapefile> is the name of the shape file, without any extension information. For example, 'roads' would be the name of the shapefile comprising the 'roads.shp', 'roads.shx', and 'roads.dbf' files.OPTIONS¶
The loader has several operating modes distinguished by command line flags:- -d
- Drops the database table before creating a new table with the data in the Shape file.
- -a
- Appends data from the Shape file into the database table. Note that to use this option to load multiple files, the files must have the same attributes and same data types.
- -c
- Creates a new table and populates it from the Shape file. This is the default mode.
- -p
- Only produces the table creation SQL code, without adding any actual data. This can be used if you need to completely separate the table creation and data loading steps.
- -D
- Use the PostgreSQL "dump" format for the output data. This can be combined with -a, -c and -d. It is much faster to load than the default "insert" SQL format. Use this for very large data sets.
- -s <SRID>
- Creates and populates the geometry tables with the specified SRID.
- -g <geometry_column>
- Specify the name of the geometry column (mostly useful in append mode).
- -k
- Keep idendifiers case (column, schema and attributes). Note that attributes in Shapefile are usually all UPPERCASE.
- -i
- Coerce all integers to standard 32-bit integers, do not create 64-bit bigints, even if the DBF header signature appears to warrant it.
- -S
- Generate simple Geometries instead of MULTIgeometries. Shape files don't differ between LINESTRINGs and MULTILINESTRINGs, so shp2pgsql generates MULTILINESTRINGs by default. This switch will produce LINESTRINGs instead, but shp2pgsql will fail when it hits a real MULTILINESTRING. The same works for POLYGONs vs. MULTIPOLYGONs.
- -w
- Output WKT format, for use with older (0.x) versions of PostGIS. Note that this will introduce coordinate drifts and will drop M values from shapefiles.
- -W <encoding>
- Specify the character encoding of Shapefile's attributes. If this option is used the output will be encoded in UTF-8.
- -I
- Create a GiST index on the geometry column.
- -N <policy>
- Specify NULL geometries handling policy (insert,skip,abort).
- -?
- Display version and usage information.