~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to ogr/ogrsf_frmts/pgdump/drv_pgdump.html

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<title>PGDump (PostgreSQL SQL Dump)</title>
 
4
</head>
 
5
 
 
6
<body bgcolor="#ffffff">
 
7
 
 
8
<h1>PostgreSQL SQL Dump</h1>
 
9
 
 
10
(GDAL/OGR >= 1.8.0)<p>
 
11
 
 
12
This write-only driver implements support for generating a SQL dump file that
 
13
can later be injected into a live PostgreSQL instance. It supports
 
14
PostgreSQL extended with the 
 
15
<a href="http://www.postgis.org/">PostGIS</a> geometries.<p>
 
16
 
 
17
This driver is very similar to the PostGIS shp2pgsql utility.<p>
 
18
 
 
19
Most creation options are shared with the regular PostgreSQL driver.<p>
 
20
 
 
21
<h2>Creation options</h2>
 
22
 
 
23
<h3>Dataset Creation Options</h3>
 
24
 
 
25
<ul>
 
26
<li> <b>LINEFORMAT</b>:
 
27
By default files are created with the line
 
28
termination conventions of the local platform (CR/LF on win32 or 
 
29
LF on all other systems).  This may be overridden through use of the
 
30
LINEFORMAT layer creation option which may have a value of <b>CRLF</b>
 
31
(DOS format) or <b>LF</b> (Unix format). <p>
 
32
</ul>
 
33
 
 
34
<h3>Layer Creation Options</h3>
 
35
 
 
36
<ul>
 
37
<li>
 
38
<b>GEOM_TYPE</b>: The GEOM_TYPE layer creation option can be set to 
 
39
one of "geometry" or "geography" (PostGIS >= 1.5) to force the type of geometry used for
 
40
a table. "geometry" is the default value.<p>
 
41
<li> <b>LAUNDER</b>: This may be "YES" to force new fields created on this
 
42
layer to have their field names "laundered" into a form more compatible with
 
43
PostgreSQL.  This converts to lower case and converts some special characters
 
44
like "-" and "#" to "_".  If "NO" exact names are preserved.  
 
45
The default value is "YES".  If enabled the table (layer) name will also be laundered.<p>
 
46
<li> <b>PRECISION</b>: This may be "YES" to force new fields created on this
 
47
layer to try and represent the width and precision information, if available
 
48
using NUMERIC(width,precision) or CHAR(width) types.  If "NO" then the types
 
49
FLOAT8, INTEGER and VARCHAR will be used instead.  The default is "YES".<p>
 
50
<li> <b>DIM={2,3}</b>: Control the dimension of the layer.  Defaults to 3. 
 
51
Important to set to 2 for 2D layers with PostGIS 1.0+ as it has constraints
 
52
on the geometry dimension during loading.<p>
 
53
<li> <b>GEOMETRY_NAME</b>: Set name of geometry column in new table.  If 
 
54
omitted it defaults to <i>wkb_geometry</i> for GEOM_TYPE=geometry, or <i>the_geog</i> for GEOM_TYPE=geography.<p>
 
55
<li> <b>SCHEMA</b>: Set name of schema for new table.
 
56
Using the same layer name in different schemas is supported, but not in the public schema and others.<p>
 
57
<li> <b>CREATE_SCHEMA</b>: (OGR >= 1.8.1) To be used in combination with SCHEMA. Set to ON by default so that
 
58
the CREATE SCHEMA instruction is emitted. Turn to OFF to prevent CREATE SCHEMA from being emitted.<p>
 
59
<li> <b>SPATIAL_INDEX</b>:  Set to ON by default. Creates a spatial index on the geometry column
 
60
to speed up queries. Set to OFF to disable. (Has effect only when PostGIS is available).<p>
 
61
<li> <b>TEMPORARY</b>: Set to OFF by default. Creates a temporary table instead of a permanent one.<p>
 
62
<li> <b>WRITE_EWKT_GEOM</b>: Set to OFF by default. Turn to ON to write EWKT geometries instead of HEX geometries.
 
63
This option will have no effect if PG_USE_COPY environment variable is to YES.<p>
 
64
<li> <b>CREATE_TABLE</b>: Set to ON by default so that tables are recreated if necessary. Turn to OFF to disable this and use existing table structure.<p>
 
65
<li> <b>DROP_TABLE</b>: (OGR >= 1.8.1) Set to ON by default so that tables are destroyed before being recreated.
 
66
Set to OFF to prevent DROP TABLE from being emitted. Set to IF_EXISTS in order DROP TABLE IF EXISTS to be emitted (needs PostgreSQL >= 8.2)<p>
 
67
<li> <b>SRID</b>: Set the SRID of the geometry. Defaults to -1, unless a SRS is associated with the layer. In the case, if the EPSG code is mentionned, it will be used as the SRID. (Note: the spatial_ref_sys table must be correctly populated with the specified SRID) <p>
 
68
<li> <b>NONE_AS_UNKNOWN</b>: (From GDAL 1.9.0) Can bet set to TRUE to force non-spatial layers (wkbNone) to be created as
 
69
spatial tables of type GEOMETRY (wkbUnknown), which was the behaviour prior to GDAL 1.8.0. Defaults to NO, in which case
 
70
a regular table is created and not recorded in the PostGIS geometry_columns table.<p>
 
71
<li> <b>FID</b>: (From GDAL 1.9.0) Name of the FID column to create. Defaults to 'ogc_fid'.<p>
 
72
<li> <b>EXTRACT_SCHEMA_FROM_LAYER_NAME</b>: (From GDAL 1.9.0) Can be set to NO to avoid considering the dot character
 
73
as the separator between the schema and the table name. Defaults to YES.<p>
 
74
</ul>
 
75
 
 
76
<h3>Environment variables</h3>
 
77
 
 
78
<ul>
 
79
<li><b>PG_USE_COPY</b>: This may be "YES" for using COPY for inserting data to Postgresql.
 
80
COPY is less robust than INSERT, but significantly faster.</li><p>
 
81
</ul>
 
82
 
 
83
<h3>VSI Virtual File System API support</h3>
 
84
 
 
85
(Some features below might require OGR >= 1.9.0)<p>
 
86
 
 
87
The driver supports rwriting to files managed by VSI Virtual File System API, which include
 
88
"regular" files, as well as files in the /vsizip/, /vsigzip/ domains.<p>
 
89
 
 
90
Writing to /dev/stdout or /vsistdout/ is also supported.<p>
 
91
 
 
92
<h3>Example</h3>
 
93
 
 
94
<ul>
 
95
<li>
 
96
Simple translation of a shapefile into PostgreSQL into a file abc.sql.  The table 'abc' will
 
97
be created with the features from abc.shp and attributes from abc.dbf. The SRID is specified.
 
98
PG_USE_COPY is set to YES to improve the peformance.<p>
 
99
 
 
100
<pre>
 
101
% ogr2ogr --config PG_USE_COPY YES -f PGDump abc.sql abc.shp -lco SRID=32631
 
102
</pre>
 
103
 
 
104
<li>
 
105
Pipe the output of the PGDump driver into the psql utility.
 
106
 
 
107
<pre>
 
108
% ogr2ogr --config PG_USE_COPY YES -f PGDump /vsistdout/ abc.shp | psql -d my_dbname -f -
 
109
</pre>
 
110
 
 
111
</ul>
 
112
 
 
113
<h3>See Also</h3>
 
114
 
 
115
<ul>
 
116
<li> <a href="drv_pg.html">OGR PostgreSQL driver Page</a><p>
 
117
<li> <a href="http://www.postgresql.org/">PostgreSQL Home Page</a><p>
 
118
<li> <a href="http://www.postgis.org/">PostGIS</a><p>
 
119
<li> <a href="http://trac.osgeo.org/postgis/wiki/UsersWikiOGR">PostGIS / OGR Wiki Examples Page</a><p>
 
120
</ul>
 
121
 
 
122
</body>
 
123
</html>