.\" 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 "GDAL-VECTOR-EXPORT-SCHEMA" "1" "Aug 18, 2026" "" "GDAL"
.SH NAME
gdal-vector-export-schema \- Export the OGR_SCHEMA from a vector dataset
.sp
Added in version 3.13.
.SH SYNOPSIS
.INDENT 0.0
.INDENT 3.5
.sp
.EX
Usage: gdal vector export\-schema [OPTIONS] ...
Export the OGR_SCHEMA from a vector dataset.
Positional arguments:
\-i, \-\-dataset, \-\-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 = Configuration option [may be repeated]
Options:
\-l, \-\-layer, \-\-input\-layer Input layer name [may be repeated]
Advanced Options:
\-\-oo, \-\-open\-option = Open options [may be repeated]
\-\-if, \-\-input\-format Input formats [may be repeated]
.EE
.UNINDENT
.UNINDENT
.SH DESCRIPTION
.sp
\fBgdal vector export\-schema\fP exports the \fBOGR_SCHEMA\fP from a GDAL\-supported
vector dataset, and returns it on the standard output stream when used from the
command line, or in the \fBoutput\fP parameter when used from the API.
.sp
\fBOGR_SCHEMA\fP is a JSON object describing the structure of a vector dataset
according to the schema definition at \X'tty: link https://github.com/OSGeo/gdal/blob/release/3.13/ogr/data/ogr_fields_override.schema.json'\fI\%ogr_fields_override.schema.json\fP\X'tty: link'
.sp
\fBgdal vector export\-schema\fP can be used as the last
step of a pipeline.
.sp
The following options are available:
.SH PROGRAM-SPECIFIC OPTIONS
.INDENT 0.0
.TP
.B \-l, \-\-layer, \-\-input\-layer
Name of one or more layers to inspect. If no layer names are passed,
then all layers will be selected.
.UNINDENT
.SH STANDARD OPTIONS
.INDENT 0.0
.TP
.B \-\-oo, \-\-open\-option =
Dataset open option (format specific).
.sp
May be repeated.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-if, \-\-input\-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
May be repeated.
.UNINDENT
.SH RETURN STATUS CODE
.sp
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).
.SH EXAMPLES
.SS Example 1: Extracting the OGR_SCHEMA from the file poly.gpkg
.INDENT 0.0
.INDENT 3.5
.sp
.EX
gdal vector export\-schema poly.gpkg
.EE
.UNINDENT
.UNINDENT
.SS Example 2: Save the OGR_SCHEMA to a file
.sp
When using Windows PowerShell 5.1, redirecting output with \fB>\fP or \fBOut\-File \-Encoding utf8\fP
produces UTF\-8 with a BOM (Byte Order Mark). When using the schema with \fI\%gdal vector create\fP
it may fail with \fBERROR 1: JSON parsing error: unexpected character (at offset 0)\fP\&.
.sp
In PowerShell 5.1, use \fB\-Encoding ascii\fP for JSON output that contains no non\-ASCII characters.
Bash
.INDENT 0.0
.INDENT 3.5
.sp
.EX
gdal vector export\-schema natural_earth_vector.gpkg \-\-layer \(dqne_50m_admin_0_countries\(dq > countries.json
.EE
.UNINDENT
.UNINDENT
PowerShell
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# PowerShell 5.1
gdal vector export\-schema natural_earth_vector.gpkg \-\-layer \(dqne_50m_admin_0_countries\(dq | Out\-File countries.json \-Encoding ascii
# PowerShell 7+
gdal vector export\-schema natural_earth_vector.gpkg \-\-layer \(dqne_50m_admin_0_countries\(dq | Out\-File countries.json \-Encoding utf8
.EE
.UNINDENT
.UNINDENT
.SS Example 3: Validate an OGR_SCHEMA file using Python
.sp
Validate against the latest version of the schema definition at \X'tty: link https://github.com/OSGeo/gdal/blob/release/3.13/ogr/data/ogr_fields_override.schema.json'\fI\%ogr_fields_override.schema.json\fP\X'tty: link'
using the Python package \X'tty: link https://pypi.org/project/check-jsonschema/'\fI\%check\-jsonschema\fP\X'tty: link' available on PyPI.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
$ pip install check\-jsonschema
$ check\-jsonschema \-\-schemafile https://raw.githubusercontent.com/OSGeo/gdal/master/ogr/data/ogr_fields_override.schema.json countries.json \-\-verbose
.EE
.UNINDENT
.UNINDENT
.SS Example 4: Create an OGR_SCHEMA at the end of a pipeline
.sp
This example renames the field \fBpop_est\fP to \fBestimated_population\fP and changes its
type from \fBReal\fP to \fBInteger\fP, before exporting the resulting OGR_SCHEMA.
Bash
.INDENT 0.0
.INDENT 3.5
.sp
.EX
gdal vector pipeline \e
! read natural_earth_vector.gpkg \-\-layer ne_50m_admin_0_countries \e
! sql \-\-sql \(dqSELECT geom,name,abbrev,pop_est AS estimated_population FROM ne_50m_admin_0_countries\(dq \-\-output\-layer \(dqcountries\(dq \e
! set\-field\-type \-\-field\-name \(dqestimated_population\(dq \-\-field\-type Integer \e
! export\-schema
.EE
.UNINDENT
.UNINDENT
PowerShell
.INDENT 0.0
.INDENT 3.5
.sp
.EX
gdal vector pipeline \(ga
! read natural_earth_vector.gpkg \-\-layer ne_50m_admin_0_countries \(ga
! sql \-\-sql \(dqSELECT geom,name,abbrev,pop_est AS estimated_population FROM ne_50m_admin_0_countries\(dq \-\-output\-layer \(dqcountries\(dq \(ga
! set\-field\-type \-\-field\-name \(dqestimated_population\(dq \-\-field\-type Integer \(ga
! export\-schema
.EE
.UNINDENT
.UNINDENT
.SH AUTHOR
Alessandro Pasotti
.SH COPYRIGHT
1998-2026
.\" Generated by docutils manpage writer.
.