Geoscience Reference
In-Depth Information
We will re-use the example from Sect. 8.4 where we create a mosaic from a list
of forest type maps in Ireland with gdal_merge.py . Instead of creating a real
raster GeoTIFF file, we create a virtual raster using gdalbuildvrt . Notice that
the options are not identical. We must replace the option -n with -srcnodata
and -a_nodata with -vrtnodata . The seven input images are listed for your
information. The result is shown in Fig. 7.2 .
ls *.tif
3128535974-AB.tif
3146933672-CA.tif
3147135008-AA.tif
3200037126-CB.tif
3214834843-DC.tif
3216236173-BA.tif
3282836015-BB.tif
gdalbuildvrt -o fmap_mosaic.vrt -srcnodata 0 -vrtnodata 0 *.tif
11.3 Virtual Processing
As explained in the introduction of this chapter, VRT files can contain algorithm
descriptions. As an example, we implement a sharpening filter with a kernel size of
three by tree pixels on a single band image ( lena.tif ).
<VRTDataset rasterXSize="512" rasterYSize="512">
<Metadata />
<VRTRasterBand dataType="UInt16" band="1">
<Metadata />
<ColorInterp>Red</ColorInterp>
<KernelFilteredSource>
<SourceFilename relativeToVRT="1">lena.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="512" RasterYSize="512"
DataType="Byte" BlockXSize="512" BlockYSize="5" />
<SrcRect xOff="0" yOff="0" xSize="512" ySize="512" />
<DstRect xOff="0" yOff="0" xSize="512" ySize="512" />
<Kernel>
<Size>3</Size>
<Coefs>-0.111 -0.111 -0.111 -0.111 2 -0.111 -0.111 -0.111
-0.111</Coefs>
</Kernel>
</KernelFilteredSource>
</VRTRasterBand>
</VRTDataset><
The kernel tends to brighten the image a little (note the “2” in the kernel) as well
as sharpen (due to the negative numbers for the rest of the kernel coefficients). To try
it on your file, create a VRT file with gdal_translate -of VRT, then use a text editor
 
 
Search WWH ::




Custom Search