LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ogrinfo

displays vector data information

TLDR

List layers and summary of a data source
$ ogrinfo [file.shp]
copy
Summary of a specific layer only (no features)
$ ogrinfo -so [file.shp] [layer_name]
copy
Dump all layers and all features
$ ogrinfo -al [file.shp]
copy
Show a single feature by FID
$ ogrinfo [file.shp] [layer_name] -fid [feature_id]
copy
Filter features with a WHERE clause
$ ogrinfo -al -where "[field = 'value']" [file.shp]
copy
Run an SQL query
$ ogrinfo [file.shp] -sql "[SELECT * FROM layer]"
copy
Output as JSON
$ ogrinfo -json [file.shp]
copy

SYNOPSIS

ogrinfo [options] datasource [layer ...]

DESCRIPTION

ogrinfo lists information about an OGR-supported vector data source to stdout. It reports layers, schema, coordinate reference system, extents, feature counts, and optionally the features themselves. By executing SQL statements via -sql it can also edit data in supported drivers.

PARAMETERS

DATASOURCE

OGR-supported vector data source (file, directory, connection string, URL).
LAYER
One or more layer names to report on. If omitted with -al, all layers are reported.
-al
List all features of all layers (opposite of -so).
-so
Summary only: omit feature-by-feature reporting.
-fl
Enable listing of features (opposite of -so).
-json
Output the report in JSON format.
-fid ID
Only report the feature with the given FID.
-sql STATEMENT
Execute an SQL statement and return the result. Can also be a @filename reference.
-dialect DIALECT
SQL dialect to use (e.g., OGRSQL, SQLITE).
-where QUERY
Attribute filter applied to each layer.
-spat xmin ymin xmax ymax
Spatial filter: only features intersecting this bounding box are reported.
-geom {YES|NO|SUMMARY|WKT|ISOWKT}_
How geometry is reported (default: YES).
-limit N
Limit the number of features per layer.
-if FORMAT
Force a specific driver when opening the input.
-oo NAME=VALUE
Pass a dataset open option to the driver.
-ro
Open the data source in read-only mode.
-nomd
Suppress metadata printing.
-listmdd
List all metadata domains available for the dataset.
-mdd domain
Report metadata for the specified domain.
--help
Display help information.

CAVEATS

Part of the GDAL suite. Format support depends on which OGR drivers were compiled into your GDAL build; check with `ogrinfo --formats`. Using -al on very large datasets can produce huge output.

HISTORY

ogrinfo is distributed with GDAL/OGR, the open-source geospatial data library maintained by the OSGeo foundation. OGR originated as a separate library for vector data and was unified into GDAL in version 2.0.

SEE ALSO

ogr2ogr(1), gdalinfo(1)

Copied to clipboard
Kai