GDAL-VECTOR-INFO(1)

NAME
gdal-vector-info - Get information on a vector dataset

Added in version 3.11.

SYNOPSIS

    Usage: gdal vector info [OPTIONS] <INPUT>...
    Return information on a vector dataset.
    Positional arguments:
      -i, --dataset, --input <INPUT>                       Input vector datasets [may be repeated] [required]
    Common Options:
      -h, --help                                           Display help message and exit
      --json-usage                                         Display usage as JSON document and exit
      --config <KEY>=<VALUE>                               Configuration option [may be repeated]
    Options:
      -f, --of, --format, --output-format <OUTPUT-FORMAT>  Output format. OUTPUT-FORMAT=json|text
      -l, --layer, --input-layer <INPUT-LAYER>             Input layer name [may be repeated]
                                                           Mutually exclusive with --sql, --fid
      --features                                           List all features (beware of RAM consumption on large layers)
                                                           Mutually exclusive with --summary
      --summary                                            List the layer names and the geometry type
                                                           Mutually exclusive with --features
      --limit <FEATURE-COUNT>                              Limit the number of features per layer (implies --features)
      --sql <statement>|@<filename>                        Execute the indicated SQL statement and return the result
                                                           Mutually exclusive with --input-layer, --fid
      --where <WHERE>|@<filename>                          Attribute query in a restricted form of the queries used in the SQL WHERE statement
      --fid <FID>                                          Feature identifier
                                                           Mutually exclusive with --input-layer, --sql
      --dialect <DIALECT>                                  SQL dialect
    Advanced Options:
      --oo, --open-option <KEY>=<VALUE>                    Open options [may be repeated]
      --if, --input-format <INPUT-FORMAT>                  Input formats [may be repeated]
    Esoteric Options:
      --crs-format <CRS-FORMAT>                            Which format to use to report CRS. CRS-FORMAT=AUTO|WKT2|PROJJSON (default: AUTO)

DESCRIPTION

gdal vector info lists various information about a GDAL supported vector dataset, and returns them on the standard output stream when used from the command line, or in the output parameter when used from the API.

Starting with GDAL 3.12, gdal vector info can be used as the last step of a pipeline.

The following options are available:

PROGRAM-SPECIFIC OPTIONS

--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 the OGRSQL dialect value. The SQL SQLite dialect can be selected with the SQLITE and INDIRECT_SQLITE dialect values, and this can be used with any datasource.

--features
    List all features by default, unless limited with --limit. Beware of RAM consumption on large layers when using JSON output. This option is mutually exclusive with the --summary option.

-f, --of, --format, --output-format json|text
    Which output format to use. Default is JSON, and starting with GDAL 3.12, text when invoked from command line.

-l, --layer, --input-layer <INPUT-LAYER>
    Name of one or more layers to inspect. If no layer names are passed and --sql is not specified, then all layers will be selected.

--limit <FEATURE-COUNT>
    Added in version 3.12.

    Limit the number of features reported per layer. When set, this implies --features.

--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.txt 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 if the dataset is opened in update mode. Editing capabilities depend on the selected dialect with --dialect.

    This option is mutually exclusive with the --where option.

--summary
    Print a summary with the list of layers and the geometry type of each layer. This option is mutually exclusive with the --features option.

--where <WHERE>|@<filename>
    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 --where and quoting:

        --where "\"Corner Point Identifier\" LIKE '%__00_00'"

    This option is mutually exclusive with the --sql option.

--fid <FID>
    Added in version 3.13.

    Feature identifier. Only the feature with the specified FID will be reported.

--crs-format AUTO|WKT2|PROJJSON
    Added in version 3.13.

    Which format to use to report the CRS. In AUTO default mode, if the CRS can be captured with an authority name and code (known of PROJ), only a summary of the CRS, including its name, ID, type and area of use will be reported. Otherwise a full WKT2:2019 definition will be reported.

    NOTE: --crs-format can only be set when --output-format is set to text. The JSON text format includes both WKT2 and PROJJSON.

STANDARD OPTIONS

--oo, --open-option <NAME>=<VALUE>
    Dataset open option (format specific).

    May be repeated.

--if, --input-format <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.

    May be repeated.

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).

EXAMPLES

  Example 1: Getting information on the file poly.gpkg (with text output), listing all features

    $ gdal vector info --features poly.gpkg
    INFO: Open of `poly.gpkg'
          using driver `GPKG' successful.
    Layer name: poly
    Metadata:
      DBF_DATE_LAST_UPDATE=2018-08-02
    Geometry: Polygon
    Feature Count: 10
    Extent: (478315.531250, 4762880.500000) - (481645.312500, 4765610.500000)
    Layer Coordinate Reference System:
      - name: OSGB36 / British National Grid
      - ID: EPSG:27700
      - type: Projected
      - projection type: British National Grid, Transverse Mercator
      - units: metre
      - area of use: United Kingdom (UK)..., west -9.01, south 49.75, east 2.01, north 61.01
    Data axis to CRS axis mapping: 1,2
    FID Column = fid
    Geometry Column = geom
    AREA: Real (0.0)
    EAS_ID: Integer64 (0.0)
    PRFEDEA: String (16.0)
    OGRFeature(poly):1
      AREA (Real) = 215229.266
      EAS_ID (Integer64) = 168
      PRFEDEA (String) = 35043411
      POLYGON ((479819.84375 4765180.5,479690.1875 4765259.5,479647.0 4765369.5,479730.375 4765400.5,480039.03125 4765539.5,480035.34375 4765558.5,480159.78125 4765610.5,480202.28125 4765482.0,480365.0 4765015.5,480389.6875 4764950.0,480133.96875 4764856.5,480080.28125 4764979.5,480082.96875 4765049.5,480088.8125 4765139.5,480059.90625 4765239.5,480019.71875 4765319.5,479980.21875 4765409.5,479909.875 4765370.0,479859.875 4765270.0,479819.84375 4765180.5))
    OGRFeature(poly):2
      AREA (Real) = 247328.172
      EAS_ID (Integer64) = 179
      PRFEDEA (String) = 35043423
      POLYGON ((480035.34375 4765558.5,480039.03125 4765539.5,479730.375 4765400.5,479647.0 4765369.5,479690.1875 4765259.5,479819.84375 4765180.5,479779.84375 4765109.5,479681.78125 4764940.0,479468.0 4764942.5,479411.4375 4764940.5,479353.0 4764939.5,479208.65625 4764882.5,479196.8125 4764879.0,479123.28125 4765015.0,479046.53125 4765117.0,479029.71875 4765110.5,479014.9375 4765147.5,479149.9375 4765200.5,479639.625 4765399.5,480035.34375 4765558.5))
    OGRFeature(poly):3
      AREA (Real) = 261752.781
      EAS_ID (Integer64) = 171
      PRFEDEA (String) = 35043414
      POLYGON ((479819.84375 4765180.5,479859.875 4765270.0,479909.875 4765370.0,479980.21875 4765409.5,480019.71875 4765319.5,480059.90625 4765239.5,480088.8125 4765139.5,480082.96875 4765049.5,480000.28125 4765043.0,479934.96875 4765020.0,479895.125 4765000.0,479734.375 4764865.0,479680.28125 4764852.0,479644.78125 4764827.5,479637.875 4764803.0,479617.21875 4764760.0,479587.28125 4764718.0,479548.03125 4764693.5,479504.90625 4764609.5,479239.8125 4764505.0,479117.8125 4764847.0,479196.8125 4764879.0,479208.65625 4764882.5,479353.0 4764939.5,479411.4375 4764940.5,479468.0 4764942.5,479681.78125 4764940.0,479779.84375 4765109.5,479819.84375 4765180.5))
    OGRFeature(poly):4
      AREA (Real) = 547597.188
      EAS_ID (Integer64) = 173
      PRFEDEA (String) = 35043416
      POLYGON ((479014.9375 4765147.5,479029.71875 4765110.5,479117.8125 4764847.0,479239.8125 4764505.0,479305.875 4764361.0,479256.03125 4764314.5,479220.90625 4764212.5,479114.5 4764174.0,479018.28125 4764418.5,478896.9375 4764371.0,478748.8125 4764308.5,478503.03125 4764218.0,478461.75 4764337.5,478443.9375 4764400.5,478447.8125 4764454.0,478448.6875 4764531.5,478502.1875 4764541.5,478683.0 4764730.5,478621.03125 4764788.5,478597.34375 4764766.5,478532.5 4764695.5,478460.125 4764615.0,478408.0625 4764654.0,478315.53125 4764876.0,478889.25 4765100.0,479014.9375 4765147.5))
    OGRFeature(poly):5
      AREA (Real) = 15775.758
      EAS_ID (Integer64) = 172
      PRFEDEA (String) = 35043415
      POLYGON ((479029.71875 4765110.5,479046.53125 4765117.0,479123.28125 4765015.0,479196.8125 4764879.0,479117.8125 4764847.0,479029.71875 4765110.5))
    OGRFeature(poly):6
      AREA (Real) = 101429.977
      EAS_ID (Integer64) = 169
      PRFEDEA (String) = 35043412
      POLYGON ((480082.96875 4765049.5,480080.28125 4764979.5,480133.96875 4764856.5,479968.46875 4764788.0,479750.6875 4764702.0,479735.90625 4764752.0,479640.09375 4764721.0,479658.59375 4764670.0,479504.90625 4764609.5,479548.03125 4764693.5,479587.28125 4764718.0,479617.21875 4764760.0,479637.875 4764803.0,479644.78125 4764827.5,479680.28125 4764852.0,479734.375 4764865.0,479895.125 4765000.0,479934.96875 4765020.0,480000.28125 4765043.0,480082.96875 4765049.5))
    OGRFeature(poly):7
      AREA (Real) = 268597.625
      EAS_ID (Integer64) = 166
      PRFEDEA (String) = 35043409
      POLYGON ((480389.6875 4764950.0,480537.15625 4765014.0,480567.96875 4764918.0,480605 4764835,480701.0625 4764738.0,480710.25 4764690.5,480588.59375 4764740.5,480540.71875 4764741.0,480515.125 4764695.0,480731.65625 4764561.5,480692.1875 4764453.5,480677.84375 4764439.0,480655.34375 4764397.5,480584.375 4764353.0,480500.40625 4764326.5,480358.53125 4764277.0,480192.3125 4764183.0,480157.125 4764266.5,480234.3125 4764304.0,480289.125 4764348.5,480316 4764395,480343.5625 4764477.0,480343.71875 4764532.5,480258.03125 4764767.0,480177.15625 4764742.0,480093.75 4764703.0,480011.0 4764674.5,479985.0625 4764732.0,479968.46875 4764788.0,480133.96875 4764856.5,480389.6875 4764950.0))
    OGRFeature(poly):8
      AREA (Real) = 1634833.375
      EAS_ID (Integer64) = 158
      PRFEDEA (String) = 35043369
      POLYGON ((480701.0625 4764738.0,480761.46875 4764778.0,480824.96875 4764820.0,480922.03125 4764850.5,480930.71875 4764852.0,480984.25 4764875.0,481088.1875 4764936.0,481136.84375 4764994.5,481281.3125 4764876.5,481291.09375 4764810.0,481465.90625 4764872.5,481457.375 4764937.0,481509.65625 4764967.0,481538.90625 4764982.5,481575.0 4764999.5,481602.125 4764915.5,481629.84375 4764829.5,481645.3125 4764797.5,481635.96875 4764795.5,481235.3125 4764650.0,481209.8125 4764633.5,481199.21875 4764623.5,481185.5 4764607.0,481159.9375 4764580.0,481140.46875 4764510.5,481141.625 4764480.5,481199.84375 4764180.0,481143.4375 4764010.5,481130.3125 4763979.5,481039.9375 4763889.5,480882.6875 4763670.0,480826.0625 4763650.5,480745.1875 4763628.5,480654.4375 4763627.5,480599.8125 4763660.0,480281.9375 4763576.5,480221.5 4763533.5,480199.6875 4763509.0,480195.09375 4763430.0,480273.6875 4763305.5,480309.6875 4763063.5,480201.84375 4762962.5,479855.3125 4762880.5,479848.53125 4762897.0,479728.875 4763217.5,479492.6875 4763850.0,479550.0625 4763919.5,480120.21875 4764188.5,480192.3125 4764183.0,480358.53125 4764277.0,480500.40625 4764326.5,480584.375 4764353.0,480655.34375 4764397.5,480677.84375 4764439.0,480692.1875 4764453.5,480731.65625 4764561.5,480515.125 4764695.0,480540.71875 4764741.0,480588.59375 4764740.5,480710.25 4764690.5,480701.0625 4764738.0))
    OGRFeature(poly):9
      AREA (Real) = -596610.313
      EAS_ID (Integer64) = 165
      PRFEDEA (String) = 35043408
      POLYGON ((479750.6875 4764702.0,479968.46875 4764788.0,479985.0625 4764732.0,480011.0 4764674.5,480093.75 4764703.0,480177.15625 4764742.0,480258.03125 4764767.0,480343.71875 4764532.5,480343.5625 4764477.0,480316 4764395,480289.125 4764348.5,480234.3125 4764304.0,480157.125 4764266.5,480192.3125 4764183.0,480120.21875 4764188.5,479550.0625 4763919.5,479492.6875 4763850.0,479487.75 4763864.5,479442.75 4763990.0,479436 4764023,479398.9375 4764100.0,479349.625 4764230.0,479305.875 4764361.0,479239.8125 4764505.0,479504.90625 4764609.5,479658.59375 4764670.0,479750.6875 4764702.0))
    OGRFeature(poly):10
      AREA (Real) = 5268.813
      EAS_ID (Integer64) = 170
      PRFEDEA (String) = 35043413
      POLYGON ((479750.6875 4764702.0,479658.59375 4764670.0,479640.09375 4764721.0,479735.90625 4764752.0,479750.6875 4764702.0))

  Example 2: Getting information on the file poly.gpkg (with JSON output)

    $ gdal vector info --format=JSON poly.gpkg
    {
      "description":"poly.gpkg",
      "driverShortName":"GPKG",
      "driverLongName":"GeoPackage",
      "layers":[
        {
          "name":"poly",
          "metadata":{
            "":{
              "DBF_DATE_LAST_UPDATE":"2018-08-02"
            }
          },
          "geometryFields":[
            {
              "name":"geom",
              "type":"Polygon",
              "nullable":true,
              "extent":[
                478315.53125,
                4762880.5,
                481645.3125,
                4765610.5
              ],
              "coordinateSystem":{
                "wkt":"PROJCRS[\"OSGB36 / British National Grid\",\n    BASEGEOGCRS[\"OSGB36\",\n        DATUM[\"Ordnance Survey of Great Britain 1936\",\n            ELLIPSOID[\"Airy 1830\",6377563.396,299.3249646,\n                LENGTHUNIT[\"metre\",1]]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        ID[\"EPSG\",4277]],\n    CONVERSION[\"British National Grid\",\n        METHOD[\"Transverse Mercator\",\n            ID[\"EPSG\",9807]],\n        PARAMETER[\"Latitude of natural origin\",49,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8801]],\n        PARAMETER[\"Longitude of natural origin\",-2,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8802]],\n        PARAMETER[\"Scale factor at natural origin\",0.9996012717,\n            SCALEUNIT[\"unity\",1],\n            ID[\"EPSG\",8805]],\n        PARAMETER[\"False easting\",400000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8806]],\n        PARAMETER[\"False northing\",-100000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8807]]],\n    CS[Cartesian,2],\n        AXIS[\"(E)\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1]],\n        AXIS[\"(N)\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1]],\n    USAGE[\n        SCOPE[\"Engineering survey, topographic mapping.\"],\n        AREA[\"United Kingdom (UK) - offshore to boundary of UKCS within 49°45'N to 61°N and 9°W to 2°E; onshore Great Britain (England, Wales and Scotland). Isle of Man onshore.\"],\n        BBOX[49.75,-9.01,61.01,2.01]],\n    ID[\"EPSG\",27700]]",
                "projjson":{
                  "$schema":"https://proj.org/schemas/v0.7/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'N to 61°N and 9°W to 2°E; onshore Great Britain (England, Wales and Scotland). Isle of Man onshore.",
                  "bbox":{
                    "south_latitude":49.75,
                    "west_longitude":-9.01,
                    "north_latitude":61.01,
                    "east_longitude":2.01
                  },
                  "id":{
                    "authority":"EPSG",
                    "code":27700
                  }
                },
                "dataAxisToSRSAxisMapping":[
                  1,
                  2
                ]
              }
            }
          ],
          "featureCount":10,
          "fidColumnName":"fid",
          "fields":[
            {
              "name":"AREA",
              "type":"Real",
              "nullable":true,
              "uniqueConstraint":false
            },
            {
              "name":"EAS_ID",
              "type":"Integer64",
              "nullable":true,
              "uniqueConstraint":false
            },
            {
              "name":"PRFEDEA",
              "type":"String",
              "width":16,
              "nullable":true,
              "uniqueConstraint":false
            }
          ]
        }
      ],
      "metadata":{
      },
      "domains":{
      },
      "relationships":{
      }
    }

  Example 3: List all layers in a dataset using jq

    gdal vector info av_2056.gpkg --format json | jq ".layers[].name"

  Example 4: List all layers and their geometry fields using jq
Bash

    $ gdal vector info counties-albers-10m.gpkg --output-format=JSON | jq -r '
      .layers[]
      | .name as $layer
      | .geometryFields[]?
      | "\($layer): \(.name) (\(.type))"'
PowerShell

    gdal vector info counties-albers-10m.gpkg --output-format=JSON | jq -r '
      .layers[]
      | .name as $layer
      | .geometryFields[]?
      | \"\($layer): \(.name) (\(.type))\"'

returns:

    counties: geom (Geometry)
    states: geom (MultiPolygon)
    nation: geom (MultiPolygon)

AUTHOR
Even Rouault <even.rouault@spatialys.com>

COPYRIGHT
1998-2026