/*! \page ogr_utilities OGR Utility Programs
The following utilities are distributed as part of the OGR Simple Features
toolkit:
- \ref ogrinfo - Lists information about an OGR supported data source
- \ref ogr2ogr - Converts simple features data between file formats
- \ref ogrtindex - Creates a tileindex
*/
/*! \page ogrinfo ogrinfo
lists information about an OGR supported data source
\if man
\section synopsis SYNOPSIS
\endif
\htmlonly
Usage:
\endhtmlonly
\verbatim
ogrinfo [--help-general] [-ro] [-q] [-where restricted_where]
[-spat xmin ymin xmax ymax] [-fid fid]
[-sql statement] [-al] [-so] [-fields={YES/NO}]
[-geom={YES/NO/SUMMARY}][--formats]
datasource_name [layer [layer ...]]
\endverbatim
\if man
\section description DESCRIPTION
\endif
The ogrinfo program lists various information about an OGR supported data
source to stdout (the terminal).
- -ro:
- Open the data source in read-only mode.
- -al:
- List all features of all layers (used instead of having to
give layer names as arguments).
- -so:
- Summary Only: supress listing of features, show only the
summary information like projection, schema, feature count and
extents.
- -q:
- Quiet verbose reporting of various information, including
coordinate system, layer schema, extents, and feature count.
- -where restricted_where:
- 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.
- -sql statement:
- Execute the indicated SQL statement
and return the result.
- -spat xmin ymin xmax ymax:
- The area of interest. Only
features within the rectangle will be reported.
- -fid fid:
- 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.
- -fields={YES/NO}:
- (starting with GDAL 1.6.0) If set to NO,
the feature dump will not display field values. Default value is YES.
- -geom={YES/NO/SUMMARY}:
- (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, the geometry will be reported in full OGC WKT format.
Default value is YES.
- --formats:
- List the format drivers that are
enabled.
- datasource_name:
- The data source to open. May be a filename,
directory or other virtual name. See the OGR Vector
Formats list for supported datasources.
- layer:
- One or more layer names may be reported.
If no layer names are passed then ogrinfo will report a list of available
layers (and their layerwide 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.
\if man
\section example EXAMPLE
\endif
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 author AUTHORS
Frank Warmerdam , Silke Reimer
\endif
*/
/*! \page ogr2ogr ogr2ogr
converts simple features data between file formats
\if man
\section synopsis SYNOPSIS
\endif
\htmlonly
Usage:
\endhtmlonly
\verbatim
Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update] [-gt n]
[-select field_list] [-where restricted_where]
[-progress] [-sql ] [-dialect dialect]
[-preserve_fid] [-fid FID]
[-spat xmin ymin xmax ymax] [-wrapdateline]
[-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]
[-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
[-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
[-segmentize max_dist] [-fieldTypeToString All|(type1[,type2]*)]
dst_datasource_name src_datasource_name
[-lco NAME=VALUE] [-nln name] [-nlt type] [layer [layer ...]]
\endverbatim
\if man
\section description DESCRIPTION
\endif
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.
- -f format_name:
- 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
- -append:
- Append to existing layer instead of creating
new
- -overwrite:
- Delete the output layer and recreate it empty
- -update:
- Open existing output datasource in update mode rather than trying to create a new one
- -select field_list:
- 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.)
- -progress:
- (starting with GDAL 1.7.0) Display progress on terminal. Only works if input layers have the "fast feature count" capability.
- -sql sql_statement:
- SQL statement to execute.
The resulting table/layer will be saved to the output.
- -dialect dialect:
- SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL.
- -wrapdateline:
- (starting with GDAL 1.7.0) split geometries crossing the dateline meridian (long. = +/- 180deg)
- -where restricted_where:
- Attribute query (like SQL WHERE)
- -skipfailures:
- Continue after a failure, skipping the failed feature.
- -gt n:
- group n features per transaction (default 200)
- -spat 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
- -clipsrc [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 of the -spat option if you use the
spat_extent keyword. When specifying a datasource, you will generally
want to use it in combination of the -clipsrclayer,
-clipsrcwhere or -clipsrcsql options
- -clipsrcsql sql_statement:
- Select desired geometries using an SQL query instead.
- -clipsrclayer layername:
- Select the named layer from the source clip datasource.
- -clipsrcwhere expression:
- Restrict desired geometries based on attribute query.
- -clipdst xmin ymin xmax ymax:
- (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
- -clipdstsql sql_statement:
- Select desired geometries using an SQL query instead.
- -clipdstlayer layername:
- Select the named layer from the destination clip datasource.
- -clipdstwhere expression:
- Restrict desired geometries based on attribute query.
- -dsco NAME=VALUE:
- Dataset creation option (format specific)
- -lco NAME=VALUE:
- Layer creation option (format specific)
- -nln name:
- Assign an alternate name to the new layer
- -nlt type:
- 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.
- -a_srs srs_def:
- Assign an output SRS
- -t_srs srs_def:
- Reproject/transform to this SRS on output
- -s_srs srs_def:
- Override source SRS
- -fid fid:
- 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.
- -segmentize max_dist:
- (starting with GDAL 1.6.0) maximum distance between 2 nodes.
Used to create intermediate pointsspatial query extents
- -fieldTypeToString type1, ...:
- (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 value All 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.
Srs_def can be a full WKT definition (hard to escape properly), or a well
known definition (ie. EPSG:4326) or a file with a WKT definition.
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
More examples are given in the individual format pages.
\if man
\section author AUTHOR
Frank Warmerdam , Silke Reimer
\endif
*/
/*! \page ogrtindex ogrtindex
creates a tileindex
\if man
\section synopsis SYNOPSIS
\endif
\htmlonly
Usage:
\endhtmlonly
\verbatim
ogrtindex [-lnum n]... [-lname name]... [-f output_format]
[-write_absolute_path] [-skip_different_projection]
output_dataset src_dataset...
\endverbatim
\if man
\section description DESCRIPTION
\endif
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
MapServer for tiled access
to layers using the OGR connection type.
- -lnum n:
- Add layer number 'n' from each source
file in the tile index.
- -lname name:
- Add the layer named 'name' from each source file
in the tile index.
- -f output_format:
- Select an output format name. The default
is to create a shapefile.
- -tileindex field_name:
- The name to use for the dataset name.
Defaults to LOCATION.
- -write_absolute_path:
- Filenames are written with absolute paths
- -skip_different_projection:
- Only layers with same projection ref
as layers already inserted in the tileindex will be inserted.
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).
\if man
\section example EXAMPLE
\endif
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 author AUTHORS
Frank Warmerdam , Silke Reimer
\endif
*/