LinuxCommandLibrary

gdalwarp

image mosaicing, reprojection, and warping utility

TLDR

Reproject a raster to a different coordinate system

$ gdalwarp -t_srs [EPSG:4326] [input.tif] [output.tif]
copy
Reproject with source and target coordinate systems
$ gdalwarp -s_srs [EPSG:32611] -t_srs [EPSG:4326] [input.tif] [output.tif]
copy
Change resolution while reprojecting
$ gdalwarp -tr [0.001] [0.001] -t_srs [EPSG:4326] [input.tif] [output.tif]
copy
Use bilinear resampling method
$ gdalwarp -r bilinear -t_srs [EPSG:4326] [input.tif] [output.tif]
copy
Mosaic multiple rasters into one output
$ gdalwarp [input1.tif] [input2.tif] [input3.tif] [output.tif]
copy
Clip raster using a shapefile cutline
$ gdalwarp -cutline [boundary.shp] -crop_to_cutline [input.tif] [output.tif]
copy
Specify output format and data type
$ gdalwarp -of GTiff -ot Float32 -t_srs [EPSG:4326] [input.tif] [output.tif]
copy

SYNOPSIS

gdalwarp [OPTIONS] SRCFILE... DSTFILE

DESCRIPTION

gdalwarp is an image mosaicing, reprojection, and warping utility from the GDAL library. It transforms raster datasets between coordinate reference systems, resamples to different resolutions, mosaics multiple inputs into a single output, and clips rasters using vector boundaries.
The utility supports all GDAL raster formats and can apply ground control points (GCPs) stored with images. Various resampling algorithms are available, from fast nearest-neighbor to high-quality Lanczos windowed sinc interpolation.
gdalwarp is essential for GIS workflows requiring coordinate system transformations, data integration from multiple sources, or preparing raster data for specific analysis requirements.

PARAMETERS

-s_srs SRS

Source spatial reference system (EPSG code, PROJ.4, or WKT).
-t_srs SRS
Target spatial reference system for output.
-r METHOD
Resampling method: near, bilinear, cubic, cubicspline, lanczos, average, mode, max, min, med, q1, q3, sum.
-tr XRES YRES
Target resolution in georeferenced units.
-ts WIDTH HEIGHT
Target size in pixels.
-te XMIN YMIN XMAX YMAX
Target extent in georeferenced coordinates.
-of FORMAT
Output format (GTiff, PNG, JPEG, etc.).
-ot TYPE
Output band data type (Byte, UInt16, Float32, etc.).
-cutline FILE
Vector file for clipping (shapefile, GeoJSON, etc.).
-crop_to_cutline
Crop output extent to cutline boundary.
-overwrite
Overwrite existing output file.
-multi
Use multithreaded warping.
-co NAME=VALUE
Creation option for output format.

CAVEATS

Large rasters may require significant memory; use -wm to limit memory usage. Reprojection can introduce artifacts at high compression or with inappropriate resampling methods. Source coordinate system must be defined or specified with -s_srs. NoData values should be handled explicitly with -srcnodata and -dstnodata.

HISTORY

gdalwarp is part of GDAL (Geospatial Data Abstraction Library), originally developed by Frank Warmerdam starting in 1998. GDAL became an OSGeo project and has grown into the fundamental library for geospatial raster operations, used by virtually all GIS software including QGIS, ArcGIS, and countless specialized tools.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community