table of contents
- testing 3.12.3+dfsg-1
- unstable 3.12.3+dfsg-1
- experimental 3.13.0+dfsg-1~exp1
| GDAL-RASTER-CREATE(1) | GDAL | GDAL-RASTER-CREATE(1) |
NAME¶
gdal-raster-create - Create a new raster dataset
Added in version 3.11.
SYNOPSIS¶
Usage: gdal raster create [OPTIONS] <OUTPUT> Create a new raster dataset. Positional arguments:
-o, --output <OUTPUT> Output raster 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]
-q, --quiet Quiet mode (no progress bar or warning message) [not available in pipelines] Options:
-i, --like, --input <TEMPLATE-DATASET> Template raster dataset [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]
--overwrite Whether overwriting existing output dataset is allowed [not available in pipelines]
Mutually exclusive with --append
--append Append as a subdataset to existing output [not available in pipelines]
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=UInt8|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
Depends on --input
--copy-overviews Create same overview levels as input dataset
Depends on --input 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]
DESCRIPTION¶
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.
Since GDAL 3.13, create can also be used as a step of gdal raster pipeline.
PROGRAM-SPECIFIC OPTIONS¶
- --band-count <count>
- Number of bands. Defaults to 1.
- --bbox <xmin>,<ymin>,<xmax>,ymax>
- 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.
- --burn <value>
- 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.
- --copy-metadata
- Copy metadata from input dataset and raster bands. Requires --like to be specified.
- --copy-overviews
- Create same overview levels as input dataset (but with empty content). Requires --like to be specified.
- --crs <CRS>
- 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.
- -i, --like, --input <TEMPLATE-DATASET>
- 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.
Since GDAL 3.13, if the input dataset is tiled, and for output formats GTiff, COG and GPKG, its tile dimensions are replicated to the output file, when they are compatible of its capabilities, and if the user hasn't specified any creation option related to tiling.
- --metadata <KEY>=<VALUE>
- Adds a metadata item, at the dataset level.
- --nodata <value>
- 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.
- --size <xsize>,<ysize>
- Set the size of the output file in pixels. First value is width. Second one is height.
STANDARD OPTIONS¶
- --append
- Append input raster as a new subdataset to an existing output file. Only works with drivers that support adding subdatasets such as GTiff -- GeoTIFF File Format and GPKG -- GeoPackage raster This also creates the output dataset if it does not exist yet.
- --co, --creation-option <NAME>=<VALUE>
- 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.
- --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.
- --oo, --open-option <NAME>=<VALUE>
- Dataset open option (format specific).
May be repeated.
- --ot, --datatype, --output-data-type <OUTPUT-DATA-TYPE>
- Output data type among Byte, Int8, UInt16, Int16, UInt32, Int32, UInt64, Int64, CInt16, CInt32, Float32, Float64, CFloat32, CFloat64.
- -f, --of, --format, --output-format <OUTPUT-FORMAT>
- Which output raster format to use. Allowed values may be given by gdal --formats | grep raster | grep + | sort
- --overwrite
- Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists.
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: Initialize a new GeoTIFF file with 3 bands and a uniform value of 10¶
gdal raster create --size=20,20 --band-count=3 --crs=EPSG:4326 --bbox=2,49,3,50 --burn 10 out.tif
Example 2: Create a PDF file from a XML composition file¶
gdal raster create --creation-option COMPOSITION_FILE=composition.xml out.pdf
Example 3: Initialize a blank GeoTIFF file from an input one¶
gdal raster create --like prototype.tif output.tif
AUTHOR¶
Even Rouault <even.rouault@spatialys.com>
COPYRIGHT¶
1998-2026
| May 8, 2026 |