File: README.shp2pgsql

package info (click to toggle)
postgis 3.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 70,052 kB
  • sloc: ansic: 162,204; sql: 93,950; xml: 53,121; cpp: 12,646; perl: 5,658; sh: 5,369; makefile: 3,434; python: 1,205; yacc: 447; lex: 151; pascal: 58
file content (135 lines) | stat: -rw-r--r-- 5,047 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
shp2pgsql(1)                        PostGIS                       shp2pgsql(1)



NAME
       shp2pgsql - shapefile to postgis loader


SYNTAX
       shp2pgsql [options] shapefile [schema.]table


DESCRIPTION
       The  shp2pgsql  data loader converts ESRI Shape files into SQL suitable
       for insertion into a PostGIS/PostgreSQL database.

       Version: 1.1.5 (2006/10/06)


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.

       The <tablename>  is  the  (optionally  schema-qualified)  name  of  the
       database table you want the data stored in in the database. Within that
       table, the geometry  will  be  placed  in  the  'geo_value'  column  by
       default.


OPTIONS
       The  loader  has  several operating modes distinguished by command line
       flags:

       (Note that -a, -c, -d and -p are mutually exclusive.)

       -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 sepa-
              rate 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 [<FROM_SRID>:]<SRID>
              Creates and populates the geometry tables with the specified SRID.
              Optionally specifies that the input shapefile uses the given
              FROM_SRID, in which case the geometries will be reprojected 
              to the target 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 war-
              rant 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).
              Default: insert.

       -?     Display version and usage information.


INSTALLATION
       To compile the program from source, simply run  "make"  in  the  source
       directory.  Then copy the binary in your shell search path (or wherever
       you like). This text is also available as a man page in the ../doc/man/
       directory,  ready for copying it into the manual search path on unixoid
       systems.


EXAMPLES
       An example session using the loader to create an input file and upload-
       ing it might look like this:

       # shp2pgsql shaperoads roadstable roadsdb > roads.sql
       # psql -d roadsdb -f roads.sql

       A conversion and upload can be done all in one step using UNIX pipes:

       # shp2pgsql shaperoads roadstable roadsdb | psql -d roadsdb


AUTHORS
       Originally written by Jeff Lounsbury <jeffloun@refractions.net>.
       Improved and maintained by 
       Sandro Santilli <strk@kbt.io>, Regina Obe <lr@pcorp.us>.
       Includes small contributions and improvements by others.

       This  application  uses  functionality  from  shapelib  1.2.9  by Frank
       Warmerdam <warmerda@gdal.velocet.ca> to read from ESRI Shape files.


SEE ALSO
       pgsql2shp(1)

       More information is available at http://postgis.net



                                                                  shp2pgsql(1)