Usage
ogr2ogr(src_datasource_name, dst_datasource_name, layer, skipfailures, append,
update, select, where, progress, sql, dialect, preserve_fid, fid, spat,
geomfield, a_srs, t_srs, s_srs, f, overwrite, dsco, lco, nln, nlt, dim, gt,
clipsrc, clipsrcsql, clipsrclayer, clipsrcwhere, clipdst, clipdstsql,
clipdstlayer, clipdstwhere, wrapdateline, datelineoffset, simplify,
segmentize, addfields, fieldTypeToString, unsetFieldWidth, fieldmap,
splitlistfields, maxsubfields, explodecollections, zfield, gcp, order,
additional_commands, verbose = FALSE)
Arguments
src_datasource_name
Character. Input vector file.
dst_datasource_name
Character. Output vector
file.
layer
Character. Layer to use.
skipfailures
Logical. Continue after a failure,
skipping the failed feature.
append
Logical. Append to existing layer instead
of creating new
update
Logical. Open existing output datasource in
update mode rather than trying to create a new one
select
Character. Comma-delimited list of fields
from input layer to copy to the new layer. A field is
skipped if mentioned previously in the list even if the
input layer has duplicate field names. (Defaults to all;
any field is skipped if a subsequent f
where
Character. Attribute query (like SQL
WHERE).
progress
Logical. (starting with GDAL 1.7.0)
Display progress on terminal. Only works if input layers
have the "fast feature count" capability.
sql
Character. SQL statement to execute. The
resulting table/layer will be saved to the output.
dialect
Character. SQL dialect. In some cases can
be used to use (unoptimized) OGR SQL instead of the
native SQL of an RDBMS by passing OGRSQL. Starting with
GDAL 1.10, the "SQLITE" dialect can also be used with any
datasource.
preserve_fid
Logical. Use the FID of the source
features instead of letting the output driver to
automatically assign a new one.
fid
Character. If provided, only the feature with
this feature id will be reported. Operates exclusive of
the spatial or attribute queries. Note: if you want to
select several features based on their feature id, you
can also use the fact the 'fid' is
spat
Numeric. c(xmin,ymin,xmax,ymax) spatial query
extents. Only features whose geometry intersects the
extents will be selected. The geometries will not be
clipped unless -clipsrc is specified
geomfield
Character. (OGR >= 2.0) Name of the
geometry field on which the spatial filter operates on.
a_srs
Character. Assign an output SRS.
t_srs
Character. Reproject/transform to this SRS
on output.
s_srs
Character. Override source SRS.
f
Character. output file format name (default is
ESRI Shapefile), some possible values are: "ESRI
Shapefile", "TIGER", "MapInfo File", "GML", "PostgreSQL"
overwrite
Logical. Delete the output layer and
recreate it empty.
dsco
Character. Dataset creation option (format
specific).
lco
Character. Layer creation option (format
specific).
nln
Character. Assign an alternate name to the new
layer.
nlt
Character. Define the geometry type for the
created layer. One of NONE, GEOMETRY, POINT, LINESTRING,
POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or
MULTILINESTRING. Add "25D" to the name to get 2.5D
versions. Starting with GDAL 1.10, PRO
dim
Character. (starting with GDAL 1.10) Force the
coordinate dimension to val (valid values are 2 or 3).
This affects both the layer geometry type, and feature
geometries. Starting with GDAL 2.0, the value can be set
to "layer_dim" to instruct featur
gt
Numeric. group n features per transaction
(default 200). Increase the value for better performance
when writing into DBMS drivers that have transaction
support.
clipsrc
Character. [xmin ymin xmax
ymax]|WKT|datasource|spat_extent: (starting with GDAL
1.7.0) clip geometries to the specified bounding box
(expressed in source SRS), WKT geometry (POLYGON or
MULTIPOLYGON), from a datasource or to the spatial extent
clipsrcsql
Character. Select desired geometries
using an SQL query instead.
clipsrclayer
Character. Select the named layer
from the source clip datasource.
clipsrcwhere
Character. Restrict desired
geometries based on attribute query.
clipdst
Character. (starting with GDAL 1.7.0) clip
geometries after reprojection to the specified bounding
box (expressed in dest SRS), WKT geometry (POLYGON or
MULTIPOLYGON) or from a datasource. When specifying a
datasource, you will generally want to u
clipdstsql
Character. Select desired geometries
using an SQL query instead.
clipdstlayer
Character. Select the named layer
from the destination clip datasource.
clipdstwhere
Character. Restrict desired
geometries based on attribute query.
wrapdateline
Logical. (starting with GDAL 1.7.0)
split geometries crossing the dateline meridian (long. =
+/- 180deg).
datelineoffset
Logical. (starting with GDAL 1.10)
offset from dateline in degrees (default long. = +/-
10deg, geometries within 170deg to -170deg will be
splited)
simplify
Numeric. (starting with GDAL 1.9.0)
distance tolerance for simplification. Note: the
algorithm used preserves topology per feature, in
particular for polygon geometries, but not for a whole
layer.
segmentize
Numeric. (starting with GDAL 1.6.0)
maximum distance between 2 nodes. Used to create
intermediate points
addfields
Logical. (starting with GDAL 2.0) This
is a specialized version of -append. Contrary to -append,
-addfields has the effect of adding, to existing target
layers, the new fields found in source layers. This
option is usefull when merging files that
fieldTypeToString
Character. (starting with GDAL
1.7.0) converts any field of the specified type to a
field of type string in the destination layer. Valid
types are : Integer, Real, String, Date, Time, DateTime,
Binary, IntegerList, RealList, StringList. Special va
unsetFieldWidth
Logical. (starting with GDAL 2.0)
set field width and precision to 0.
fieldmap
Character. (starting with GDAL 1.10.0)
Specifies the list of field indexes to be copied from the
source to the destination. The (n)th value specified in
the list is the index of the field in the target layer
definition in which the n(th) field of
splitlistfields
Logical. (starting with GDAL
1.8.0) split fields of type StringList, RealList or
IntegerList into as many fields of type String, Real or
Integer as necessary.
maxsubfields
Numeric. To be combined with
-splitlistfields to limit the number of subfields created
for each split field.
explodecollections
Logical. (starting with GDAL
1.8.0) produce one feature for each geometry in any kind
of geometry collection in the source file.
zfield
Character. (starting with GDAL 1.8.0) Uses
the specified field to fill the Z coordinate of
geometries.
gcp
Numeric. c(ungeoref_x,ungeoref_y,georef_x
georef_y,elevation) (starting with GDAL 1.10.0) Add the
indicated ground control point. This option may be
provided multiple times to provide a set of GCPs.
order
Numeric. (starting with GDAL 1.10.0) order
of polynomial used for warping (1 to 3). The default is
to select a polynomial order based on the number of
GCPs.
additional_commands
Character. Additional commands
to pass directly to ogrinfo.