mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-26 10:02:50 +00:00
4c6d76f2e0
git-svn-id: http://svn.osgeo.org/postgis/trunk@149 b70326c6-7e19-0410-871a-916f4a2858ee
73 lines
2.3 KiB
Plaintext
73 lines
2.3 KiB
Plaintext
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) 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.(mutually exclusive
|
|
with -c and -d)
|
|
-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 exclusive with -a and -d)
|
|
-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 and -c)
|
|
|
|
-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
|
|
|