NAMEogr2ogr - ogr2ogr converts simple features data between file formats
SYNOPSISUsage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update] [-gt n] [-select field_list] [-where restricted_where] [-progress] [-sql <sql statement>] [-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 ...]]
DESCRIPTIONThis 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: -f "ESRI Shapefile" -f "TIGER" -f "MapInfo File" -f "GML" -f "PostgreSQL" -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): % ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda abc.tab Example reprojecting from ETRS_1989_LAEA_52N_10E to EPSG:4326 and clipping to a bounding box % ogr2ogr -wrapdateline -t_srs EPSG:4326 -clipdst -5 40 15 55 france_4326.shp europe_laea.shp More examples are given in the individual format pages.
AUTHORSFrank Warmerdam <firstname.lastname@example.org>, Silke Reimer <email@example.com> OGR2OGR(1)