image reprojection and warping utility
gdalwarp [--help-general] [--formats]
[-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
[-order n | -tps | -rpc | -geoloc] [-et err_threshold]
[-refine_gcps tolerance [minimum_gcps]]
[-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
[-ovr level|AUTO|AUTO-n|NONE] [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
[-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
[-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
[-cutline datasource] [-cl layer] [-cwhere expression]
[-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
[-of format] [-co "NAME=VALUE"]* [-overwrite]
[-nomd] [-cvmd meta_conflict_value] [-setci] [-oo NAME=VALUE]*
The gdalwarp utility is an image mosaicing, reprojection and warping utility. The program can reproject to any supported projection, and can also apply GCPs stored with the image if the image is "raw" with control information.
- -s_srs srs def:
- source spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text.
- -t_srs srs_def:
- target spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text.
- -to NAME=VALUE:
- set a transformer option suitable to pass to GDALCreateGenImgProjTransformer2().
- -order n:
- order of polynomial used for warping (1 to 3). The default is to select a polynomial order based on the number of GCPs.
- Force use of thin plate spline transformer based on available GCPs.
- Force use of RPCs.
- Force use of Geolocation Arrays.
- -et err_threshold:
- error threshold for transformation approximation (in pixel units - defaults to 0.125).
- -refine_gcps tolerance minimum_gcps:
- (GDAL >= 1.9.0) refines the GCPs by automatically eliminating outliers. Outliers will be eliminated until minimum_gcps are left or when no outliers can be detected. The tolerance is passed to adjust when a GCP will be eliminated. Not that GCP refinement only works with polynomial interpolation. The tolerance is in pixel units if no projection is available, otherwise it is in SRS units. If minimum_gcps is not provided, the minimum GCPs according to the polynomial model is used.
- -te xmin ymin xmax ymax:
- set georeferenced extents of output file to be created (in target SRS).
- -tr xres yres:
- set output file resolution (in target georeferenced units)
- (GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent.
- -ts width height:
- set output file size in pixels and lines. If width or height is set to 0, the other dimension will be guessed from the computed resolution. Note that -ts cannot be used with -tr
- -ovr level|AUTO|AUTO-n|NONE>:
- (GDAL >= 2.0) To specify which overview level of source files must be used. The default choice, AUTO, will select the overview level whose resolution is the closest to the target resolution. Specify an integer value (0-based, i.e. 0=1st overview level) to select a particular level. Specify AUTO-n where n is an integer greater or equal to 1, to select an overview level below the AUTO one. Or specify NONE to force the base resolution to be used.
- -wo "NAME=VALUE":
- Set a warp option. The GDALWarpOptions::papszWarpOptions docs show all options. Multiple -wo options may be listed.
- -ot type:
- For the output bands to be of the indicated data type.
- -wt type:
- Working pixel data type. The data type of pixels in the source image and destination image buffers.
- -r resampling_method:
- Resampling method to use. Available methods are:
- nearest neighbour resampling (default, fastest algorithm, worst interpolation quality).
- bilinear resampling.
- cubic resampling.
- cubic spline resampling.
- Lanczos windowed sinc resampling.
- average resampling, computes the average of all non-NODATA contributing pixels. (GDAL >= 1.10.0)
- mode resampling, selects the value which appears most often of all the sampled points. (GDAL >= 1.10.0)
- maximum resampling, selects the maximum value from all non-NODATA contributing pixels. (GDAL >= 2.0.0)
- minimum resampling, selects the minimum value from all non-NODATA contributing pixels. (GDAL >= 2.0.0)
- median resampling, selects the median value of all non-NODATA contributing pixels. (GDAL >= 2.0.0)
- first quartile resampling, selects the first quartile value of all non-NODATA contributing pixels. (GDAL >= 2.0.0)
- third quartile resampling, selects the third quartile value of all non-NODATA contributing pixels. (GDAL >= 2.0.0)
- -srcnodata value [value...]:
- Set nodata masking values for input bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. Masked values will not be used in interpolation. Use a value of
None to ignore intrinsic nodata settings on the source dataset.
- -dstnodata value [value...]:
- Set nodata values for output bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. New files will be initialized to this value and if possible the nodata value will be recorded in the output file. Use a value of
None to ensure that nodata is not defined (GDAL>=1.11). If this argument is not used then nodata values will be copied from the source dataset (GDAL>=1.11).
- Create an output alpha band to identify nodata (unset/transparent) pixels.
- -wm memory_in_mb:
- Set the amount of memory (in megabytes) that the warp API is allowed to use for caching.
- Use multithreaded warping implementation. Multiple threads will be used to process chunks of image and perform input/output operation simultaneously.
- Be quiet.
- -of format:
- Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
- -co "NAME=VALUE":
passes a creation option to the output format driver. Multiple -co options may be listed. See format specific documentation for legal creation options for each format.
- -cutline datasource:
- Enable use of a blend cutline from the name OGR support datasource.
- -cl layername:
- Select the named layer from the cutline datasource.
- -cwhere expression:
- Restrict desired cutline features based on attribute query.
- -csql query:
- Select cutline features using an SQL query instead of from a layer with -cl.
- -cblend distance:
- Set a blend distance to use to blend over cutlines (in pixels).
- (GDAL >= 1.8.0) Crop the extent of the target dataset to the extent of the cutline.
- (GDAL >= 1.8.0) Overwrite the target dataset if it already exists.
- (GDAL >= 1.10.0) Do not copy metadata. Without this option, dataset and band metadata (as well as some band information) will be copied from the first source dataset. Items that differ between source datasets will be set to * (see -cvmd option).
- -cvmd meta_conflict_value:
- (GDAL >= 1.10.0) Value to set metadata items that conflict between source datasets (default is "*"). Use "" to remove conflicting items.
- (GDAL >= 1.10.0) Set the color interpretation of the bands of the target dataset from the source dataset.
- -oo NAME=VALUE:
(starting with GDAL 2.0) Dataset open option (format specific)
- The source file name(s).
- The destination file name.
Mosaicing into an existing output file is supported if the output file already exists. The spatial extent of the existing file will not be modified to accommodate new data, so you may have to remove it in that case, or use the -overwrite option.
Polygon cutlines may be used as a mask to restrict the area of the destination file that may be updated, including blending. If the OGR layer containing the cutline features has no explicit SRS, the cutline features must be in the SRS of the destination file. When outputing to a not yet existing target dataset, its extent will be the one of the original raster unless -te or -crop_to_cutline are specified.
For instance, an eight bit spot scene stored in GeoTIFF with control points mapping the corners to lat/long could be warped to a UTM projection with a command like this:
gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' raw_spot.tif utm11.tif
For instance, the second channel of an ASTER image stored in HDF with control points mapping the corners to lat/long could be warped to a UTM projection with a command like this:
gdalwarp HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-2002031402_100_001_2.tif
Wiki page discussing options and behaviours of gdalwarp