1GDALWARP(1) GDAL GDALWARP(1)
2
3
4
6 gdalwarp - Image reprojection and warping utility.
7
9 gdalwarp [--help-general] [--formats]
10 [-s_srs srs_def] [-t_srs srs_def] [-ct string] [-to "NAME=VALUE"]* [-novshiftgrid]
11 [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
12 [-refine_gcps tolerance [minimum_gcps]]
13 [-te xmin ymin xmax ymax] [-te_srs srs_def]
14 [-tr xres yres] [-tap] [-ts width height]
15 [-ovr level|AUTO|AUTO-n|NONE] [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
16 [-srcnodata "value [value...]"] [-dstnodata "value [value...]"]
17 [-srcalpha|-nosrcalpha] [-dstalpha]
18 [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
19 [-cutline datasource] [-cl layer] [-cwhere expression]
20 [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
21 [-of format] [-co "NAME=VALUE"]* [-overwrite]
22 [-nomd] [-cvmd meta_conflict_value] [-setci] [-oo NAME=VALUE]*
23 [-doo NAME=VALUE]*
24 srcfile* dstfile
25
27 The gdalwarp utility is an image mosaicing, reprojection and warping
28 utility. The program can reproject to any supported projection, and can
29 also apply GCPs stored with the image if the image is "raw" with con‐
30 trol information.
31
32 -s_srs <srs def>
33 Set source spatial reference.
34
35 The coordinate systems that can be passed are anything supported
36 by the OGRSpatialReference.SetFromUserInput() call, which
37 includes EPSG PCS and GCSes (i.e. EPSG:4296), PROJ.4 declara‐
38 tions (as above), or the name of a .prj file containing well
39 known text. Starting with GDAL 2.2, if the SRS has an explicit
40 vertical datum that points to a PROJ.4 geoidgrids, and the input
41 dataset is a single band dataset, a vertical correction will be
42 applied to the values of the dataset.
43
44 -t_srs <srs_def>
45 Set target spatial reference.
46
47 The coordinate systems that can be passed are anything supported
48 by the OGRSpatialReference.SetFromUserInput() call, which
49 includes EPSG PCS and GCSes (i.e. EPSG:4296), PROJ.4 declara‐
50 tions (as above), or the name of a .prj file containing well
51 known text. Starting with GDAL 2.2, if the SRS has an explicit
52 vertical datum that points to a PROJ.4 geoidgrids, and the input
53 dataset is a single band dataset, a vertical correction will be
54 applied to the values of the dataset.
55
56 -ct <string>
57 A PROJ string (single step operation or multiple step string
58 starting with +proj=pipeline), a WKT2 string describing a Coor‐
59 dinateOperation, or a urn:ogc:def:coordinateOperation:EPSG::XXXX
60 URN overriding the default transformation from the source to the
61 target CRS. It must take into account the axis order of the
62 source and target CRS.
63
64 New in version 3.0.
65
66
67 -to <NAME=VALUE>
68 Set a transformer option suitable to pass to GDALCreateGenImg‐
69 ProjTransformer2().
70
71 -novshiftgrid
72 Disable the use of vertical datum shift grids when one of the
73 source or target SRS has an explicit vertical datum, and the
74 input dataset is a single band dataset.
75
76 New in version 2.2.
77
78
79 -order <n>
80 order of polynomial used for warping (1 to 3). The default is to
81 select a polynomial order based on the number of GCPs.
82
83 -tps Force use of thin plate spline transformer based on available
84 GCPs.
85
86 -rpc Force use of RPCs.
87
88 -geoloc
89 Force use of Geolocation Arrays.
90
91 -et <err_threshold>
92 Error threshold for transformation approximation (in pixel units
93 - defaults to 0.125, unless, starting with GDAL 2.1, the RPC_DEM
94 warping option is specified, in which case, an exact trans‐
95 former, i.e. err_threshold=0, will be used).
96
97 -refine_gcps <tolerance minimum_gcps>
98 Refines the GCPs by automatically eliminating outliers. Out‐
99 liers will be eliminated until minimum_gcps are left or when no
100 outliers can be detected. The tolerance is passed to adjust
101 when a GCP will be eliminated. Not that GCP refinement only
102 works with polynomial interpolation. The tolerance is in pixel
103 units if no projection is available, otherwise it is in SRS
104 units. If minimum_gcps is not provided, the minimum GCPs
105 according to the polynomial model is used.
106
107 -te <xmin ymin xmax ymax>
108 Set georeferenced extents of output file to be created (in tar‐
109 get SRS by default, or in the SRS specified with -te_srs)
110
111 -te_srs <srs_def>
112 Specifies the SRS in which to interpret the coordinates given
113 with -te. The <srs_def> may be any of the usual GDAL/OGR forms,
114 complete WKT, PROJ.4, EPSG:n or a file containing the WKT. This
115 must not be confused with -t_srs which is the target SRS of the
116 output dataset. -te_srs is a convenience e.g. when knowing the
117 output coordinates in a geodetic long/lat SRS, but still wanting
118 a result in a projected coordinate system.
119
120 -tr <xres> <yres>
121 Set output file resolution (in target georeferenced units)
122
123 -tap (target aligned pixels) align the coordinates of the extent of
124 the output file to the values of the -tr, such that the aligned
125 extent includes the minimum extent.
126
127 -ts <width> <height>
128 Set output file size in pixels and lines. If width or height is
129 set to 0, the other dimension will be guessed from the computed
130 resolution. Note that -ts cannot be used with -tr
131
132 -ovr <level|AUTO|AUTO-n|NONE>
133 To specify which overview level of source files must be used.
134 The default choice, AUTO, will select the overview level whose
135 resolution is the closest to the target resolution. Specify an
136 integer value (0-based, i.e. 0=1st overview level) to select a
137 particular level. Specify AUTO-n where n is an integer greater
138 or equal to 1, to select an overview level below the AUTO one.
139 Or specify NONE to force the base resolution to be used (can be
140 useful if overviews have been generated with a low quality
141 resampling method, and the warping is done using a higher qual‐
142 ity resampling method).
143
144 -wo `"NAME=VALUE"`
145 Set a warp option. The GDALWarpOptions::papszWarpOptions docs
146 show all options. Multiple -wo options may be listed.
147
148 -ot <type>
149 Force the output image bands to have a specific type. Use type
150 names (i.e. Byte, Int16,...)
151
152 -wt <type>
153 Working pixel data type. The data type of pixels in the source
154 image and destination image buffers.
155
156 -r <resampling_method>
157 Resampling method to use. Available methods are:
158
159 near: nearest neighbour resampling (default, fastest algorithm,
160 worst interpolation quality).
161
162 bilinear: bilinear resampling.
163
164 cubic: cubic resampling.
165
166 cubicspline: cubic spline resampling.
167
168 lanczos: Lanczos windowed sinc resampling.
169
170 average: average resampling, computes the weighted average of
171 all non-NODATA contributing pixels.
172
173 mode: mode resampling, selects the value which appears most
174 often of all the sampled points.
175
176 max: maximum resampling, selects the maximum value from all
177 non-NODATA contributing pixels.
178
179 min: minimum resampling, selects the minimum value from all
180 non-NODATA contributing pixels.
181
182 med: median resampling, selects the median value of all
183 non-NODATA contributing pixels.
184
185 q1: first quartile resampling, selects the first quartile value
186 of all non-NODATA contributing pixels.
187
188 q3: third quartile resampling, selects the third quartile value
189 of all non-NODATA contributing pixels.
190
191 sum: compute the weighted sum of all non-NODATA contributing
192 pixels (since GDAL 3.1)
193
194 -srcnodata <value [value...]>
195 Set nodata masking values for input bands (different values can
196 be supplied for each band). If more than one value is supplied
197 all values should be quoted to keep them together as a single
198 operating system argument. Masked values will not be used in
199 interpolation. Use a value of None to ignore intrinsic nodata
200 settings on the source dataset.
201
202 -dstnodata <value [value...]>
203 Set nodata values for output bands (different values can be sup‐
204 plied for each band). If more than one value is supplied all
205 values should be quoted to keep them together as a single oper‐
206 ating system argument. New files will be initialized to this
207 value and if possible the nodata value will be recorded in the
208 output file. Use a value of None to ensure that nodata is not
209 defined. If this argument is not used then nodata values will
210 be copied from the source dataset.
211
212 -srcalpha
213 Force the last band of a source image to be considered as a
214 source alpha band.
215
216 -nosrcalpha
217 Prevent the alpha band of a source image to be considered as
218 such (it will be warped as a regular band)
219
220 New in version 2.2.
221
222
223 -dstalpha
224 Create an output alpha band to identify nodata (unset/transpar‐
225 ent) pixels.
226
227 -wm <memory_in_mb>
228 Set the amount of memory that the warp API is allowed to use for
229 caching. The value is interpreted as being in megabytes if the
230 value is less than 10000. For values >=10000, this is inter‐
231 preted as bytes.
232
233 -multi Use multithreaded warping implementation. Two threads will be
234 used to process chunks of image and perform input/output opera‐
235 tion simultaneously. Note that computation is not multithreaded
236 itself. To do that, you can use the -wo NUM_THREADS=val/ALL_CPUS
237 option, which can be combined with -multi
238
239 -q Be quiet.
240
241 -of <format>
242 Select the output format. Starting with GDAL 2.3, if not speci‐
243 fied, the format is guessed from the extension (previously was
244 GTiff). Use the short format name.
245
246 -co <NAME=VALUE>
247 Many formats have one or more optional creation options that can
248 be used to control particulars about the file created. For
249 instance, the GeoTIFF driver supports creation options to con‐
250 trol compression, and whether the file should be tiled.
251
252 The creation options available vary by format driver, and some
253 simple formats have no creation options at all. A list of
254 options supported for a format can be listed with the --formats
255 command line option but the documentation for the format is the
256 definitive source of information on driver creation options.
257 See raster_drivers format specific documentation for legal cre‐
258 ation options for each format.
259
260 -cutline <datasource>
261 Enable use of a blend cutline from the name OGR support data‐
262 source.
263
264 -cl <layername>
265 Select the named layer from the cutline datasource.
266
267 -cwhere <expression>
268 Restrict desired cutline features based on attribute query.
269
270 -csql <query>
271 Select cutline features using an SQL query instead of from a
272 layer with -cl.
273
274 -cblend <distance>
275 Set a blend distance to use to blend over cutlines (in pixels).
276
277 -crop_to_cutline
278 Crop the extent of the target dataset to the extent of the cut‐
279 line.
280
281 -overwrite
282 Overwrite the target dataset if it already exists.
283
284 -nomd Do not copy metadata. Without this option, dataset and band
285 metadata (as well as some band information) will be copied from
286 the first source dataset. Items that differ between source
287 datasets will be set to * (see -cvmd option).
288
289 -cvmd <meta_conflict_value>
290 Value to set metadata items that conflict between source
291 datasets (default is "*"). Use "" to remove conflicting items.
292
293 -setci Set the color interpretation of the bands of the target dataset
294 from the source dataset.
295
296 -oo <NAME=VALUE>
297 Dataset open option (format specific)
298
299 -doo <NAME=VALUE>
300 Output dataset open option (format specific)
301
302 New in version 2.1.
303
304
305 <srcfile>
306 The source file name(s).
307
308 <dstfile>
309 The destination file name.
310
311 Mosaicing into an existing output file is supported if the output file
312 already exists. The spatial extent of the existing file will not be
313 modified to accommodate new data, so you may have to remove it in that
314 case, or use the -overwrite option.
315
316 Polygon cutlines may be used as a mask to restrict the area of the des‐
317 tination file that may be updated, including blending. If the OGR
318 layer containing the cutline features has no explicit SRS, the cutline
319 features must be in the SRS of the destination file. When writing to a
320 not yet existing target dataset, its extent will be the one of the
321 original raster unless -te or -crop_to_cutline are specified.
322
323 When doing vertical shift adjustments, the transformer option -to
324 ERROR_ON_MISSING_VERT_SHIFT=YES can be used to error out as soon as a
325 vertical shift value is missing (instead of 0 being used).
326
327 Starting with GDAL 3.1, it is possible to use as output format a driver
328 that only supports the CreateCopy operation. This may internally imply
329 creation of a temporary file.
330
332 · Basic transformation:
333
334 gdalwarp -t_srs EPSG:4326 input.tif output.tif
335
336 · For instance, an eight bit spot scene stored in GeoTIFF with control
337 points mapping the corners to lat/long could be warped to a UTM pro‐
338 jection with a command like this:
339
340 gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' -overwrite raw_spot.tif utm11.tif
341
342 · For instance, the second channel of an ASTER image stored in HDF with
343 control points mapping the corners to lat/long could be warped to a
344 UTM projection with a command like this:
345 New in version 2.2.
346
347
348 gdalwarp -overwrite HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-2002031402_100_001_2.tif
349
350 · To apply a cutline on a un-georeferenced image and clip from pixel
351 (220,60) to pixel (1160,690):
352
353 gdalwarp -overwrite -to SRC_METHOD=NO_GEOTRANSFORM -to DST_METHOD=NO_GEOTRANSFORM -te 220 60 1160 690 -cutline cutline.csv in.png out.tif
354
355 where cutline.csv content is like:
356
357 id,WKT
358 1,"POLYGON((....))"
359
360 · To transform a DEM from geoid elevations (using EGM96) to WGS84
361 ellipsoidal heights:
362 New in version 2.2.
363
364
365 gdalwarp -overwrite in_dem.tif out_dem.tif -s_srs EPSG:4326+5773 -t_srs EPSG:4979
366
368 Wiki page discussing options and behaviours of gdalwarp
369
371 Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@inteva‐
372 tion.de>
373
375 1998-2021
376
377
378
379
380 Jan 05, 2021 GDALWARP(1)