Geoscience Reference
In-Depth Information
a zero value where the pixels need to be interpolated. As previously outlined in
Sect. 8.4 , a mask can be created by replacing all pixels with a value of 10 with 0:
gdal_merge.py -n 10 -init 0 -o apex_mask.tif apex.tif
We can then use this mask to fill in the no-data pixels in the original image:
gdal_fillnodata.py apex.tif apex_filled.tif -mask apex_mask.tif
If you use the maximum distance option -md , you have to set it at least to five in
order to make sure all no-data values are filled. The result for a single band image is
shown in Fig. 10.3 .
For a multi-band image we must repeat the command for each band separately. 2
10.5 gdal_proximity.py
The gdal_proximity utility is a Python script that creates a raster image
containing the distance, either in pixels or georeferenced coordinates, from each
pixel in the input raster image to some target pixel value(s). In the situation where
multiple target pixel values are sought, the nearest target is selected. Distances can
be truncated to a maximum value as defined by -maxdist n . Instead of generating
a distance image to the nearest targets, you can also apply a buffer to each target by
setting fixed-buf-val n . All pixels within maxdist will then obtain a fixed
value n .
Usage: gdal_proximity.py srcfile dstfile [-srcband n] [-dstband
n] [-of format] [-co name=value]* [-ot
Byte/Int16/Int32/Float32/etc] [-values n,n,n] [-distunits
PIXEL/GEO] [-maxdist n] [-nodata n] [-fixed-buf-val n]
srcfile
The source raster file used to identify target pixels.
dstfile
The destination raster file to which the proximity map will be written. It may be
a pre-existing file of the same size as srcfile. If it does not exist it will be created.
-srcband n
Identifies the band in the source file to use (default is 1).
2 You can use a similar utility pkfillnodata implemented in pktools, which fills all bands at
once.
 
 
Search WWH ::




Custom Search