Geoscience Reference
In-Depth Information
-ul_lr ulx uly lrx lry
The extents of the output file. If not specified the aggregate extents of all input
files will be used.
-v
Generate verbose output of mosaicing operations as they are done.
-separate
Place each input file into a separate stacked band.
-pct
Grab a pseudocolor table from the first input image, and use it for the output.
Merging pseudocolored images this way assumes that all input files use the same
color table.
-n nodata_value
Ignore pixels from files being merged in with this pixel value.
-a_nodata output_nodata_value
from GDAL 1.9.0) Assign a specified no-data value to output bands.
-init "value(s)"
Pre-initialize the output image bands with these values. However, it is not marked
as the no-data value in the output file. If only one value is given, the same value
is used in all the bands.
-createonly
The output file is created (and potentially pre-initialized) but no input image data
is copied into it.
We revisit the example where we clipped the administrative regions, Brussels
and Flanders, from the European forest map (see Sect. 8.3.4 ). The clipped image
for Flanders has no valid pixels in the Brussels area and vice versa. Where images
do overlap, one of the images has the no-data value 255 (as defined by the option
-dstnodata ). Suppose we want to merge the two images back so that the Brussels
area is filled in the Flanders image. We want to retain the pseudocolor table from
the first input image, so we set the option -pct . Pixels with value 255 are ignored
with the option -n 255 and the the no-data value of the output image is set to 255.
The result is shown in Fig. 8.8 c.
gdal_merge.py -pct -n 255 -init 0 -a_nodata 0 -o
belgium_north.tif brussels.tif flanders.tif
The color table must be retained in the output image, so we grab it from the
input image with the option -pct . The option -n ensures that pixels with value 255
are being ignored so that only valid pixels are merged. Where both images have no
valid data, the output image is initialized with value 0 (option -init ). For the output
image, this is also the value that is defined as the no-data value (option -a_nodata ).
Since gdal_merge.py loads the entire input images into memory, this method
works only for modered sized large images that fit into memory.
 
 
Search WWH ::




Custom Search