.\" 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 "OGRINFO" "1" "Apr 01, 2025" "" "GDAL"
.SH NAME
ogrinfo \- Lists information about an OGR-supported data source.
.SH SYNOPSIS
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo [\-\-help] [\-\-help\-general]
        [\-if <driver_name>] [\-json] [\-ro] [\-q] [\-where <restricted_where>|@<filename>]
        [\-spat <xmin> <ymin> <xmax> <ymax>] [\-geomfield <field>] [\-fid <fid>]
        [\-sql <statement>|@<filename>] [\-dialect <sql_dialect>] [\-al] [\-rl]
        [\-so|\-features] [\-limit <nb_features>] [\-fields={YES|NO}]]
        [\-geom={YES|NO|SUMMARY|WKT|ISO_WKT}] [\-oo <NAME>=<VALUE>]...
        [\-nomd] [\-listmdd] [\-mdd <domain>|all]...
        [\-nocount] [\-nogeomtype] [[\-noextent] | [\-extent3D]]
        [\-wkt_format WKT1|WKT2|<other_values>]
        [\-fielddomain <name>]
        <datasource_name> [<layer> [<layer> ...]]
.ft P
.fi
.UNINDENT
.UNINDENT
.SH DESCRIPTION
.sp
The \fBogrinfo\fP program lists various information about an OGR\-supported data
source to stdout (the terminal). By executing SQL statements it is also possible to
edit data.
.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>
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 \-json
Display the output in json format, conforming to the
\fI\%ogrinfo_output.schema.json\fP
schema.
.sp
New in version 3.7.

.UNINDENT
.INDENT 0.0
.TP
.B \-ro
Open the data source in read\-only mode.
.UNINDENT
.INDENT 0.0
.TP
.B \-al
List all layers (used instead of having to give layer names
as arguments).
In the default text output, this also enables listing
all features, which can be disabled with \fI\%\-so\fP\&.
In JSON output, \-al is implicit, but listing of features must be
explicitly enabled with \fI\%\-features\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-rl
Enable random layer reading mode, i.e. iterate over features in the order
they are found in the dataset, and not layer per layer. This can be
significantly faster for some formats (for example OSM, GMLAS).
\-rl cannot be used with \-sql.
.sp
New in version 2.2.

.UNINDENT
.INDENT 0.0
.TP
.B \-so
Summary Only: suppress listing of individual features and show only
summary information like projection, schema, feature count and extents.
In JSON output, \-so is implicit and listing of features can be enabled
with \fI\%\-features\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-features
Enable listing of features. This has the opposite effect of \fI\%\-so\fP\&.
.sp
This option should be used with caution if using the library function
\fI\%GDALVectorInfo()\fP and/or \fI\%\-json\fP, as the whole output of
ogrinfo will be built in memory. Consequently, when used on a large
collection of features, RAM may be exhausted.
.sp
New in version 3.7.

.UNINDENT
.INDENT 0.0
.TP
.B \-limit <nb_features>
New in version 3.9.

.sp
Limit the number of features per layer.
.UNINDENT
.INDENT 0.0
.TP
.B \-q
Quiet verbose reporting of various information, including coordinate
system, layer schema, extents, and feature count.
.UNINDENT
.INDENT 0.0
.TP
.B \-where <restricted_where>
An attribute query in a restricted form of the queries used in the SQL
\fIWHERE\fP statement. Only features matching the attribute query will be
reported. Starting with GDAL 2.1, the \fB@<filename>\fP syntax can be used to
indicate that the content is in the pointed filename.
.sp
Example of \fB\-where\fP and quoting:
.INDENT 7.0
.INDENT 3.5
.sp
.nf
.ft C
\-where \(dq\e\(dqCorner Point Identifier\e\(dq LIKE \(aq%__00_00\(aq\(dq
.ft P
.fi
.UNINDENT
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-sql <statement>|@<filename>
Execute the indicated SQL statement and return the result. Starting with
GDAL 2.1, the \fB@<filename>\fP syntax can be used to indicate that the content is
in the pointed filename (e.g \fB@my_select.txt\fP where my_select.txt is a file
in the current directory). Data can also be edited with SQL INSERT, UPDATE,
DELETE, DROP TABLE, ALTER TABLE etc. Editing capabilities depend on the selected
dialect with \fI\%\-dialect\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-dialect <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 can be selected with the \fBSQLITE\fP
and \fBINDIRECT_SQLITE\fP dialect values, and this can be used with any datasource.
.UNINDENT
.INDENT 0.0
.TP
.B \-spat <xmin> <ymin> <xmax> <ymax>
The area of interest. Only features within the rectangle will be reported.
.UNINDENT
.INDENT 0.0
.TP
.B \-geomfield <field>
Name of the geometry field on which the spatial filter operates.
.UNINDENT
.INDENT 0.0
.TP
.B \-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 \(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 \-fields=YES|NO
If set to \fBNO\fP, the feature dump will not display field values. Default value
is \fBYES\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-fielddomain <domain_name>
New in version 3.3.

.sp
Display details about a field domain.
.UNINDENT
.INDENT 0.0
.TP
.B \-geom=YES|NO|SUMMARY|WKT|ISO_WKT
If set to \fBNO\fP, the feature dump will not display the geometry. If set to
\fBSUMMARY\fP, only a summary of the geometry will be displayed. If set to
\fBYES\fP or \fBISO_WKT\fP, the geometry will be reported in full OGC WKT format.
If set to \fBWKT\fP the geometry will be reported in legacy \fBWKT\fP\&. Default
value is \fBYES\fP\&. (WKT and \fBISO_WKT\fP are available starting with GDAL 2.1,
which also changes the default to ISO_WKT)
.UNINDENT
.INDENT 0.0
.TP
.B \-oo <NAME>=<VALUE>
Dataset open option (format\-specific)
.UNINDENT
.INDENT 0.0
.TP
.B \-nomd
Suppress metadata printing. Some datasets may contain a lot of metadata
strings.
.UNINDENT
.INDENT 0.0
.TP
.B \-listmdd
List all metadata domains available for the dataset.
.UNINDENT
.INDENT 0.0
.TP
.B \-mdd <domain>
Report metadata for the specified domain. \fBall\fP can be used to report
metadata in all domains.
.UNINDENT
.INDENT 0.0
.TP
.B \-nocount
Suppress feature count printing.
.UNINDENT
.INDENT 0.0
.TP
.B \-noextent
Suppress spatial extent printing.
.UNINDENT
.INDENT 0.0
.TP
.B \-extent3D
New in version 3.9.

.sp
Request a 3D extent to be reported (the default is 2D only). Note that this
operation might be slower than requesting the 2D extent, depending on format
and driver capabilities.
.UNINDENT
.INDENT 0.0
.TP
.B \-nogeomtype
Suppress layer geometry type printing.
.sp
New in version 3.1.

.UNINDENT
.INDENT 0.0
.TP
.B \-\-formats
List all vector formats supported by this GDAL build (read\-only and
read\-write) and exit. The format support is indicated as follows:
.INDENT 7.0
.IP \(bu 2
\fBro\fP is read\-only driver
.IP \(bu 2
\fBrw\fP is read or write (i.e. supports \fI\%GDALDriver::CreateCopy()\fP)
.IP \(bu 2
\fBrw+\fP is read, write and update (i.e. supports \fI\%GDALDriver::Create()\fP)
.IP \(bu 2
A \fBv\fP is appended for formats supporting virtual IO (\fB/vsimem\fP, \fB/vsigzip\fP, \fB/vsizip\fP, etc).
.IP \(bu 2
A \fBs\fP is appended for formats supporting subdatasets.
.UNINDENT
.sp
The order in which drivers are listed is the one in which they are registered,
which determines the order in which they are successively probed when opening
a dataset. Most of the time, this order does not matter, but in some situations,
several drivers may recognize the same file. The \fB\-if\fP option of some utilities
can be specified to restrict opening the dataset with a subset of drivers (generally one).
Note that it does not force those drivers to open the dataset. In particular,
some drivers have requirements on file extensions.
Alternatively, the \fI\%GDAL_SKIP\fP configuration option can also be used
to exclude one or several drivers.
.UNINDENT
.INDENT 0.0
.TP
.B \-wkt_format <format>
The WKT format used to display the SRS.
Currently supported values for the \fBformat\fP are:
.sp
\fBWKT1\fP
.sp
\fBWKT2\fP (latest WKT version, currently \fIWKT2_2018\fP)
.sp
\fBWKT2_2015\fP
.sp
\fBWKT2_2018\fP
.sp
New in version 3.0.0.

.UNINDENT
.INDENT 0.0
.TP
.B <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.
.UNINDENT
.INDENT 0.0
.TP
.B <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 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.
.UNINDENT
.sp
Geometries are reported in OGC WKT format.
.SH C API
.sp
This utility is also callable from C with \fI\%GDALVectorInfo()\fP\&.
.sp
New in version 3.7.

.SH EXAMPLES
.sp
Example of reporting the names of the layers in a NTF file:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo wrk/SHETLAND_ISLANDS.NTF

INFO: Open of \(gawrk/SHETLAND_ISLANDS.NTF\(aq
using driver \(gaUK .NTF\(aq successful.
1: BL2000_LINK (Line String)
2: BL2000_POLY (None)
3: BL2000_COLLECTIONS (None)
4: FEATURE_CLASSES (None)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Example of retrieving a summary (\fB\-so\fP) of a layer without showing details about every single feature:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo \e
  \-so \e
  natural_earth_vector.gpkg \e
  ne_10m_admin_0_antarctic_claim_limit_lines

  INFO: Open of \(ganatural_earth_vector.gpkg\(aq
       using driver \(gaGPKG\(aq successful.

  Layer name: ne_10m_admin_0_antarctic_claim_limit_lines
  Geometry: Line String
  Feature Count: 23
  Extent: (\-150.000000, \-90.000000) \- (160.100000, \-60.000000)
  Layer SRS WKT:
  GEOGCS[\(dqWGS 84\(dq,
      DATUM[\(dqWGS_1984\(dq,
          SPHEROID[\(dqWGS 84\(dq,6378137,298.257223563,
              AUTHORITY[\(dqEPSG\(dq,\(dq7030\(dq]],
          AUTHORITY[\(dqEPSG\(dq,\(dq6326\(dq]],
      PRIMEM[\(dqGreenwich\(dq,0,
          AUTHORITY[\(dqEPSG\(dq,\(dq8901\(dq]],
      UNIT[\(dqdegree\(dq,0.0174532925199433,
          AUTHORITY[\(dqEPSG\(dq,\(dq9122\(dq]],
      AUTHORITY[\(dqEPSG\(dq,\(dq4326\(dq]]
  FID Column = fid
  Geometry Column = geom
  type: String (15.0)
  scalerank: Integer (0.0)
  featurecla: String (50.0)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Example of retrieving information on a file in JSON format without showing details about every single feature:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo \-json poly.shp
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
{
  \(dqdescription\(dq:\(dqautotest/ogr/data/poly.shp\(dq,
  \(dqdriverShortName\(dq:\(dqESRI Shapefile\(dq,
  \(dqdriverLongName\(dq:\(dqESRI Shapefile\(dq,
  \(dqlayers\(dq:[
    {
      \(dqname\(dq:\(dqpoly\(dq,
      \(dqmetadata\(dq:{
        \(dq\(dq:{
          \(dqDBF_DATE_LAST_UPDATE\(dq:\(dq2018\-08\-02\(dq
        },
        \(dqSHAPEFILE\(dq:{
          \(dqSOURCE_ENCODING\(dq:\(dq\(dq
        }
      },
      \(dqgeometryFields\(dq:[
        {
          \(dqname\(dq:\(dq\(dq,
          \(dqtype\(dq:\(dqPolygon\(dq,
          \(dqnullable\(dq:true,
          \(dqextent\(dq:[
            478315.53125,
            4762880.5,
            481645.3125,
            4765610.5
          ],
          \(dqcoordinateSystem\(dq:{
            \(dqwkt\(dq:\(dqPROJCRS[\e\(dqOSGB36 / British National Grid\e\(dq,BASEGEOGCRS[\e\(dqOSGB36\e\(dq,DATUM...\(dq,
            \(dqprojjson\(dq:{
              \(dq$schema\(dq:\(dqhttps://proj.org/schemas/v0.6/projjson.schema.json\(dq,
              \(dqtype\(dq:\(dqProjectedCRS\(dq,
              \(dqname\(dq:\(dqOSGB36 / British National Grid\(dq,
              \(dqbase_crs\(dq:{
                \(dqname\(dq:\(dqOSGB36\(dq,
                \(dqdatum\(dq:{
                  \(dqtype\(dq:\(dqGeodeticReferenceFrame\(dq,
                  \(dqname\(dq:\(dqOrdnance Survey of Great Britain 1936\(dq,
                  \(dqellipsoid\(dq:{
                    \(dqname\(dq:\(dqAiry 1830\(dq,
                    \(dqsemi_major_axis\(dq:6377563.396,
                    \(dqinverse_flattening\(dq:299.3249646
                  }
                },
                \(dqcoordinate_system\(dq:{
                  \(dqsubtype\(dq:\(dqellipsoidal\(dq,
                  \(dqaxis\(dq:[
                    {
                      \(dqname\(dq:\(dqGeodetic latitude\(dq,
                      \(dqabbreviation\(dq:\(dqLat\(dq,
                      \(dqdirection\(dq:\(dqnorth\(dq,
                      \(dqunit\(dq:\(dqdegree\(dq
                    },
                    {
                      \(dqname\(dq:\(dqGeodetic longitude\(dq,
                      \(dqabbreviation\(dq:\(dqLon\(dq,
                      \(dqdirection\(dq:\(dqeast\(dq,
                      \(dqunit\(dq:\(dqdegree\(dq
                    }
                  ]
                },
                \(dqid\(dq:{
                  \(dqauthority\(dq:\(dqEPSG\(dq,
                  \(dqcode\(dq:4277
                }
              },
              \(dqconversion\(dq:{
                \(dqname\(dq:\(dqBritish National Grid\(dq,
                \(dqmethod\(dq:{
                  \(dqname\(dq:\(dqTransverse Mercator\(dq,
                  \(dqid\(dq:{
                    \(dqauthority\(dq:\(dqEPSG\(dq,
                    \(dqcode\(dq:9807
                  }
                },
                \(dqparameters\(dq:[
                  {
                    \(dqname\(dq:\(dqLatitude of natural origin\(dq,
                    \(dqvalue\(dq:49,
                    \(dqunit\(dq:\(dqdegree\(dq,
                    \(dqid\(dq:{
                      \(dqauthority\(dq:\(dqEPSG\(dq,
                      \(dqcode\(dq:8801
                    }
                  },
                  {
                    \(dqname\(dq:\(dqLongitude of natural origin\(dq,
                    \(dqvalue\(dq:\-2,
                    \(dqunit\(dq:\(dqdegree\(dq,
                    \(dqid\(dq:{
                      \(dqauthority\(dq:\(dqEPSG\(dq,
                      \(dqcode\(dq:8802
                    }
                  },
                  {
                    \(dqname\(dq:\(dqScale factor at natural origin\(dq,
                    \(dqvalue\(dq:0.9996012717,
                    \(dqunit\(dq:\(dqunity\(dq,
                    \(dqid\(dq:{
                      \(dqauthority\(dq:\(dqEPSG\(dq,
                      \(dqcode\(dq:8805
                    }
                  },
                  {
                    \(dqname\(dq:\(dqFalse easting\(dq,
                    \(dqvalue\(dq:400000,
                    \(dqunit\(dq:\(dqmetre\(dq,
                    \(dqid\(dq:{
                      \(dqauthority\(dq:\(dqEPSG\(dq,
                      \(dqcode\(dq:8806
                    }
                  },
                  {
                    \(dqname\(dq:\(dqFalse northing\(dq,
                    \(dqvalue\(dq:\-100000,
                    \(dqunit\(dq:\(dqmetre\(dq,
                    \(dqid\(dq:{
                      \(dqauthority\(dq:\(dqEPSG\(dq,
                      \(dqcode\(dq:8807
                    }
                  }
                ]
              },
              \(dqcoordinate_system\(dq:{
                \(dqsubtype\(dq:\(dqCartesian\(dq,
                \(dqaxis\(dq:[
                  {
                    \(dqname\(dq:\(dqEasting\(dq,
                    \(dqabbreviation\(dq:\(dqE\(dq,
                    \(dqdirection\(dq:\(dqeast\(dq,
                    \(dqunit\(dq:\(dqmetre\(dq
                  },
                  {
                    \(dqname\(dq:\(dqNorthing\(dq,
                    \(dqabbreviation\(dq:\(dqN\(dq,
                    \(dqdirection\(dq:\(dqnorth\(dq,
                    \(dqunit\(dq:\(dqmetre\(dq
                  }
                ]
              },
              \(dqscope\(dq:\(dqEngineering survey, topographic mapping.\(dq,
              \(dqarea\(dq:\(dqUnited Kingdom (UK) \- offshore to boundary of UKCS within 49°45...\(dq,
              \(dqbbox\(dq:{
                \(dqsouth_latitude\(dq:49.75,
                \(dqwest_longitude\(dq:\-9,
                \(dqnorth_latitude\(dq:61.01,
                \(dqeast_longitude\(dq:2.01
              },
              \(dqid\(dq:{
                \(dqauthority\(dq:\(dqEPSG\(dq,
                \(dqcode\(dq:27700
              }
            },
            \(dqdataAxisToSRSAxisMapping\(dq:[
              1,
              2
            ]
          }
        }
      ],
      \(dqfeatureCount\(dq:10,
      \(dqfields\(dq:[
        {
          \(dqname\(dq:\(dqAREA\(dq,
          \(dqtype\(dq:\(dqReal\(dq,
          \(dqwidth\(dq:12,
          \(dqprecision\(dq:3,
          \(dqnullable\(dq:true,
          \(dquniqueConstraint\(dq:false
        },
        {
          \(dqname\(dq:\(dqEAS_ID\(dq,
          \(dqtype\(dq:\(dqInteger64\(dq,
          \(dqwidth\(dq:11,
          \(dqnullable\(dq:true,
          \(dquniqueConstraint\(dq:false
        },
        {
          \(dqname\(dq:\(dqPRFEDEA\(dq,
          \(dqtype\(dq:\(dqString\(dq,
          \(dqwidth\(dq:16,
          \(dqnullable\(dq:true,
          \(dquniqueConstraint\(dq:false
        }
      ]
    }
  ],
  \(dqmetadata\(dq:{
  },
  \(dqdomains\(dq:{
  },
  \(dqrelationships\(dq:{
  }
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Example of using \-q and an attribute query, to restrict the output to
certain features in a layer:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo \-q \-ro \e
  \-where \(aqGLOBAL_LINK_ID=185878\(aq \e
  wrk/SHETLAND_ISLANDS.NTF BL2000_LINK

Layer name: BL2000_LINK
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,...
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Example of updating a value of an attribute in a shapefile with SQL by using the SQLite dialect:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo test.shp \-dialect sqlite \-sql \(dqupdate test set attr=\(aqbar\(aq where attr=\(aqfoo\(aq\(dq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Adding a column to an input file:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo input.shp \-sql \(dqALTER TABLE input ADD fieldX float\(dq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Sometimes there is no input file involved in a calculation. In such cases one may
use the \fB:memory:\fP input file which is a in\-memory empty SQLite file (and the SQLite SQL dialect will be implicitly used).
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrinfo :memory: \-sql \(dqSELECT ST_Buffer(ST_GeomFromText(\(aqPOINT(0 0)\(aq), 1)\(dq
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de>
.SH COPYRIGHT
1998-2025
.\" Generated by docutils manpage writer.
.