postgis/loader
Sandro Santilli 41da80c2d0 Fixed DBF field names handling as for clashes avoiding.
pgsql field renames are warned.


git-svn-id: http://svn.osgeo.org/postgis/trunk@1708 b70326c6-7e19-0410-871a-916f4a2858ee
2005-05-16 17:22:43 +00:00
..
.cvsignore more cvsignore 2003-11-12 20:59:06 +00:00
compat.h Added a copy of the PQunescapeBytea function found in libpq of PG>=73 2004-11-18 18:14:19 +00:00
dbfopen.c shapelib put in sync with gdal cvs 2003-12-01 20:52:00 +00:00
getopt.c - cleaned up all the compiler warnings 2002-10-17 16:45:04 +00:00
getopt.h Standard GNU option handling. 2001-10-22 20:13:29 +00:00
Makefile Added initial custom support for MINGW 2005-05-10 09:35:34 +00:00
pgsql2shp.c Fixed DBF field names handling as for clashes avoiding. 2005-05-16 17:22:43 +00:00
PQunescapeBytea.c Added a copy of the PQunescapeBytea function found in libpq of PG>=73 2004-11-18 18:14:19 +00:00
README.pgsql2shp Update shapelib references to 1.2.9. 2002-05-04 22:44:04 +00:00
README.shp2pgsql added -p option (prepare mode) that spits out the table schema without 2005-04-06 14:02:08 +00:00
shapefil.h shapelib put in sync with gdal cvs 2003-12-01 20:52:00 +00:00
shp2pgsql.c Applied patch from Ron Mayer fixing a segfault in string escaper funx 2005-04-21 09:08:34 +00:00
shpopen.c shapelib put in sync with gdal cvs 2003-12-01 20:52:00 +00:00
TODO updated 2004-11-18 18:16:11 +00:00
wkb.h Some more changes, now useless since wkb.h is no more used (just to get in sync) 2003-11-28 11:28:03 +00:00

shp2pgsql - Convert Shape file to PostGIS
~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VERSION: 0.7 (2002/05/04)

MORE INFORMATION: http://postgis.refractions.net

INTRODUCTION:
This program takes in ESRI shape files and output formatted text suitable
for uploading to the PostGIS/PostgreSQL spatial database using the psql
terminal monitor.

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


INSTALLATION:

To build shp2pgsql just run 'make'.
Copy the binary wherever you like. :)


USAGE:

shp2pgsql [<options>] <shapefile> <tablename> <database name>

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 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.

The <database name> is the name of the database you are going to put the
the data into.

The options are as follows:

(-a || -c || -d || -p) these options are mutually exclusive.

  -a    Append mode. Do not delete the target table or try to create
        a new table, simple insert the data into the existing table.
        A table will have to exist for this to work, it is usually
        used after a create mode as been run once or after -p. (mutually
        exclusive with -c, -d and -p)
  -c    Create mode. This is the default mode is no other is specified.
	Create a new table and upload the data into that table.
	(mutually eclusive with -a, -d and -p)
  -d    Delete mode. Delete the database table named <tablename>, then
	create a new one with that name before uploading the data into
	the new empty database table. (mutually exclusive with -a, -c 
        and -p)
  -p    Prepare mode. Read the table schema from the shape file and 
        create the new table, but do not insert any data. (mutually
        exclusive with -a, -c and -d)

  -D Dump. When inserting the data into the table use 'dump' format.
	Dump format is used by PostgreSQL for large data dumps and 
	uploads. Use this mode if your upload dataset is very large.
	(you may still specify -a,-c or -d in conjunction with -D)


EXAMPLES:

Loading directly:

  shp2pgsql -c roads1 roads_table my_db | psql -d my_db
  shp2pgsql -a roads2 roads_table my_db | psql -d my_db

Saving to an intermiate file using the 'dump' format:

  shp2pgsql -D roads1 roads_table my_db > roads.sql
  psql -d my_db -f roads.sql