/*! \page ogr_utilities OGR Utility Programs
\brief A collection of OGR related programs.

The following utilities are distributed as part of the OGR Simple Features
toolkit:

<ul>
<li> \ref ogrinfo - Lists information about an OGR supported data source
<li> \ref ogr2ogr - Converts simple features data between file formats
<li> \ref ogrtindex - Creates a tileindex
<li> \ref ogrlineref - Create linear reference and provide some calculations using it
</ul>

\section gdal_utilities_switches General Command Line Switches
All GDAL OGR command line utility programs support the following 
"general" options.<p>

<dl>
<dt> <b>\-\-version</b></dt><dd> Report the version of GDAL and exit.</dd>

<dt> <b>\-\-formats</b></dt><dd> List all vector formats supported by this
GDAL build (read-only and read-write) and exit. The format support is indicated
 as follows: 'ro' is read-only driver; 
'rw' is read or write (i.e. supports CreateCopy);
'rw+' is read, write and update (i.e. supports Create).
A 'v' is appended for formats supporting virtual IO (/vsimem, /vsigzip, /vsizip, etc).
A 's' is appended for formats supporting subdatasets.
</dd>

<dt> <b>\-\-format</b> <i>format</i></dt><dd>
List detailed information about a single format driver.  The <i>format</i> 
should be the short name reported in the <b>\-\-formats</b> list, such as 
GML.</dd>

<dt> <b>\-\-optfile</b> <i>file</i></dt><dd>
Read the named file and substitute the contents into the command line
options list.  Lines beginning with # will be ignored.  Multi-word arguments
may be kept together with double quotes. 
</dd>

<dt> <b>\-\-config</b> <i>key value</i></dt><dd>
Sets the named <a href="http://trac.osgeo.org/gdal/wiki/ConfigOptions">
configuration keyword</a> to the given value, as opposed to 
setting them as environment variables.  Some common configuration keywords
are SHAPE_ENCODING (force shapefile driver to read DBF files with the given
character encoding) and CPL_TEMPDIR (define the location of temporary files).
Individual drivers may be influenced by other configuration options.  
</dd>

<dt> <b>\-\-debug</b> <i>value</i></dt><dd>
Control what debugging messages are emitted.  A value of <i>ON</i> will
enable all debug messages.  A value of <i>OFF</i> will disable all debug
messages.  Another value will select only debug messages containing that
string in the debug prefix code.  
</dd>

<dt> <b>\-\-help-general</b></dt><dd>
Gives a brief usage message for the generic GDAL OGR command line options 
and exit.
</dd>

</dl>


*/

/*! \page ogrinfo ogrinfo

lists information about an OGR supported data source

\section ogrinfo_synopsis SYNOPSIS

\htmlonly
Usage:
\endhtmlonly

\verbatim
ogrinfo [--help-general] [-ro] [-q] [-where restricted_where|@filename]
        [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]
        [-sql statement|@filename] [-dialect dialect] [-al] [-so] [-fields={YES/NO}]
        [-geom={YES/NO/SUMMARY/WKT/ISO_WKT}] [-formats] [[-oo NAME=VALUE] ...]
        [-nomd] [-listmdd] [-mdd domain|`all`]*
        [-nocount] [-noextent]
        datasource_name [layer [layer ...]]

\endverbatim

\section ogrinfo_description DESCRIPTION

The ogrinfo program lists various information about an OGR supported data
source to stdout (the terminal). 

<dl>
<dt> <b>-ro</b>:</dt><dd> Open the data source in read-only mode.  </dd>
<dt> <b>-al</b>:</dt><dd> List all features of all layers (used instead of having to
give layer names as arguments).</dd>
<dt> <b>-so</b>:</dt><dd> Summary Only: suppress listing of features, show only the 
summary information like projection, schema, feature count and
extents.</dd>
<dt> <b>-q</b>:</dt><dd> Quiet verbose reporting of various information, including
coordinate system, layer schema, extents, and feature count. </dd>
<dt> <b>-where</b> <i>restricted_where</i>:</dt><dd> An attribute query in a restricted
form of the queries used in the SQL WHERE statement.   Only features matching
the attribute query will be reported. Starting with GDAL 2.1, the @filename syntax
can be used to indicate that the content is in the pointed filename.</dd>
<dt> <b>-sql</b> <i>statement</i>:</dt><dd> Execute the indicated SQL statement
and return the result. Starting with GDAL 2.1, the @filename syntax
can be used to indicate that the content is in the pointed filename.</dd>
<dt> <b>-dialect</b> <em>dialect</em>:</dt><dd> 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.</dd>
<dt> <b>-spat</b> <i>xmin ymin xmax ymax</i>:</dt><dd> The area of interest.  Only
features within the rectangle will be reported.</dd>
<dt> <b>-geomfield</b> <i>field</i>:</dt><dd> (OGR &gt;= 1.11) Name of the geometry field
on which the spatial filter operates on.</dd>
<dt> <b>-fid</b> <i>fid</i>:</dt><dd> 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 a special field recognized by OGR SQL. So, '-where "fid in (1,3,5)"'
would select features 1, 3 and 5.</dd>
<dt> <b>-fields</b>={YES/NO}:</dt><dd> (starting with GDAL 1.6.0) If set to NO,
the feature dump will not display field values. Default value is YES.</dd>
<dt> <b>-geom</b>={YES/NO/SUMMARY/WKT/ISO_WKT}:</dt><dd> (starting
with GDAL 1.6.0) If set to NO, the feature dump will not display the
geometry. If set to SUMMARY, only a summary of the geometry will be
displayed. If set to YES or ISO_WKT, the geometry will be reported in
full OGC WKT format. If set to WKT the geometry will be reported in
legacy WKT. Default value is YES. (WKT and ISO_WKT are available
starting with GDAL 2.1, which also changes the default to
ISO_WKT)</dd>
<dt> <b>-oo</b> <em>NAME=VALUE</em>:</dt><dd>(starting with GDAL 2.0) Dataset open option (format specific)</dd>
<dt> <b>-nomd</b></dt><dd>(starting with GDAL 2.0)  Suppress metadata printing. Some datasets may contain a lot
of metadata strings.</dd>
<dt> <b>-listmdd</b></dt><dd>(starting with GDAL 2.0)  List all metadata domains available for the dataset.</dd>
<dt> <b>-mdd domain</b></dt><dd>(starting with GDAL 2.0)  Report metadata for the specified domain.
"all" can be used to report metadata in all domains</dd>
<dt> <b>-nocount</b></dt><dd>(starting with GDAL 2.0)  Suppress feature count printing.</dd>
<dt> <b>-noextent</b></dt><dd>(starting with GDAL 2.0)  Suppress spatial extent printing.</dd>
<dt> <b>\-\-formats</b>:</dt><dd> List the format drivers that are
enabled.</dd>
<dt> <i>datasource_name</i>:</dt><dd> The data source to open.  May be a filename, 
directory or other virtual name.  See the <a href="ogr/ogr_formats.html">OGR Vector
Formats</a> list for supported datasources.</dd>
<dt> <i>layer</i>:</dt><dd> One or more layer names may be reported.</dd>
</dl>

If no layer names are passed then ogrinfo will report a list of available
layers (and their layer wide geometry type).  If layer name(s) are given then
their extents, coordinate system, feature count, geometry type, schema and
all features matching query parameters will be reported to the terminal. 
If no query parameters are provided, all features are reported.  

Geometries are reported in OGC WKT format.

\section ogrinfo_example EXAMPLE

Example reporting all layers in an NTF file:
\verbatim
% ogrinfo wrk/SHETLAND_ISLANDS.NTF
INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
using driver `UK .NTF' successful.
1: BL2000_LINK (Line String)
2: BL2000_POLY (None)
3: BL2000_COLLECTIONS (None)
4: FEATURE_CLASSES (None)
\endverbatim

Example using an attribute query is used to restrict the output of the 
features in a layer:
\verbatim
% ogrinfo -ro -where 'GLOBAL_LINK_ID=185878' wrk/SHETLAND_ISLANDS.NTF BL2000_LINK
INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
using driver `UK .NTF' successful.

Layer name: BL2000_LINK
Geometry: Line String
Feature Count: 1
Extent: (419794.100000, 1069031.000000) - (419927.900000, 1069153.500000)
Layer SRS WKT:
PROJCS["OSGB 1936 / British National Grid",
    GEOGCS["OSGB 1936",
        DATUM["OSGB_1936",
            SPHEROID["Airy 1830",6377563.396,299.3249646]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",49],
    PARAMETER["central_meridian",-2],
    PARAMETER["scale_factor",0.999601272],
    PARAMETER["false_easting",400000],
    PARAMETER["false_northing",-100000],
    UNIT["metre",1]]
LINE_ID: Integer (6.0)
GEOM_ID: Integer (6.0)
FEAT_CODE: String (4.0)
GLOBAL_LINK_ID: Integer (10.0)
TILE_REF: String (10.0)
OGRFeature(BL2000_LINK):2
  LINE_ID (Integer) = 2
  GEOM_ID (Integer) = 2
  FEAT_CODE (String) = (null)
  GLOBAL_LINK_ID (Integer) = 185878
  TILE_REF (String) = SHETLAND I
  LINESTRING (419832.100 1069046.300,419820.100 1069043.800,419808.300
  1069048.800,419805.100 1069046.000,419805.000 1069040.600,419809.400
  1069037.400,419827.400 1069035.600,419842 1069031,419859.000
  1069032.800,419879.500 1069049.500,419886.700 1069061.400,419890.100
  1069070.500,419890.900 1069081.800,419896.500 1069086.800,419898.400
  1069092.900,419896.700 1069094.800,419892.500 1069094.300,419878.100
  1069085.600,419875.400 1069087.300,419875.100 1069091.100,419872.200
  1069094.600,419890.400 1069106.400,419907.600 1069112.800,419924.600
  1069133.800,419927.900 1069146.300,419927.600 1069152.400,419922.600
  1069153.500,419917.100 1069153.500,419911.500 1069153.000,419908.700
  1069152.500,419903.400 1069150.800,419898.800 1069149.400,419894.800
  1069149.300,419890.700 1069149.400,419890.600 1069149.400,419880.800
  1069149.800,419876.900 1069148.900,419873.100 1069147.500,419870.200
  1069146.400,419862.100 1069143.000,419860 1069142,419854.900
  1069138.600,419850 1069135,419848.800 1069134.100,419843
  1069130,419836.200 1069127.600,419824.600 1069123.800,419820.200
  1069126.900,419815.500 1069126.900,419808.200 1069116.500,419798.700
  1069117.600,419794.100 1069115.100,419796.300 1069109.100,419801.800
  1069106.800,419805.000  1069107.300)
\endverbatim

\if man
\section ogrinfo_author AUTHORS
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de>
\endif
*/

/*! \page ogr2ogr ogr2ogr

converts simple features data between file formats

\section ogr2ogr_synopsis SYNOPSIS

\htmlonly
Usage:
\endhtmlonly

\verbatim
Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
               [-select field_list] [-where restricted_where|@filename] 
               [-progress] [-sql <sql statement>|@filename] [-dialect dialect]
               [-preserve_fid] [-fid FID]
               [-spat xmin ymin xmax ymax] [-spat_srs srs_def] [-geomfield field]
               [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
               [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
               dst_datasource_name src_datasource_name
               [-lco NAME=VALUE] [-nln name]
               [-nlt type|PROMOTE_TO_MULTI|CONVERT_TO_LINEAR]
               [-dim XY|XYZ|XYM|XYZM|2|3|layer_dim] [layer [layer ...]]

Advanced options :
               [-gt n]
               [[-oo NAME=VALUE] ...] [[-doo NAME=VALUE] ...]
               [-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent]
               [-clipsrcsql sql_statement] [-clipsrclayer layer]
               [-clipsrcwhere expression]
               [-clipdst [xmin ymin xmax ymax]|WKT|datasource]
               [-clipdstsql sql_statement] [-clipdstlayer layer]
               [-clipdstwhere expression]
               [-wrapdateline] [-datelineoffset val]
               [[-simplify tolerance] | [-segmentize max_dist]]
               [-addfields] [-unsetFid]
               [-relaxedFieldNameMatch] [-forceNullable] [-unsetDefault]
               [-fieldTypeToString All|(type1[,type2]*)] [-unsetFieldWidth]
               [-mapFieldType type1|All=type2[,type3=type4]*]
               [-fieldmap identity | index1[,index2]*]
               [-splitlistfields] [-maxsubfields val]
               [-explodecollections] [-zfield field_name]
               [-gcp pixel line easting northing [elevation]]* [-order n | -tps]
               [-nomd] [-mo \"META-TAG=VALUE\"]* [-noNativeData]

\endverbatim

\section ogr2ogr_description DESCRIPTION

This program can be used to convert simple features data between file formats
performing various operations during the process such as spatial or attribute
selections, reducing the set of attributes, setting the output coordinate 
system or even reprojecting the features during translation.

<dl>
<dt><b> -f</b><em> format_name</em>:</dt><dd> output file format name (default is ESRI Shapefile), some possible values are:
	 \verbatim
     -f "ESRI Shapefile"
     -f "TIGER"
     -f "MapInfo File"
     -f "GML"
     -f "PostgreSQL"
	 \endverbatim
	 </dd>
<dt><b>-append</b>:</dt><dd> Append to existing layer instead of creating
new</dd>
<dt><b>-overwrite</b>:</dt><dd> Delete the output layer and recreate it empty</dd>
<dt>  <b>-update</b>:</dt><dd> Open existing output datasource in update mode rather than trying to create a new one</dd>
<dt> <b>-select</b><em> field_list</em>:</dt><dd> 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 field with
same name is found.) Starting with OGR 1.11, geometry fields can also be specified
in the list.</dd>
<dt> <b>-progress</b>:</dt><dd> (starting with GDAL 1.7.0) Display progress on terminal. Only works if input layers have the "fast feature count" capability.</dd>
<dt> <b>-sql</b> <em>sql_statement</em>:</dt><dd> SQL statement to execute.
The resulting table/layer will be saved to the output. Starting with GDAL 2.1, the @filename syntax
can be used to indicate that the content is in the pointed filename.</dd>
<dt> <b>-dialect</b> <em>dialect</em>:</dt><dd> 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.</dd>
<dt> <b>-where</b><em> restricted_where</em>:</dt><dd> Attribute query (like SQL WHERE).
Starting with GDAL 2.1, the @filename syntax can be used to indicate that the content is in the pointed filename.</dd>
<dt> <b>-skipfailures</b>:</dt><dd>Continue after a failure, skipping the failed feature.</dd>
<dt> <b>-spat</b><em> xmin ymin xmax ymax</em>:</dt><dd> spatial query extents, in the
SRS of the source layer(s) (or the one specified with -spat_srs). Only features
whose geometry intersects the extents will be selected. The geometries will not be clipped unless -clipsrc is specified</dd>
<dt> <b>-spat_srs</b><em> srs_def</em>:</dt><dd> (OGR &gt;= 2.0) Override spatial filter SRS.</dd>
<dt> <b>-geomfield</b> <i>field</i>:</dt><dd> (OGR &gt;= 1.11) Name of the geometry field
on which the spatial filter operates on.</dd>
<dt> <b>-dsco</b> <em>NAME=VALUE</em>:</dt><dd> Dataset creation option (format specific)</dd>
<dt> <b>-lco</b><em>  NAME=VALUE</em>:</dt><dd> Layer creation option (format specific)</dd>
<dt> <b>-nln</b><em> name</em>:</dt><dd> Assign an alternate name to the new layer</dd>
<dt> <b>-nlt</b><em> type</em>:</dt><dd> Define the geometry type for
the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON,
GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. And
CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE and
MULTISURFACE for GDAL 2.0 non-linear geometry types. Add "Z", "M", or
"ZM" to the name to get coordinates with elevation, measure, or
elevation and measure. Starting with GDAL 1.10, PROMOTE_TO_MULTI can
be used to automatically promote layers that mix polygon or
multipolygons to multipolygons, and layers that mix linestrings or
multilinestrings to multilinestrings. Can be useful when converting
shapefiles to PostGIS and other target drivers that implement strict
checks for geometry types. Starting with GDAL 2.0, CONVERT_TO_LINEAR
can be used to to convert non-linear geometries types into linear
geometries by approximating them. Starting with 2.1 the type can be
defined as measured ("25D" remains as an alias for single "Z").</dd>
<dt> <b>-dim</b><em> val</em>:</dt><dd>(starting with GDAL 1.10) Force
the coordinate dimension to val (valid values are XY, XYZ, XYM, and
XYZM - for backwards compatibility 2 is an alias for XY and 3 is an
alias for XYZ). This affects both the layer geometry type, and feature
geometries. Starting with GDAL 1.11, the value can be set to
"layer_dim" to instruct feature geometries to be promoted to the
coordinate dimension declared by the layer. Support for M was added in
GDAL 2.1</dd>
<dt> <b>-a_srs</b><em> srs_def</em>:</dt><dd> Assign an output SRS</dd>
<dt> <b>-t_srs</b><em> srs_def</em>:</dt><dd> Reproject/transform to this SRS on output</dd>
<dt> <b>-s_srs</b><em> srs_def</em>:</dt><dd> Override source SRS</dd>
<dt> <b>-preserve_fid</b>:</dt><dd>Use the FID of the source features instead of letting the output driver to automatically assign a new one.
Note: starting with GDAL 2.0, if not in append mode, this behaviour becomes the default if the output driver
has a FID layer creation option. In which case the name of the source FID column will
be used and source feature IDs will be attempted to be preserved. This behaviour
can be disabled by setting -unsetFid</dd>
<dt> <b>-fid</b> <i>fid</i>:</dt><dd> 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 a special field recognized by OGR SQL. So, '-where "fid in (1,3,5)"'
would select features 1, 3 and 5.</dd>
</dl>

Srs_def can be a full WKT definition (hard to escape properly), or a well
known definition (i.e. EPSG:4326) or a file with a WKT definition.

Advanced options :

<dl>
<dt> <b>-oo</b> <em>NAME=VALUE</em>:</dt><dd>(starting with GDAL 2.0) Input dataset open option (format specific)</dd>
<dt> <b>-doo</b> <em>NAME=VALUE</em>:</dt><dd>(starting with GDAL 2.0) Destination dataset open option (format specific), only valid in -update mode</dd>
<dt> <b>-gt</b> <em>n</em>:</dt><dd> group <em>n</em> features per transaction (default 20000 in OGR 1.11, 200 in previous releases). Increase the value
for better performance when writing into DBMS drivers that have transaction support. Starting with GDAL 2.0,
n can be set to unlimited to load the data into a single transaction.</dd>
<dt> <b>-ds_transaction</b>:</dt><dd>(starting with GDAL 2.0) Force the use of
a dataset level transaction (for drivers that support such mechanism),
especially for drivers such as FileGDB that only support dataset level transaction
in emulation mode.</dd>
<dt> <b>-clipsrc</b><em> [xmin ymin xmax ymax]|WKT|datasource|spat_extent</em>:
</dt><dd> (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 of the <b>-spat</b> option if you use the
<em>spat_extent</em> keyword. When specifying a datasource, you will generally
want to use it in combination of the <b>-clipsrclayer</b>,
<b>-clipsrcwhere</b> or <b>-clipsrcsql</b> options</dd>
<dt> <b>-clipsrcsql</b> <em>sql_statement</em>:</dt><dd>Select desired geometries using an SQL query instead.</dd>
<dt> <b>-clipsrclayer</b> <em>layername</em>:</dt><dd>Select the named layer from the source clip datasource.</dd>
<dt> <b>-clipsrcwhere</b> <em>expression</em>:</dt><dd>Restrict desired geometries based on attribute query.</dd>
<dt> <b>-clipdst</b><em> xmin ymin xmax ymax</em>:</dt><dd> (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 use it in combination of the -clipdstlayer, -clipdstwhere or -clipdstsql options</dd>
<dt> <b>-clipdstsql</b> <em>sql_statement</em>:</dt><dd>Select desired geometries using an SQL query instead.</dd>
<dt> <b>-clipdstlayer</b> <em>layername</em>:</dt><dd>Select the named layer from the destination clip datasource.</dd>
<dt> <b>-clipdstwhere</b> <em>expression</em>:</dt><dd>Restrict desired geometries based on attribute query.</dd>
<dt> <b>-wrapdateline</b>:</dt><dd> (starting with GDAL 1.7.0) split geometries crossing the dateline meridian (long. = +/- 180deg)</dd>
<dt> <b>-datelineoffset</b>:</dt><dd> (starting with GDAL 1.10) offset from dateline in degrees (default long. = +/- 10deg, geometries within 170deg to -170deg will be split)</dd>
<dt> <b>-simplify</b><em> tolerance</em>:</dt><dd> (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.</dd>
<dt> <b>-segmentize</b><em> max_dist</em>:</dt><dd> (starting with GDAL 1.6.0) maximum distance between 2 nodes.
Used to create intermediate points</dd>
<dt> <b>-fieldTypeToString</b><em> type1, ...</em>:</dt><dd> (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, Integer64, Real, String, Date, Time,
DateTime, Binary, IntegerList, Integer64List, RealList, StringList. Special value <b>All</b> can be used to convert all fields to strings.
This is an alternate way to using the CAST operator of OGR SQL, that may avoid typing a long SQL query.
Note that this does not influence the field types used by the source driver, and is only an afterwards conversion.</dd>
<dt> <b>-mapFieldType</b><em> srctype|All=dsttype, ...</em>:</dt><dd> (starting with GDAL 2.0) converts any field of the
specified type to another type. Valid types are : Integer, Integer64, Real, String, Date, Time,
DateTime, Binary, IntegerList, Integer64List, RealList, StringList. Types can also include subtype
between parenthesis, such as Integer(Boolean), Real(Float32), ...
Special value <b>All</b> can be used to convert all fields to another type.
This is an alternate way to using the CAST operator of OGR SQL, that may avoid typing a long SQL query. This is
a generalization of -fieldTypeToString.
Note that this does not influence the field types used by the source driver, and is only an afterwards conversion.</dd>
<dt> <b>-unsetFieldWidth</b>:</dt><dd> (starting with GDAL 1.11) set field width and precision to 0.</dd>
<dt> <b>-splitlistfields</b>:</dt><dd>(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.</dd>
<dt> <b>-maxsubfields</b> <em>val</em>:</dt><dd>To be combined with -splitlistfields to limit the number of subfields created for each split field.</dd>
<dt> <b>-explodecollections</b>:</dt><dd>(starting with GDAL 1.8.0) produce one feature for each geometry in any kind of geometry collection in the source file</dd>
<dt> <b>-zfield</b> <em>field_name</em>:</dt><dd>(starting with GDAL 1.8.0) Uses the specified field to fill the Z coordinate of geometries</dd>
<dt> <b>-gcp</b> <i>ungeoref_x ungeoref_y georef_x georef_y elevation</i>:</dt><dd>(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. 
</dd>
<dt> <b>-order</b> <em>n</em>:</dt><dd>(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.</dd>
<dt> <b>-tps</b>:</dt><dd>(starting with GDAL 1.10.0) Force use of thin plate spline transformer based on
available GCPs.</dd>
<dt> <b>-fieldmap</b>:</dt><dd>(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 the source layer must be copied. Index count starts at 
zero. There must be exactly as many values in the list as the count of the fields in the source layer. 
We can use the 'identity' setting to specify that the fields should be transferred by using the same order. 
This setting should be used along with the -append setting.</dd>
<dt> <b>-addfields</b>:</dt><dd>(starting with GDAL 1.11) 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 useful when merging files that have non-strictly
identical structures.
This might not work for output formats that don't support adding fields to existing non-empty layers.</dd>
<dt> <b>-relaxedFieldNameMatch</b>:</dt><dd>(starting with GDAL 1.11) Do field name matching between
source and existing target layer in a more relaxed way if the target driver has an implementation for it.</dd>
[-relaxedFieldNameMatch] [-forceNullable]
<dt> <b>-forceNullable</b>:</dt><dd>(starting with GDAL 2.0) Do not propagate not-nullable constraints
to target layer if they exist in source layer..</dd>
<dt> <b>-unsetDefault</b>:</dt><dd>(starting with GDAL 2.0) Do not propagate default field values
to target layer if they exist in source layer..</dd>
<dt> <b>-unsetFid</b>:</dt><dd>(starting with GDAL 2.0) Can be specify to prevent
the new default behaviour that consists in, if the output driver
has a FID layer creation option and we are not in append mode, to preserve the
name of the source FID column and source feature IDs</dd>
<dt> <b>-nomd</b>:</dt><dd>(starting with GDAL 2.0) To disable copying of metadata
from source dataset and layers into target dataset and layers, when supported by
output driver.</dd>
<dt> <b>-mo</b> <i>"META-TAG=VALUE"</i>:</dt><dd>(starting with GDAL 2.0)  Passes a metadata key and
value to set on the output dataset, when supported by output driver.</dd>
<dt> <b>-noNativeData</b>:</dt><dd>(starting with GDAL 2.1) To disable copying of
native data, i.e. details of source format not captured by OGR abstraction, that
are otherwise preserved by some drivers (like GeoJSON) when converting to same format.</dd>

</dl>

\section ogr2ogr_performance PERFORMANCE HINTS

When writing into transactional DBMS (SQLite/PostgreSQL,MySQL, etc...),
it might be beneficial to increase the number
of INSERT statements executed between BEGIN TRANSACTION and COMMIT TRANSACTION statements.
This number is specified with the -gt option. For example, for SQLite, explicitly defining
<b>-gt 65536</b> ensures optimal performance while
populating some table containing many hundredth thousand or million rows. However, note that
if there are failed insertions, the scope of -skipfailures is a whole transaction.

For PostgreSQL, the PG_USE_COPY config option can be set to YES for significantly insertion
performance boot. See the PG driver documentation page.

More generally, consult the documentation page of the input and output drivers for performance hints.

\section ogr2ogr_api C API

Starting with GDAL 2.1, this utility is also callable from C with GDALVectorTranslate().

\section ogr2ogr_example EXAMPLE

Example appending to an existing layer (both flags need to be used):

\verbatim
% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda abc.tab
\endverbatim

Example reprojecting from ETRS_1989_LAEA_52N_10E to EPSG:4326 and clipping to a bounding box

\verbatim
% ogr2ogr -wrapdateline -t_srs EPSG:4326 -clipdst -5 40 15 55 france_4326.shp europe_laea.shp
\endverbatim

Example for using the -fieldmap setting. The first field of the source layer is used to 
fill the third field (index 2 = third field) of the target layer, the second field of the 
source layer is ignored, the third field of the source layer used to fill the fifth field 
of the target layer.

\verbatim
% ogr2ogr -append -fieldmap 2,-1,4 dst.shp src.shp
\endverbatim

More examples are given in the individual format pages.

\if man
\section ogr2ogr_author AUTHOR
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de>
\endif
*/

/*! \page ogrtindex ogrtindex

creates a tileindex

\section ogrtindex_synopsis SYNOPSIS

\htmlonly
Usage:
\endhtmlonly

\verbatim
ogrtindex [-lnum n]... [-lname name]... [-f output_format]
          [-write_absolute_path] [-skip_different_projection]
                 output_dataset src_dataset...
\endverbatim

\section ogrtindex_description DESCRIPTION

The ogrtindex program can be used to create a tileindex - a file containing
a list of the identities of a bunch of other files along with there spatial
extents.  This is primarily intended to be used with  
<a href="http://mapserver.org/">MapServer</a> for tiled access
to layers using the OGR connection type. 

<dl>
<dt><b>-lnum</b> <em>n</em>:</dt><dd> Add layer number 'n' from each source
        file in the tile index.</dd>
<dt><b>-lname</b> <em>name</em>:</dt><dd> Add the layer named 'name' from each source file
        in the tile index.</dd>
<dt><b>-f</b> <em>output_format</em>:</dt><dd> Select an output format name.  The default
        is to create a shapefile.</dd>
<dt><b>-tileindex</b> <em>field_name</em>:</dt><dd> The name to use for the dataset name.
        Defaults to LOCATION.</dd>
<dt><b>-write_absolute_path</b>:</dt><dd> Filenames are written with absolute paths</dd>
<dt><b>-skip_different_projection</b>:</dt><dd> Only layers with same projection ref
        as layers already inserted in the tileindex will be inserted.</dd>
<dt><b>-accept_different_schemas</b>:</dt><dd> By default ogrtindex checks that all 
        layers inserted into the index have the same attribute schemas. If you specify
        this option, this test will be disabled. Be aware that resulting index may be 
        incompatible with MapServer!</dd>
</dl>

If no -lnum or -lname arguments are given it is assumed that
all layers in source datasets should be added to the tile index
as independent records.

If the tile index already exists it will be appended to, otherwise it will
be created.  

It is a flaw of the current ogrtindex program that no attempt is made to
copy the coordinate system definition from the source datasets to the tile
index (as is expected by MapServer when PROJECTION AUTO is in use).   

\section ogrtindex_example EXAMPLE

This example would create a shapefile (tindex.shp) containing a tile index
of the BL2000_LINK layers in all the NTF files in the wrk directory:
\verbatim
% ogrtindex tindex.shp wrk/*.NTF
\endverbatim

\if man
\section ogrtindex_author AUTHORS
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de>

\endif

*/

/*! \page ogrlineref ogrlineref

The utility can be used for:
- create linear reference file from input data
- return the "linear referenced" distance for the projection of the input coordinates (point) on the path
- return the coordinates (point) on the path according to the "linear referenced" distance 
- return the portion of the path according to the "linear referenced" begin and end distances

\section ogrlineref_synopsis SYNOPSIS

\htmlonly
Usage:
\endhtmlonly

\verbatim
ogrlineref [--help-general] [-progress] [-quiet]
           [-f format_name] [[-dsco NAME=VALUE] ...] [[-lco NAME=VALUE]...]
           [-create]
           [-l src_line_datasource_name] [-ln layer_name] [-lf field_name]
           [-p src_repers_datasource_name] [-pn layer_name] [-pm pos_field_name] [-pf field_name]
           [-r src_parts_datasource_name] [-rn layer_name]
           [-o dst_datasource_name] [-on layer_name]  [-of field_name] [-s step]
           [-get_pos] [-x long] [-y lat]
           [-get_coord] [-m position]
           [-get_subline] [-mb position] [-me position]
\endverbatim

\section ogrlineref_description DESCRIPTION

The ogrlineref program can be used to create a linear reference - a file containing
a segments of special length (e.g. 1 km in reference units) and get coordinates, 
linear referenced distances or sublines (subpaths) from this file. The utility not
required the M or Z values in geometry. The results can be stored in any OGR supported 
format. Also some information is written to the stdout.

<dl>
<dt><b>\-\-help-general</b>:</dt><dd> Show the usage.</dd>
<dt><b>-progress</b>:</dt><dd> Show progress.</dd>
<dt><b>-quiet</b>:</dt><dd> Suppress all messages except errors and results.</dd>
<dt><b>-f</b> <em>format_name</em>:</dt><dd> Select an output format name.
    The default is to create a shapefile.</dd>
<dt> <b>-dsco</b> <em>NAME=VALUE</em>:</dt><dd> Dataset creation option 
    (format specific)</dd>
<dt> <b>-lco</b><em>  NAME=VALUE</em>:</dt><dd> Layer creation option 
    (format specific)</dd>
<dt><b>-create</b>:</dt><dd> Create the linear reference file (linestring of parts).</dd>
<dt> <b>-l</b><em>src_line_datasource_name</em>:</dt><dd> The path to input linestring 
    datasource (e.g. the road)</dd>
<dt> <b>-ln</b><em>layer_name</em>:</dt><dd> The layer name in datasource</dd>
<dt> <b>-lf</b><em>field_name</em>:</dt><dd> The field name of unique values to 
    separate the input lines (e.g. the set of roads)</dd>
<dt> <b>-p</b><em>src_repers_datasource_name</em>:</dt><dd> The path to linear 
    references points (e.g. the road mile-stones)</dd>
<dt> <b>-pn</b><em>layer_name</em>:</dt><dd> The layer name in datasource</dd>
<dt> <b>-pm</b><em>pos_field_name</em>:</dt><dd> The field name of distances 
    along path (e.g. mile-stones values)</dd>
<dt> <b>-pf</b><em>field_name</em>:</dt><dd> The field name of unique values to 
    map input reference points to lines</dd>
<dt> <b>-r</b><em>src_parts_datasource_name</em>:</dt><dd> The path to linear 
    reference file</dd>
<dt> <b>-rn</b><em>layer_name</em>:</dt><dd> The layer name in datasource</dd>
<dt> <b>-o</b><em>dst_datasource_name</em>:</dt><dd> The path to output linear 
    reference file (linestring datasource)</dd>
<dt> <b>-on</b><em>layer_name</em>:</dt><dd> The layer name in datasource</dd>
<dt> <b>-of</b><em>field_name</em>:</dt><dd> The field name for storing the 
    unique values of input lines</dd>
<dt> <b>-s</b><em>step</em>:</dt><dd> The part size in linear units</dd>
<dt> <b>-get_pos</b>:</dt><dd> Return linear referenced position for input X, Y</dd>
<dt> <b>-x</b><em>long</em>:</dt><dd> Input X coordinate</dd>
<dt> <b>-y</b><em>lat</em>:</dt><dd> Input Y coordinate</dd>
<dt> <b>-get_coord</b>:</dt><dd> Return point on path for input linear distance</dd>
<dt> <b>-m</b><em>position</em>:</dt><dd> The input linear distance</dd>
<dt> <b>-get_subline</b>:</dt><dd> Return the portion of the input path from and to 
    input linear positions</dd>
<dt> <b>-mb</b><em>position</em>:</dt><dd> The input begin linear distance</dd>
<dt> <b>-me</b><em>position</em>:</dt><dd> The input end linear distance</dd>
</dl>

\section ogrlineref_example EXAMPLE

This example would create a shapefile (parts.shp) containing a data needed
for linear referencing (1 km parts):
\verbatim
% ogrlineref -create -l roads.shp -p references.shp -pm dist -o parts.shp -s 1000 -progress
\endverbatim

\if man
\section ogrlineref_author AUTHORS
Dmitry Baryshnikov <polimax@mail.ru>

\endif

*/
