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.
20
21 -o <out_filename>
22 The name of the output file, which will be created if it does
23 not already exist (defaults to "out.tif").
24
25 -of <format>
26 Select the output format. Starting with GDAL 2.3, if not speci‐
27 fied, the format is guessed from the extension (previously was
28 GTiff). Use the short format name.
29
30 -co <NAME=VALUE>
31 Many formats have one or more optional creation options that can
32 be used to control particulars about the file created. For
33 instance, the GeoTIFF driver supports creation options to con‐
34 trol compression, and whether the file should be tiled.
35
36 The creation options available vary by format driver, and some
37 simple formats have no creation options at all. A list of
38 options supported for a format can be listed with the --formats
39 command line option but the documentation for the format is the
40 definitive source of information on driver creation options.
41 See raster_drivers format specific documentation for legal cre‐
42 ation options for each format.
43
44 -ot <type>
45 Force the output image bands to have a specific type. Use type
46 names (i.e. Byte, Int16,...)
47
48 -ps <pixelsize_x> <pixelsize_y>
49 Pixel size to be used for the output file. If not specified the
50 resolution of the first input file will be used.
51
52 -tap (target aligned pixels) align the coordinates of the extent of
53 the output file to the values of the -tr, such that the aligned
54 extent includes the minimum extent.
55
56 -ul_lr <ulx> <uly> <lrx> <lry>
57 The extents of the output file. If not specified the aggregate
58 extents of all input files will be used.
59
60 -v Generate verbose output of mosaicing operations as they are
61 done.
62
63 -separate
64 Place each input file into a separate band.
65
66 -pct Grab a pseudo-color table from the first input image, and use it
67 for the output. Merging pseudo-colored images this way assumes
68 that all input files use the same color table.
69
70 -n <nodata_value>
71 Ignore pixels from files being merged in with this pixel value.
72
73 -a_nodata <output_nodata_value>
74 Assign a specified nodata value to output bands.
75
76 -init <"value(s)">
77 Pre-initialize the output image bands with these values. How‐
78 ever, it is not marked as the nodata value in the output file.
79 If only one value is given, the same value is used in all the
80 bands.
81
82 -createonly
83 The output file is created (and potentially pre-initialized) but
84 no input image data is copied into it.
85
86 NOTE:
87 gdal_merge.py is a Python script, and will only work if GDAL was
88 built with Python support.
89
91 Create an image with the pixels in all bands initialized to 255.
92
93 % gdal_merge.py -init 255 -o out.tif in1.tif in2.tif
94
95 Create an RGB image that shows blue in pixels with no data. The first
96 two bands will be initialized to 0 and the third band will be initial‐
97 ized to 255.
98
99 % gdal_merge.py -init "0 0 255" -o out.tif in1.tif in2.tif
100
102 Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@inteva‐
103 tion.de>
104
106 1998-2021
107
108
109
110
111 Jan 05, 2021 GDAL_MERGE(1)