OGRINFO(1)
πΈ OGRINFO πΈ
bestie. gather round. this is ogrinfo, and it's the manual page for it, from the GDAL crew. it Lists information about an OGR-supported data source. that's the whole vibe. π
β¨ SYNOPSIS β¨
okay so here's the shape of the thing, exactly as written, no cap:
Usage: ogrinfo [--help] [--long-usage] [--help-general]
[-json] [-ro] [-update] [--quiet] [-fid <FID>]
[-spat <xmin> <ymin> <xmax> <ymax>] [-geomfield <field>]
[-where <restricted_where>]
[[-sql <statement|@filename>]|[-rl]]
[-dialect <dialect>] [-al]
[[-summary]|[-features]]
[-limit <nb_features>] [-fields YES|NO]
[-geom YES|NO|SUMMARY|WKT|ISO_WKT] [-oo <NAME=VALUE>]... [-nomd]
[-listmdd] [-mdd <domain>]... [-nocount] [-noextent] [-extent3D]
[-nogeomtype] [-wkt_format WKT1|WKT2|WKT2_2015|WKT2_2019]
[-fielddomain <name>] [-if <format>]...
filename [<layer_name>]...
ik it looks like a lot but it's giving very organized, honestly. π
π DESCRIPTION π
The ogrinfo 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.
TIP: Equivalent in new "gdal" command line interface: See gdal vector info.
π¦ All the options, one by one, no skipping π
--helpβ Show this help message and exit. the classic. the icon.--help-generalβ Gives a brief usage message for the generic GDAL commandline options and exit. like, the general lore, not the deep lore.-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. Added in version 3.2.-jsonβ Display the output in json format, conforming to theogrinfo_output.schema.jsonogrinfo_output.schema.jsonschema. β¨ structured slay β¨ Added in version 3.7.-roβ Open the data source in read-only mode. look but don't touch energy π«Ά-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-so. In JSON output,-alis implicit, but listing of features must be explicitly enabled with-features.-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).-rlcannot be used with-sql. them's the rules.-soβ Summary Only: suppress listing of individual features and show only summary information like projection, schema, feature count and extents. In JSON output,-sois implicit and listing of features can be enabled with-features. the tl;dr option, obsessed.-featuresβ Enable listing of features. This has the opposite effect of-so.
This option should be used with caution if using the library functionGDALVectorInfo()and/or-json, as the whole output ofogrinfowill be built in memory. Consequently, when used on a large collection of features, RAM may be exhausted. π bestie please be careful, your RAM is not infinite.
Added in version 3.7.
-limit <nb_features>β Limit the number of features per layer. Added in version 3.9.-qβ Quiet verbose reporting of various information, including coordinate system, layer schema, extents, and feature count. shhh π€«-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. The@<filename>syntax can be used to indicate that the content is in the pointed filename. Example of-whereand quoting:
-where "\"Corner Point Identifier\" LIKE '%__00_00'"
Note:-dialectis ignored with-where. Use-sqlinstead of-whereif you want to use-dialect.
-sql <statement>|@<filename>β Execute the indicated SQL statement and return the result. The@<filename>syntax can be used to indicate that the content is in the pointed filename (e.g@my_select.txtwheremy_select.txtis a file in the current directory). Data can also be edited with SQLINSERT,UPDATE,DELETE,DROP TABLE,ALTER TABLEetc. Editing capabilities depend on the selected dialect with-dialect. π₯ the main character option tbh.-dialect <dialect>β SQL dialect. In some cases can be used to use (unoptimized) OGR SQL dialect instead of the native SQL of an RDBMS by passing theOGRSQLdialect value. The SQL SQLite dialect can be selected with theSQLITEandINDIRECT_SQLITEdialect values, and this can be used with any datasource.
Note:-dialectis ignored with-where. Use-sqlinstead of-whereif you want to use-dialect.
-spat <xmin> <ymin> <xmax> <ymax>β The area of interest. Only features within the rectangle will be reported. π box it out.-geomfield <field>β Name of the geometry field on which the spatial filter operates.-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β If set toNO, the feature dump will not display field values. Default value isYES. π-fielddomain <domain_name>β Display details about a field domain. Added in version 3.3.-geom=YES|NO|SUMMARY|WKT|ISO_WKTβ If set toNO, the feature dump will not display the geometry. If set toSUMMARY, only a summary of the geometry will be displayed. If set toYESorISO_WKT, the geometry will be reported in full OGC WKT format. If set toWKTthe geometry will be reported in legacy WKT. Default value isYES. π« geometry lore.-oo <NAME>=<VALUE>β Dataset open option (format specific). If a driver supports theOGR_SCHEMAopen option, it can be used to partially or completely override the auto-detected schema (i.e. which fields are read, with which types, subtypes, length, precision etc.) of the dataset. The value of this option is a JSON string or a path to a JSON file that complies with theOGR_SCHEMAopen option schema definition.-nomdβ Suppress metadata printing. Some datasets may contain a lot of metadata strings. π so much.-listmddβ List all metadata domains available for the dataset.-mdd <domain>β Report metadata for the specified domain.allcan be used to report metadata in all domains. π-nocountβ Suppress feature count printing.-noextentβ Suppress spatial extent printing.-extent3Dβ 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. β οΈ slower, fyi, not a scam just slow. Added in version 3.9.-nogeomtypeβ Suppress layer geometry type printing. Added in version 3.1.--formatsβ List all vector formats supported by this GDAL build (read-only and read-write) and exit. The format support is indicated as follows:rois read-only driverrwis read or write (i.e. supportsGDALDriver::CreateCopy())rw+is read, write and update (i.e. supportsGDALDriver::Create())- A
vis appended for formats supporting virtual IO (/vsimem,/vsigzip,/vsizip, etc). - A
sis appended for formats supporting subdatasets.
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 -if 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 GDAL_SKIP configuration option can also be used to exclude one or several drivers. π the lore is deep.
-wkt_format <format>β The WKT format used to display the SRS. Currently supported values for the format are:WKT1WKT2(latest WKT version, currentlyWKT2_2018)WKT2_2015WKT2_2018Added in version 3.0.0.
<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. π¦ your main input bestie.<layer>β One or more layer names may be reported. If no layer names are passed thenogrinfowill 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.
Geometries are reported in OGC WKT format. π periodt.
π«Ά RETURN STATUS CODE π«Ά
The program returns status code 0 in case of success, and non-zero in case of error (non-blocking errors emitted as warnings are considered as a successful execution). so 0 = we ate, nonzero = we did not eat. π
π C API π
This utility is also callable from C with GDALVectorInfo(). yes bestie, you can summon it from C too. π
Added in version 3.7.
π EXAMPLES π
okay bestie, this is the part where it all clicks. these are real commands you can literally copy-paste, and honestly? they ate. π
Example 1: Reporting the names of the layers in a NTF file
just yeet a file at ogrinfo with zero options and it'll tell you what layers live inside. that's it. that's the whole vibe. π¦
$ 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)
Example 2: Retrieving a summary (-so) of a layer without showing details about every feature
this one is the summary-only girlie. -so means you get the layer's little fact sheet β geometry type, feature count, extent, SRS, the fields β without dumping every single feature on you. main character restraint. β¨
$ ogrinfo \
-so \
natural_earth_vector.gpkg \
ne_10m_admin_0_antarctic_claim_limit_lines
INFO: Open of `natural_earth_vector.gpkg'
using driver `GPKG' 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["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]
FID Column = fid
Geometry Column = geom
type: String (15.0)
scalerank: Integer (0.0)
featurecla: String (50.0)
Example 3: Retrieving information on a file in JSON format without showing details about every feature
bestie. JSON MODE. -json and suddenly everything is machine-readable and lowkey gorgeous. look at all those nested objects, it's giving structure, it's giving data, it's giving iykyk. π
ogrinfo -json poly.shp
{
"description":"autotest/ogr/data/poly.shp",
"driverShortName":"ESRI Shapefile",
"driverLongName":"ESRI Shapefile",
"layers":[
{
"name":"poly",
"metadata":{
"":{
"DBF_DATE_LAST_UPDATE":"2018-08-02"
},
"SHAPEFILE":{
"SOURCE_ENCODING":""
}
},
"geometryFields":[
{
"name":"",
"type":"Polygon",
"nullable":true,
"extent":[
478315.53125,
4762880.5,
481645.3125,
4765610.5
],
"coordinateSystem":{
"wkt":"PROJCRS[\"OSGB36 / British National Grid\",BASEGEOGCRS[\"OSGB36\",DATUM...",
"projjson":{
"$schema":"https://proj.org/schemas/v0.6/projjson.schema.json",
"type":"ProjectedCRS",
"name":"OSGB36 / British National Grid",
"base_crs":{
"name":"OSGB36",
"datum":{
"type":"GeodeticReferenceFrame",
"name":"Ordnance Survey of Great Britain 1936",
"ellipsoid":{
"name":"Airy 1830",
"semi_major_axis":6377563.396,
"inverse_flattening":299.3249646
}
},
"coordinate_system":{
"subtype":"ellipsoidal",
"axis":[
{
"name":"Geodetic latitude",
"abbreviation":"Lat",
"direction":"north",
"unit":"degree"
},
{
"name":"Geodetic longitude",
"abbreviation":"Lon",
"direction":"east",
"unit":"degree"
}
]
},
"id":{
"authority":"EPSG",
"code":4277
}
},
"conversion":{
"name":"British National Grid",
"method":{
"name":"Transverse Mercator",
"id":{
"authority":"EPSG",
"code":9807
}
},
"parameters":[
{
"name":"Latitude of natural origin",
"value":49,
"unit":"degree",
"id":{
"authority":"EPSG",
"code":8801
}
},
{
"name":"Longitude of natural origin",
"value":-2,
"unit":"degree",
"id":{
"authority":"EPSG",
"code":8802
}
},
{
"name":"Scale factor at natural origin",
"value":0.9996012717,
"unit":"unity",
"id":{
"authority":"EPSG",
"code":8805
}
},
{
"name":"False easting",
"value":400000,
"unit":"metre",
"id":{
"authority":"EPSG",
"code":8806
}
},
{
"name":"False northing",
"value":-100000,
"unit":"metre",
"id":{
"authority":"EPSG",
"code":8807
}
}
]
},
"coordinate_system":{
"subtype":"Cartesian",
"axis":[
{
"name":"Easting",
"abbreviation":"E",
"direction":"east",
"unit":"metre"
},
{
"name":"Northing",
"abbreviation":"N",
"direction":"north",
"unit":"metre"
}
]
},
"scope":"Engineering survey, topographic mapping.",
"area":"United Kingdom (UK) - offshore to boundary of UKCS within 49Β°45...",
"bbox":{
"south_latitude":49.75,
"west_longitude":-9,
"north_latitude":61.01,
"east_longitude":2.01
},
"id":{
"authority":"EPSG",
"code":27700
}
},
"dataAxisToSRSAxisMapping":[
1,
2
]
}
}
],
"featureCount":10,
"fields":[
{
"name":"AREA",
"type":"Real",
"width":12,
"precision":3,
"nullable":true,
"uniqueConstraint":false
},
{
"name":"EAS_ID",
"type":"Integer64",
"width":11,
"nullable":true,
"uniqueConstraint":false
},
{
"name":"PRFEDEA",
"type":"String",
"width":16,
"nullable":true,
"uniqueConstraint":false
}
]
}
],
"metadata":{
},
"domains":{
},
"relationships":{
}
}
Example 4: Using -q and an attribute query to restrict the output to certain features in a layer
here we're pairing -q with -ro and an attribute filter so we only see the features that match. narrow it down, keep it clean. note the -where doing the heavy lifting and the layer name right at the end. π
$ ogrinfo -q -ro \
-where 'GLOBAL_LINK_ID=185878' \
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,...
Example 5: Updating a value of an attribute in a shapefile with SQL by using the SQLite dialect
yes, you can update stuff with SQL in ogrinfo. the -dialect sqlite is the magic word here and -sql carries the statement. one line, whole edit, obsessed. π
ogrinfo test.shp -dialect sqlite -sql "update test set attr='bar' where attr='foo'"
Example 6: Adding a column to an input file
same energy, different statement. ALTER TABLE all the way through -sql, and boom β new column. πΈ
ogrinfo input.shp -sql "ALTER TABLE input ADD fieldX float"
Example 7: Performing a SQL query without an input file
Sometimes there is no input file involved in a calculation. In such cases one may use the :memory: input file which is a in-memory empty SQLite file (and the SQLite SQL dialect will be implicitly used).
likeβ¦ no file? no problem bestie. :memory: is an empty SQLite file that lives in memory, and the SQLite SQL dialect gets implicitly used β so you can straight up do math on geometries with nothing on disk. it's giving calculator energy but make it spatial. π§
ogrinfo :memory: -sql "SELECT ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1)"
π AUTHOR π
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de>
π COPYRIGHT π
1998-2026
that's the whole page, bestie!! π«Ά this edition is dated Aug 18, 2026 and it's page one of OGRINFO(1) β take that date and that section number with you, you're officially literate in ogrinfo now. slay, go map something. πβ¨
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms