1GDAL_MERGE(1) GDAL GDAL_MERGE(1)
2
3
4
6 gdal_merge - Mosaics a set of images.
7
9 gdal_merge.py [-o out_filename] [-of out_format] [-co NAME=VALUE]*
10 [-ps pixelsize_x pixelsize_y] [-tap] [-separate] [-q] [-v] [-pct]
11 [-ul_lr ulx uly lrx lry] [-init "value [value...]"]
12 [-n nodata_value] [-a_nodata output_nodata_value]
13 [-ot datatype] [-createonly] input_files
14
16 This utility will automatically mosaic a set of images. All the images
17 must be in the same coordinate system and have a matching number of
18 bands, but they may be overlapping, and at different resolutions. In
19 areas of overlap, the last image will be copied over earlier ones. No‐
20 data/transparency values are considered on a band by band level, i.e. a
21 nodata/transparent pixel on one source band will not set a no‐
22 data/transparent value on all bands for the target pixel in the result‐
23 ing raster nor will it overwrite a valid pixel value.
24
25 -o <out_filename>
26 The name of the output file, which will be created if it does
27 not already exist (defaults to "out.tif").
28
29 -of <format>
30 Select the output format. Starting with GDAL 2.3, if not speci‐
31 fied, the format is guessed from the extension (previously was
32 GTiff). Use the short format name.
33
34 -co <NAME=VALUE>
35 Many formats have one or more optional creation options that can
36 be used to control particulars about the file created. For in‐
37 stance, the GeoTIFF driver supports creation options to control
38 compression, and whether the file should be tiled.
39
40 The creation options available vary by format driver, and some
41 simple formats have no creation options at all. A list of op‐
42 tions supported for a format can be listed with the --formats
43 command line option but the documentation for the format is the
44 definitive source of information on driver creation options.
45 See Raster drivers format specific documentation for legal cre‐
46 ation options for each format.
47
48 -ot <type>
49 Force the output image bands to have a specific data type sup‐
50 ported by the driver, which may be one of the following: Byte,
51 UInt16, Int16, UInt32, Int32, Float32, Float64, CInt16, CInt32,
52 CFloat32 or CFloat64.
53
54 -ps <pixelsize_x> <pixelsize_y>
55 Pixel size to be used for the output file. If not specified the
56 resolution of the first input file will be used.
57
58 -tap (target aligned pixels) align the coordinates of the extent of
59 the output file to the values of the -tr, such that the aligned
60 extent includes the minimum extent. Alignment means that xmin /
61 resx, ymin / resy, xmax / resx and ymax / resy are integer val‐
62 ues.
63
64 -ul_lr <ulx> <uly> <lrx> <lry>
65 The extents of the output file. If not specified the aggregate
66 extents of all input files will be used.
67
68 -v Generate verbose output of mosaicing operations as they are
69 done.
70
71 -separate
72 Place each input file into a separate band.
73
74 -pct Grab a pseudo-color table from the first input image, and use it
75 for the output. Merging pseudo-colored images this way assumes
76 that all input files use the same color table.
77
78 -n <nodata_value>
79 Ignore pixels from files being merged in with this pixel value.
80
81 -a_nodata <output_nodata_value>
82 Assign a specified nodata value to output bands.
83
84 -init <"value(s)">
85 Pre-initialize the output image bands with these values. How‐
86 ever, it is not marked as the nodata value in the output file.
87 If only one value is given, the same value is used in all the
88 bands.
89
90 -createonly
91 The output file is created (and potentially pre-initialized) but
92 no input image data is copied into it.
93
94 NOTE:
95 gdal_merge.py is a Python script, and will only work if GDAL was
96 built with Python support.
97
99 Create an image with the pixels in all bands initialized to 255.
100
101 gdal_merge.py -init 255 -o out.tif in1.tif in2.tif
102
103 Create an RGB image that shows blue in pixels with no data. The first
104 two bands will be initialized to 0 and the third band will be initial‐
105 ized to 255.
106
107 gdal_merge.py -init "0 0 255" -o out.tif in1.tif in2.tif
108
110 Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@inteva‐
111 tion.de>
112
114 1998-2022
115
116
117
118
119 Sep 02, 2022 GDAL_MERGE(1)