Linux command
gdalwarp 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Reproject a raster
gdalwarp -t_srs [EPSG:4326] [input.tif] [output.tif]
Reproject with source and target
gdalwarp -s_srs [EPSG:32611] -t_srs [EPSG:4326] [input.tif] [output.tif]
Change resolution
gdalwarp -tr [0.001] [0.001] -t_srs [EPSG:4326] [input.tif] [output.tif]
Use bilinear resampling
gdalwarp -r bilinear -t_srs [EPSG:4326] [input.tif] [output.tif]
Mosaic multiple rasters
gdalwarp [input1.tif] [input2.tif] [input3.tif] [output.tif]
Clip raster using a shapefile
gdalwarp -cutline [boundary.shp] -crop_to_cutline [input.tif] [output.tif]
Specify output format
gdalwarp -of GTiff -ot Float32 -t_srs [EPSG:4326] [input.tif] [output.tif]
说明
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.
参数
- -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.
FAQ
What is the gdalwarp command used for?
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.
How do I run a basic gdalwarp example?
Run `gdalwarp -t_srs [EPSG:4326] [input.tif] [output.tif]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s_srs _SRS_ do in gdalwarp?
Source spatial reference system (EPSG code, PROJ.4, or WKT).