"gdal vector info" sub-command

Added in version 3.11.

Get information on a vector dataset.

Synopsis

Usage: gdal vector info [OPTIONS] <INPUT>

Return information on a vector dataset.

Positional arguments:
  -i, --dataset, --input <INPUT>                       Input vector dataset [required]

Common Options:
  -h, --help                                           Display help message and exit
  --version                                            Display GDAL version and exit
  --json-usage                                         Display usage as JSON document and exit
  --drivers                                            Display driver list 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 (default: json)
  -l, --layer <LAYER>                                  Layer name [may be repeated]
                                                       Mutually exclusive with --sql
  --features                                           List all features (beware of RAM consumption on large layers)
  --sql <statement>|@<filename>                        Execute the indicated SQL statement and return the result
                                                       Mutually exclusive with --layer
  --where <WHERE>|@<filename>                          Attribute query in a restricted form of the queries used in the SQL WHERE statement
  --dialect <DIALECT>                                  SQL dialect
  --update                                             Open the dataset in update mode

Advanced Options:
  --oo, --open-option <KEY=VALUE>                      Open options [may be repeated]
  --if, --input-format <INPUT-FORMAT>                  Input formats [may be repeated]

Description

gdal vector info lists various information about a GDAL supported vector dataset.

The following options are available:

Standard options

-f, --of, --format, --output-format json|text

Which output format to use. Default is JSON.

-l, --layer <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.

--features

List all features. Beware of RAM consumption on large layers when using JSON output.

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

--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'"
--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.

Advanced options

--oo <NAME>=<VALUE>

Dataset open option (format specific).

May be repeated.

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

May be repeated.

Examples

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

$ gdal vector info --format=text --features poly.gpkg