GDAL-VECTOR-CREATE(1)

NAME
gdal-vector-create - Create a vector dataset

Added in version 3.13.

SYNOPSIS

            Usage: gdal vector create [OPTIONS] <OUTPUT>

            Create a vector dataset.

            Positional arguments:
              -o, --output <OUTPUT>                                Output vector dataset [required] [not available in pipelines]

            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:
              -i, --like, --input <TEMPLATE-DATASET>               Input vector datasets [not available in pipelines]
                                                                   Mutually exclusive with --schema, --field
              -l, --layer, --input-layer <INPUT-LAYER>             Input layer name(s) [may be repeated] [not available in pipelines]
              -f, --of, --format, --output-format <OUTPUT-FORMAT>  Output format ("GDALG" allowed) [not available in pipelines]
              --co, --creation-option <KEY>=<VALUE>                Creation option [may be repeated] [not available in pipelines]
              --lco, --layer-creation-option <KEY>=<VALUE>         Layer creation option [may be repeated] [not available in pipelines]
              --overwrite                                          Whether overwriting existing output dataset is allowed [not available in pipelines]
              --update                                             Whether to open existing dataset in update mode [not available in pipelines]
              --overwrite-layer                                    Whether overwriting existing output layer is allowed [not available in pipelines]
              --output-layer <OUTPUT-LAYER>                        Output layer name [not available in pipelines]
              --geometry-type <GEOMETRY-TYPE>                      Layer geometry type
              --geometry-field <GEOMETRY-FIELD>                    Name of the geometry field to create (if supported by the output format) (default: geom)
              --crs <CRS>                                          Set CRS
              --fid <FID>                                          FID column name
              --schema <SCHEMA_JSON>                               Read OGR_SCHEMA and populate field definitions from it
                                                                   Mutually exclusive with --input, --field
              --field <NAME>:<TYPE>[(,<WIDTH>[,<PRECISION>])]>     Add a field definition to the output layer [may be repeated]
                                                                   Mutually exclusive with --input, --schema

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

DESCRIPTION

gdal vector create creates one or more vector layers, creating the dataset if it doesn't exist or adding layers to an existing dataset if the underlying format supports it.

The layer fields, geometry type and coordinate reference system can be defined either by providing an existing dataset or an OGR_SCHEMA file/JSON as a template, or by explicitly specifying the various components.

gdal vector create can be used as the first step of a pipeline.

The following options are available:

PROGRAM-SPECIFIC OPTIONS

    --output-layer <OUTPUT-LAYER>
        Output layer name.

        Only meaningful when creating a single layer dataset. It allows defining or overriding the name of the created layer.

    -i, --like, --input <TEMPLATE-DATASET>
        Vector dataset to use as a template for the created dataset.

        If the template dataset contains multiple layers and the destination format does not support multiple layers the program will exit with an error unless --input-layer is used to specify which single layer from the input dataset should be used as a template.

        Mutually exclusive with --schema and with --field, --geometry-type, --geometry-field and --crs.

    --layer, --input-layer <INPUT-LAYER>
        Layer(s) of the input dataset to use as a template for the created layer.

        This option can be repeated multiple times to specify multiple layers.

        This option is only meaningful when --like or --schema are used with an input dataset containing multiple layers.

    --schema <OGR_SCHEMA>
        File or JSON string containing the OGR_SCHEMA of the layer to create.

        This can be a filename, a URL or JSON string conformant with the ogr_fields_override.schema.json schema

        If the OGR_SCHEMA contains multiple layers and the destination format does not support multiple layers the program will exit with an error unless --input-layer is used to specify which single layer from the OGR_SCHEMA should be selected.

        Mutually exclusive with --like and with --field, --geometry-type, --geometry-field and --crs.

    --crs <CRS>
        Defines the coordinate reference system of the created layer.

        The coordinate reference systems that can be passed are anything supported by the OGRSpatialReference::SetFromUserInput() call, which includes EPSG Projected, Geographic or Compound CRS (i.e. EPSG:4296), a well known text (WKT) CRS definition, PROJ.4 declarations, or the name of a .prj file containing a WKT CRS definition.

        Mutually exclusive with --schema and with --like.

    --geometry-field <GEOMETRY-FIELD>
        Name of the geometry field to create (if supported by the output format) (default: geom).

    --geometry-type <GEOMETRY-TYPE>
        Defines the geometry type of the created layer.

        Layer geometry type to be one of GEOMETRY, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CURVE, CIRCULARSTRING, COMPOUNDCURVE, SURFACE, CURVEPOLYGON, MULTICURVE, MULTISURFACE, POLYHEDRALSURFACE or TIN. Z, M or ZM suffixes can be appended to the above values to indicate the dimensionality.

        Mutually exclusive with --schema and with --like.

    --field <NAME>:<TYPE>[(,<WIDTH>[,<PRECISION>])]
        Defines a field to be created in the layer.

        This option can be repeated multiple times to create multiple fields.

        The field type can be one of INTEGER, INTEGER64, REAL, STRING, DATE, TIME, DATETIME, BINARY, INTEGERLIST, REALLIST, STRINGLIST, INTEGER64LIST.

        The width and precision can be specified for INTEGER, INTEGER64, REAL and STRING field types. For example, --field population:INTEGER(10,5) or --field name:STRING(255)

        Mutually exclusive with --schema and with --like.

    --fid <FID>
        Defines the name of the Feature Identifier (FID) column, for drivers that support setting it (those which declare a FID layer creation option)

        Mutually exclusive with --schema and with --like.

STANDARD OPTIONS

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

        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: Create a POINT layer named names with a string field named name in a new vector dataset

            gdal vector create --geometry-type point  --crs EPSG:4326 --field name:string --output-layer names points.gpkg

  Example 2: Add a POINT layer named names2 with a string field named name to an existing vector dataset

            gdal vector create --update --geometry-type point --crs EPSG:4326 --field name:string --output-layer names2 points.gpkg

  Example 3: Create a new vector dataset with a layer named countries_new based on the layer countries of an existing dataset

            gdal vector create --like ../data/poly.gpkg --input-layer poly --output-layer areas_new areas.gpkg

AUTHOR
Alessandro Pasotti <elpaso@itopen.it>

COPYRIGHT
1998-2026