.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "OGR2OGR" "1" "Feb 08, 2024" "" "GDAL" .SH NAME ogr2ogr \- Converts simple features data between file formats. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr [\-\-help] [\-\-help\-general] [\-skipfailures] [\-append | \-upsert] [\-update] [\-select ] [\-where |@] [\-progress] [\-sql |@] [\-dialect ] [\-preserve_fid] [\-fid ] [\-limit ] [\-spat ] [\-spat_srs ] [\-geomfield ] [\-a_srs ] [\-t_srs ] [\-s_srs ] [\-ct ] [\-if ] [\-f ] [\-overwrite] [\-dsco =]... [\-lco =]... [\-nln ] [\-nlt |PROMOTE_TO_MULTI|CONVERT_TO_LINEAR|CONVERT_TO_CURVE] [\-dim XY|XYZ|XYM|XYZM|] [ [...]] # Advanced options [\-gt n] [\-ds_transaction] [\-oo =]... [\-doo =]... [\-clipsrc {[ ]|||spat_extent}] [\-clipsrcsql ] [\-clipsrclayer ] [\-clipsrcwhere ] [\-clipdst {[ ]||}] [\-clipdstsql ] [\-clipdstlayer ] [\-clipdstwhere ] [\-wrapdateline][\-datelineoffset ] [[\-simplify ] | [\-segmentize ]] [\-makevalid] [\-addfields] [\-unsetFid] [\-emptyStrAsNull] [\-relaxedFieldNameMatch] [\-forceNullable] [\-unsetDefault] [\-fieldTypeToString {All|{[,]}...}] [\-unsetFieldWidth] [\-mapFieldType {|All=[,=]...}] [\-dateTimeTo {UTC|UTC(+|\-)|UTC(+|\-):}] [\-fieldmap {identity|{[,]...}] [\-splitlistfields] [\-maxsubfields ] [\-resolveDomains] [\-explodecollections] [\-zfield ] [\-gcp []]... [\-order | \-tps] [\-s_coord_epoch ] [\-t_coord_epoch ] [\-a_coord_epoch ] [\-nomd] [\-mo =]... [\-noNativeData] .ft P .fi .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fBogr2ogr\fP can be used to convert simple features data between file formats. It can also perform various operations during the process, such as spatial or attribute selection, reducing the set of attributes, setting the output coordinate system or even reprojecting the features during translation. .INDENT 0.0 .TP .B \-\-help Show this help message and exit .UNINDENT .INDENT 0.0 .TP .B \-\-help\-general Gives a brief usage message for the generic GDAL commandline options and exit. .UNINDENT .INDENT 0.0 .TP .B \-if Format/driver name to be attempted to open the input file(s). It is generally not necessary to specify it, but it can be used to skip automatic driver detection, when it fails to select the appropriate driver. This option can be repeated several times to specify several candidate drivers. Note that it does not force those drivers to open the dataset. In particular, some drivers have requirements on file extensions. .sp New in version 3.2. .UNINDENT .INDENT 0.0 .TP .B \-f Output file format name, e.g. \fBESRI Shapefile\fP, \fBMapInfo File\fP, \fBPostgreSQL\fP\&. Starting with GDAL 2.3, if not specified, the format is guessed from the extension (previously was ESRI Shapefile). .UNINDENT .INDENT 0.0 .TP .B \-append Append to existing layer instead of creating new. This option also enables \fI\%\-update\fP\&. .UNINDENT .INDENT 0.0 .TP .B \-upsert New in version 3.6. .sp Variant of \fI\%\-append\fP where the \fI\%OGRLayer::UpsertFeature()\fP operation is used to insert or update features instead of appending with \fI\%OGRLayer::CreateFeature()\fP\&. .sp This is currently implemented only in a few drivers: \fI\%GPKG \-\- GeoPackage vector\fP and \fI\%MongoDBv3\fP\&. .sp The upsert operation uses the FID of the input feature, when it is set and is a \(dqsignificant\(dq (that is the FID column name is not the empty string), as the key to update existing features. It is crucial to make sure that the FID in the source and target layers are consistent. .sp For the GPKG driver, it is also possible to upsert features whose FID is unset or non\-significant (\fI\%\-unsetFid\fP can be used to ignore the FID from the source feature), when there is a UNIQUE column that is not the integer primary key. .UNINDENT .INDENT 0.0 .TP .B \-overwrite Delete the output layer and recreate it empty .UNINDENT .INDENT 0.0 .TP .B \-update Open existing output datasource in update mode rather than trying to create a new one .UNINDENT .INDENT 0.0 .TP .B \-select 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 \fBall\fP; any field is skipped if a subsequent field with same name is found.) Geometry fields can also be specified in the list. .sp Note this setting cannot be used together with \fB\-append\fP\&. To control the selection of fields when appending to a layer, use \fB\-fieldmap\fP or \fB\-sql\fP\&. .UNINDENT .INDENT 0.0 .TP .B \-progress Display progress on terminal. Only works if input layers have the \(dqfast feature count\(dq capability. .UNINDENT .INDENT 0.0 .TP .B \-sql SQL statement to execute. The resulting table/layer will be saved to the output. Starting with GDAL 2.1, the \fB@filename\fP syntax can be used to indicate that the content is in the pointed filename. .UNINDENT .INDENT 0.0 .TP .B \-dialect SQL dialect. In some cases can be used to use (unoptimized) \fI\%OGR SQL dialect\fP instead of the native SQL of an RDBMS by passing the \fBOGRSQL\fP dialect value. The \fI\%SQL SQLite dialect\fP dialect can be select with the \fBSQLITE\fP and \fBINDIRECT_SQLITE\fP dialect values, and this can be used with any datasource. .UNINDENT .INDENT 0.0 .TP .B \-where Attribute query (like SQL WHERE). Starting with GDAL 2.1, the \fB@filename\fP syntax can be used to indicate that the content is in the pointed filename. .UNINDENT .INDENT 0.0 .TP .B \-skipfailures Continue after a failure, skipping the failed feature. .UNINDENT .INDENT 0.0 .TP .B \-spat spatial query extents, in the SRS of the source layer(s) (or the one specified with \fB\-spat_srs\fP). Only features whose geometry intersects the extents will be selected. The geometries will not be clipped unless \fB\-clipsrc\fP is specified. .UNINDENT .INDENT 0.0 .TP .B \-spat_srs Override spatial filter SRS. .UNINDENT .INDENT 0.0 .TP .B \-geomfield Name of the geometry field on which the spatial filter operates on. .UNINDENT .INDENT 0.0 .TP .B \-dsco = Dataset creation option (format specific) .UNINDENT .INDENT 0.0 .TP .B \-lco = Layer creation option (format specific) .UNINDENT .INDENT 0.0 .TP .B \-nln Assign an alternate name to the new layer .UNINDENT .INDENT 0.0 .TP .B \-nlt Define the geometry type for the created layer. One of \fBNONE\fP, \fBGEOMETRY\fP, \fBPOINT\fP, \fBLINESTRING\fP, \fBPOLYGON\fP, \fBGEOMETRYCOLLECTION\fP, \fBMULTIPOINT\fP, \fBMULTIPOLYGON\fP, \fBMULTILINESTRING\fP, \fBCIRCULARSTRING\fP, \fBCOMPOUNDCURVE\fP, \fBCURVEPOLYGON\fP, \fBMULTICURVE\fP, and \fBMULTISURFACE\fP non\-linear geometry types. Add \fBZ\fP, \fBM\fP, or \fBZM\fP to the type name to specify coordinates with elevation, measure, or elevation and measure. \fBPROMOTE_TO_MULTI\fP 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. \fBCONVERT_TO_LINEAR\fP can be used to to convert non\-linear geometry types into linear geometry types by approximating them, and \fBCONVERT_TO_CURVE\fP to promote a non\-linear type to its generalized curve type (\fBPOLYGON\fP to \fBCURVEPOLYGON\fP, \fBMULTIPOLYGON\fP to \fBMULTISURFACE\fP, \fBLINESTRING\fP to \fBCOMPOUNDCURVE\fP, \fBMULTILINESTRING\fP to \fBMULTICURVE\fP). Starting with version 2.1 the type can be defined as measured (\(dq25D\(dq remains as an alias for single \(dqZ\(dq). Some forced geometry conversions may result in invalid geometries, for example when forcing conversion of multi\-part multipolygons with \fB\-nlt POLYGON\fP, the resulting polygon will break the Simple Features rules. .sp Starting with GDAL 3.0.5, \fB\-nlt CONVERT_TO_LINEAR\fP and \fB\-nlt PROMOTE_TO_MULTI\fP can be used simultaneously. .UNINDENT .INDENT 0.0 .TP .B \-dim Force the coordinate dimension to val (valid values are \fBXY\fP, \fBXYZ\fP, \fBXYM\fP, and \fBXYZM\fP \- for backwards compatibility \fB2\fP is an alias for \fBXY\fP and \fB3\fP is an alias for \fBXYZ\fP). This affects both the layer geometry type, and feature geometries. The value can be set to \fBlayer_dim\fP to instruct feature geometries to be promoted to the coordinate dimension declared by the layer. Support for M was added in GDAL 2.1. .UNINDENT .INDENT 0.0 .TP .B \-a_srs Assign an output SRS, but without reprojecting (use \fI\%\-t_srs\fP to reproject) .sp The coordinate reference systems that can be passed are anything supported by the \fI\%OGRSpatialReference::SetFromUserInput()\fP call, which includes EPSG Projected, Geographic or Compound CRS (i.e. EPSG:4296), a well known text (WKT) CRS definition, PROJ.4 declarations, or the name of a .prj file containing a WKT CRS definition. .UNINDENT .INDENT 0.0 .TP .B \-a_coord_epoch New in version 3.4. .sp Assign a coordinate epoch, linked with the output SRS. Useful when the output SRS is a dynamic CRS. Only taken into account if \fI\%\-a_srs\fP is used. .UNINDENT .INDENT 0.0 .TP .B \-t_srs Reproject/transform to this SRS on output, and assign it as output SRS. .sp A source SRS must be available for reprojection to occur. The source SRS will be by default the one found in the source layer when it is available, or as overridden by the user with \fI\%\-s_srs\fP .sp The coordinate reference systems that can be passed are anything supported by the \fI\%OGRSpatialReference::SetFromUserInput()\fP call, which includes EPSG Projected, Geographic or Compound CRS (i.e. EPSG:4296), a well known text (WKT) CRS definition, PROJ.4 declarations, or the name of a .prj file containing a WKT CRS definition. .UNINDENT .INDENT 0.0 .TP .B \-t_coord_epoch New in version 3.4. .sp Assign a coordinate epoch, linked with the output SRS. Useful when the output SRS is a dynamic CRS. Only taken into account if \fI\%\-t_srs\fP is used. It is also mutually exclusive with \fI\%\-a_coord_epoch\fP\&. .sp Before PROJ 9.4, \fI\%\-s_coord_epoch\fP and \fI\%\-t_coord_epoch\fP are mutually exclusive, due to lack of support for transformations between two dynamic CRS. .UNINDENT .INDENT 0.0 .TP .B \-s_srs Override source SRS. If not specified the SRS found in the input layer will be used. This option has only an effect if used together with \fI\%\-t_srs\fP to reproject. .sp The coordinate reference systems that can be passed are anything supported by the \fI\%OGRSpatialReference::SetFromUserInput()\fP call, which includes EPSG Projected, Geographic or Compound CRS (i.e. EPSG:4296), a well known text (WKT) CRS definition, PROJ.4 declarations, or the name of a .prj file containing a WKT CRS definition. .UNINDENT .INDENT 0.0 .TP .B \-s_coord_epoch New in version 3.4. .sp Assign a coordinate epoch, linked with the source SRS. Useful when the source SRS is a dynamic CRS. Only taken into account if \fI\%\-s_srs\fP is used. .sp Before PROJ 9.4, \fI\%\-s_coord_epoch\fP and \fI\%\-t_coord_epoch\fP are mutually exclusive, due to lack of support for transformations between two dynamic CRS. .UNINDENT .INDENT 0.0 .TP .B \-ct A PROJ string (single step operation or multiple step string starting with +proj=pipeline), a WKT2 string describing a CoordinateOperation, or a \fI\%urn:ogc:def:coordinateOperation:EPSG::XXXX\fP URN overriding the default transformation from the source to the target CRS. It must take into account the axis order of the source and target CRS. .sp New in version 3.0. .UNINDENT .INDENT 0.0 .TP .B \-preserve_fid Use the FID of the source features instead of letting the output driver automatically assign a new one (for formats that require a FID). If not in append mode, this behavior is 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 behavior can be disabled by setting \fB\-unsetFid\fP\&. This option is not compatible with \fB\-explodecollections\fP\&. .UNINDENT .INDENT 0.0 .TP .B \-fid If provided, only the feature with the specified feature id will be processed. 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 \(aqfid\(aq is a special field recognized by OGR SQL. So, \fI\-where \(dqfid in (1,3,5)\(dq\fP would select features 1, 3 and 5. .UNINDENT .INDENT 0.0 .TP .B \-limit Limit the number of features per layer. .UNINDENT .INDENT 0.0 .TP .B \-oo = Input dataset open option (format specific). .UNINDENT .INDENT 0.0 .TP .B \-doo = Destination dataset open option (format specific), only valid in \-update mode. .UNINDENT .INDENT 0.0 .TP .B \-gt Group n features per transaction (default 100 000). Increase the value for better performance when writing into DBMS drivers that have transaction support. \fBn\fP can be set to unlimited to load the data into a single transaction. .UNINDENT .INDENT 0.0 .TP .B \-ds_transaction 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. .UNINDENT .INDENT 0.0 .TP .B \-clipsrc [ ]|WKT||spat_extent Clip geometries to one of the following: .INDENT 7.0 .IP \(bu 2 the specified bounding box (expressed in source SRS) .IP \(bu 2 a WKT geometry (POLYGON or MULTIPOLYGON expressed in source SRS) .IP \(bu 2 one or more geometries selected from a datasource .IP \(bu 2 the spatial extent of the \-spat option if you use the spat_extent keyword. .UNINDENT .sp When specifying a datasource, you will generally want to use \-clipsrc in combination of the \-clipsrclayer, \-clipsrcwhere or \-clipsrcsql options. .UNINDENT .INDENT 0.0 .TP .B \-clipsrcsql Select desired geometries from the source clip datasource using an SQL query. .UNINDENT .INDENT 0.0 .TP .B \-clipsrclayer Select the named layer from the source clip datasource. .UNINDENT .INDENT 0.0 .TP .B \-clipsrcwhere Restrict desired geometries from the source clip layer based on an attribute query. .UNINDENT .INDENT 0.0 .TP .B \-clipdst [ ]|| Clip geometries to one of the following: .INDENT 7.0 .IP \(bu 2 the specified bounding box (expressed in destination SRS) .IP \(bu 2 a WKT geometry (POLYGON or MULTIPOLYGON expressed in destination SRS) .IP \(bu 2 one or more geometries selected from a datasource .UNINDENT .sp When specifying a datasource, you will generally want to use \-clipdst in combination with the \-clipdstlayer, \-clipdstwhere or \-clipdstsql options. .UNINDENT .INDENT 0.0 .TP .B \-clipdstsql Select desired geometries from the destination clip datasource using an SQL query. .UNINDENT .INDENT 0.0 .TP .B \-clipdstlayer Select the named layer from the destination clip datasource. .UNINDENT .INDENT 0.0 .TP .B \-clipdstwhere Restrict desired geometries from the destination clip layer based on an attribute query. .UNINDENT .INDENT 0.0 .TP .B \-wrapdateline Split geometries crossing the dateline meridian (long. = +/\- 180deg) .UNINDENT .INDENT 0.0 .TP .B \-datelineoffset Offset from dateline in degrees (default long. = +/\- 10deg, geometries within 170deg to \-170deg will be split) .UNINDENT .INDENT 0.0 .TP .B \-simplify Distance tolerance for simplification. Note: the algorithm used preserves topology per feature, in particular for polygon geometries, but not for a whole layer. .UNINDENT .INDENT 0.0 .TP .B \-segmentize Maximum distance between 2 nodes. Used to create intermediate points. .UNINDENT .INDENT 0.0 .TP .B \-makevalid Run the \fI\%OGRGeometry::MakeValid()\fP operation, followed by \fI\%OGRGeometryFactory::removeLowerDimensionSubGeoms()\fP, on geometries to ensure they are valid regarding the rules of the Simple Features specification. .UNINDENT .INDENT 0.0 .TP .B \-fieldTypeToString All|[,]... Converts any field of the specified type to a field of type string in the destination layer. Valid types are : \fBInteger\fP, \fBInteger64\fP, \fBReal\fP, \fBString\fP, \fBDate\fP, \fBTime\fP, \fBDateTime\fP, \fBBinary\fP, \fBIntegerList\fP, \fBInteger64List\fP, \fBRealList\fP, \fBStringList\fP\&. Special value \fBAll\fP 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. Also note that this option is without effects on fields whose presence and type is hard\-coded in the output driver (e.g KML, GPX) .UNINDENT .INDENT 0.0 .TP .B \-mapFieldType {|All=[,=]...} Converts any field of the specified type to another type. Valid types are : \fBInteger\fP, \fBInteger64\fP, \fBReal\fP, \fBString\fP, \fBDate\fP, \fBTime\fP, \fBDateTime\fP, \fBBinary\fP, \fBIntegerList\fP, \fBInteger64List\fP, \fBRealList\fP, \fBStringList\fP\&. Types can also include subtype between parenthesis, such as \fBInteger(Boolean)\fP, \fBReal(Float32)\fP, ... Special value \fBAll\fP 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. Also note that this option is without effects on fields whose presence and type is hard\-coded in the output driver (e.g KML, GPX) .UNINDENT .INDENT 0.0 .TP .B \-dateTimeTo {UTC|UTC(+|\-)|UTC(+|\-):} Converts date time values from the timezone specified in the source value to the target timezone expressed with \fI\%\-dateTimeTo\fP\&. Datetime whose timezone is unknown or localtime are not modified. .sp HH must be in the [0,14] range and MM=00, 15, 30 or 45. .UNINDENT .INDENT 0.0 .TP .B \-unsetFieldWidth Set field width and precision to 0. .UNINDENT .INDENT 0.0 .TP .B \-splitlistfields Split fields of type StringList, RealList or IntegerList into as many fields of type String, Real or Integer as necessary. .UNINDENT .INDENT 0.0 .TP .B \-maxsubfields To be combined with \fB\-splitlistfields\fP to limit the number of subfields created for each split field. .UNINDENT .INDENT 0.0 .TP .B \-explodecollections Produce one feature for each geometry in any kind of geometry collection in the source file, applied after any \fB\-sql\fP option. This options is not compatible with \fB\-preserve_fid\fP but \fB\-sql \(dqSELECT fid AS original_fid, * FROM ...\(dq\fP can be used to store the original FID if needed. .UNINDENT .INDENT 0.0 .TP .B \-zfield Uses the specified field to fill the Z coordinate of geometries. .UNINDENT .INDENT 0.0 .TP .B \-gcp [] Add the indicated ground control point. This option may be provided multiple times to provide a set of GCPs. .UNINDENT .INDENT 0.0 .TP .B \-order Order of polynomial used for warping (1 to 3). The default is to select a polynomial order based on the number of GCPs. .UNINDENT .INDENT 0.0 .TP .B \-tps Force use of thin plate spline transformer based on available GCPs. .UNINDENT .INDENT 0.0 .TP .B \-fieldmap 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. To omit a field, specify a value of \-1. There must be exactly as many values in the list as the count of the fields in the source layer. We can use the \(aqidentity\(aq setting to specify that the fields should be transferred by using the same order. This setting should be used along with the \fB\-append\fP setting. .UNINDENT .INDENT 0.0 .TP .B \-addfields This is a specialized version of \fB\-append\fP\&. Contrary to \fB\-append\fP, \fB\-addfields\fP 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\(aqt support adding fields to existing non\-empty layers. Note that if you plan to use \-addfields, you may need to combine it with \-forceNullable, including for the initial import. .UNINDENT .INDENT 0.0 .TP .B \-relaxedFieldNameMatch Do field name matching between source and existing target layer in a more relaxed way if the target driver has an implementation for it. .UNINDENT .INDENT 0.0 .TP .B \-forceNullable Do not propagate not\-nullable constraints to target layer if they exist in source layer. .UNINDENT .INDENT 0.0 .TP .B \-unsetDefault Do not propagate default field values to target layer if they exist in source layer. .UNINDENT .INDENT 0.0 .TP .B \-unsetFid Can be specified to prevent the name of the source FID column and source feature IDs from being re\-used for the target layer. This option can for example be useful if selecting source features with a ORDER BY clause. .UNINDENT .INDENT 0.0 .TP .B \-emptyStrAsNull New in version 3.3. .sp Treat empty string values as null. .UNINDENT .INDENT 0.0 .TP .B \-resolveDomains New in version 3.3. .sp When this is specified, any selected field that is linked to a coded field domain will be accompanied by an additional field (\fB{dstfield}_resolved\fP), that will contain the description of the coded value. .UNINDENT .INDENT 0.0 .TP .B \-nomd To disable copying of metadata from source dataset and layers into target dataset and layers, when supported by output driver. .UNINDENT .INDENT 0.0 .TP .B \-mo = Passes a metadata key and value to set on the output dataset, when supported by output driver. .UNINDENT .INDENT 0.0 .TP .B \-noNativeData 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. .sp New in version 2.1. .UNINDENT .SH PERFORMANCE HINTS .sp 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 \-gt 65536 ensures optimal performance while populating some table containing many hundreds of thousands or millions of rows. However, note that \-skipfailures overrides \-gt and sets the size of transactions to 1. .sp For PostgreSQL, the \fI\%PG_USE_COPY\fP config option can be set to YES for a significant insertion performance boost. See the PG driver documentation page. .sp More generally, consult the documentation page of the input and output drivers for performance hints. .SH C API .sp This utility is also callable from C with \fI\%GDALVectorTranslate()\fP\&. .SH EXAMPLES .sp Basic conversion from Shapefile to GeoPackage: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr output.gpkg input.shp .ft P .fi .UNINDENT .UNINDENT .sp Change the coordinate reference system from \fBEPSG:4326\fP to \fBEPSG:3857\fP: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr \-s_srs EPSG:4326 \-t_srs EPSG:3857 output.gpkg input.gpkg .ft P .fi .UNINDENT .UNINDENT .sp Example appending to an existing layer: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr \-append \-f PostgreSQL PG:dbname=warmerda abc.tab .ft P .fi .UNINDENT .UNINDENT .sp Clip input layer with a bounding box ( ): .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr \-spat \-13.931 34.886 46.23 74.12 output.gpkg natural_earth_vector.gpkg .ft P .fi .UNINDENT .UNINDENT .sp Filter Features by a \fB\-where\fP clause: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr \-where \(dq\e\(dqPOP_EST\e\(dq < 1000000\(dq \e output.gpkg natural_earth_vector.gpkg ne_10m_admin_0_countries .ft P .fi .UNINDENT .UNINDENT .sp Example reprojecting from ETRS_1989_LAEA_52N_10E to EPSG:4326 and clipping to a bounding box: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr \-wrapdateline \-t_srs EPSG:4326 \-clipdst \-5 40 15 55 france_4326.shp europe_laea.shp .ft P .fi .UNINDENT .UNINDENT .sp Example for using the \fB\-fieldmap\fP 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. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ogr2ogr \-append \-fieldmap 2,\-1,4 dst.shp src.shp .ft P .fi .UNINDENT .UNINDENT .sp More examples are given in the individual format pages. .SH AUTHOR Frank Warmerdam , Silke Reimer .SH COPYRIGHT 1998-2024 .\" Generated by docutils manpage writer. .