GDAL-RASTER-CREATE(1) GDAL GDAL-RASTER-CREATE(1)

gdal-raster-create - Create a new raster dataset

Added in version 3.11.

Usage: gdal raster create [OPTIONS] <OUTPUT>
Create a new raster dataset.
Positional arguments:
  -o, --output <OUTPUT>                                    Output raster dataset (created by algorithm) [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]
  --progress                                               Display progress bar
Options:
  -f, --of, --format, --output-format <OUTPUT-FORMAT>      Output format
  -i, --like, --input <INPUT>                              Input raster dataset
  --co, --creation-option <KEY>=<VALUE>                    Creation option [may be repeated]
  --overwrite                                              Whether overwriting existing output is allowed
                                                           Mutually exclusive with --append
  --append                                                 Append as a subdataset to existing output
                                                           Mutually exclusive with --overwrite
  --size <width>,<height>                                  Output size in pixels
  --band-count <BAND-COUNT>                                Number of bands (default: 1)
  --ot, --datatype, --output-data-type <OUTPUT-DATA-TYPE>  Output data type. OUTPUT-DATA-TYPE=Byte|Int8|UInt16|Int16|UInt32|Int32|UInt64|Int64|CInt16|CInt32|Float16|Float32|Float64|CFloat32|CFloat64 (default: Byte)
  --nodata <NODATA>                                        Assign a specified nodata value to output bands ('none', numeric value, 'nan', 'inf', '-inf')
  --burn <BURN>                                            Burn value [may be repeated]
  --crs <CRS>                                              Set CRS
  --bbox <BBOX>                                            Bounding box as xmin,ymin,xmax,ymax
  --metadata <KEY>=<VALUE>                                 Add metadata item [may be repeated]
  --copy-metadata                                          Copy metadata from input dataset
  --copy-overviews                                         Create same overview levels as input dataset
Advanced Options:
  --oo, --open-option <KEY>=<VALUE>                        Open options [may be repeated]
  --if, --input-format <INPUT-FORMAT>                      Input formats [may be repeated]

gdal raster create can be used to initialize a new raster file, from its dimensions, band count, CRS, geotransform, nodata value and metadata.

The new file can also be initialized from a model input file with the optional --like option, copying its properties but not its pixel values. By default, metadata and the overview structure are not copied from the model input file, unless --copy-metadata and --copy-overviews are specified. Options --size, --band-count, --datatype, --nodata, --crs, --bbox, --metadata can be used to override the values inherited from the model input file.

For GeoTIFF output, setting the SPARSE_OK creation option to YES can be useful to create a file of minimum size.`

gdal raster create can be used also in special cases, like creating a PDF file from a XML composition file.

Name of GDAL input dataset that serves as a template for default values of options --size, --band-count, --datatype, --crs, --bbox and --nodata. Note that the pixel values will not be copied.
Many formats have one or more optional creation options that can be used to control particulars about the file created. For instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled.

May be repeated.

The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers format specific documentation for legal creation options for each format.

Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists.
Append the new raster as a new subdataset to existing output file. Only works with drivers that support adding subdatasets such as GTiff -- GeoTIFF File Format and GPKG -- GeoPackage raster
Set the size of the output file in pixels. First value is width. Second one is height.
Number of bands. Defaults to 1.
Output data type among Byte, Int8, UInt16, Int16, UInt32, Int32, UInt64, Int64, CInt16, CInt32, Float32, Float64, CFloat32, CFloat64.
Sets the nodata value.

null or none can be specified to unset the existing nodata value of the --like dataset if it is set. nan, inf or -inf are also accepted for floating point rasters to respectively mean the special values not-a-number, positive infinity and minus infinity.

A fixed value to burn into a band. A list of --burn options can be supplied, one per band (the first value will apply to the first band, the second one to the second band, etc.). If a single value is specified, it will apply to all bands.
Set CRS.

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.

null or none can be specified to unset the existing CRS of the --like dataset if it is set.

Note that the spatial extent is also left unchanged.

Sets the spatial bounding box, in CRS units. 'x' is longitude values for geographic CRS and easting for projected CRS. 'y' is latitude values for geographic CRS and northing for projected CRS.
Adds a metadata item, at the dataset level.
Copy metadata from input dataset and raster bands. Requires --like to be specified.
Create same overview levels as input dataset (but with empty content). Requires --like to be specified.

gdal raster create --size=20,20 --band-count=3 --crs=EPSG:4326 --bbox=2,49,3,50 --burn 10 out.tif

gdal raster create --creation-option COMPOSITION_FILE=composition.xml out.pdf

gdal raster create --like prototype.tif output.tif

Even Rouault <even.rouault@spatialys.com>

1998-2025

May 6, 2025