1GDALWARP(1)                          GDAL                          GDALWARP(1)
2
3
4

NAME

6       gdalwarp - Image reprojection and warping utility.
7

SYNOPSIS

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              [-if format]* [-of format] [-co "NAME=VALUE"]* [-overwrite]
22              [-nomd] [-cvmd meta_conflict_value] [-setci] [-oo NAME=VALUE]*
23              [-doo NAME=VALUE]*
24              srcfile* dstfile
25

DESCRIPTION

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

EXAMPLES

370       • Basic transformation:
371
372          gdalwarp -t_srs EPSG:4326 input.tif output.tif
373
374       • For  instance, an eight bit spot scene stored in GeoTIFF with control
375         points mapping the corners to lat/long could be warped to a UTM  pro‐
376         jection with a command like this:
377
378          gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' -overwrite raw_spot.tif utm11.tif
379
380       • For instance, the second channel of an ASTER image stored in HDF with
381         control points mapping the corners to lat/long could be warped  to  a
382         UTM projection with a command like this:
383            New in version 2.2.
384
385
386          gdalwarp -overwrite HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-2002031402_100_001_2.tif
387
388       • To  apply  a  cutline on a un-georeferenced image and clip from pixel
389         (220,60) to pixel (1160,690):
390
391          gdalwarp -overwrite -to SRC_METHOD=NO_GEOTRANSFORM -to DST_METHOD=NO_GEOTRANSFORM -te 220 60 1160 690 -cutline cutline.csv in.png out.tif
392
393       where cutline.csv content is like:
394
395          id,WKT
396          1,"POLYGON((....))"
397
398       • To transform a DEM from geoid elevations (using EGM96) to  WGS84  el‐
399         lipsoidal heights:
400            New in version 2.2.
401
402
403          gdalwarp -overwrite in_dem.tif out_dem.tif -s_srs EPSG:4326+5773 -t_srs EPSG:4979
404

SEE ALSO

406       Wiki page discussing options and behaviours of gdalwarp
407

AUTHOR

409       Frank  Warmerdam  <warmerdam@pobox.com>,  Silke  Reimer  <silke@inteva‐
410       tion.de>
411
413       1998-2021
414
415
416
417
418                                 Sep 07, 2021                      GDALWARP(1)
Impressum