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