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