gdalextras.vrtlib

Utility library to use GDAL virtual format in GSDView

Functions

Element(tag, **extra[, attrib])
SubElement(parent, tag, **extra[, attrib])
changeVrtBandDataType(tree, derived_datatype) Change data type of #rbInd VrtRasterBand (0 for all)
del_band_statistics(band)
del_dataset_statistics(dataset)
dummy_window_type()
firwin(N, cutoff[, width, window]) FIR Filter Design using windowed ideal filter method.
fixDerivedRasterband(tree, pixfunc[, rbInd, ...]) It puts in the correct format the derived rasterband in the xml structure.
fromstring(text)
xml_to_string(element[, encoding])

Classes

Kernel([size, norm_cutoff, width, ...]) Kernel for filtering defined with its matrix of coefficients.
Point([xpoint, ypoint]) Bidimensional point
Rect([point, size]) Rectangle defined by its upper-left point and size
Size([xsize, ysize]) Bidimensional size
VrtAveragedSource([src_filename, ...]) The AveragedSource is derived from the SimpleSource and shares
VrtComplexSource([src_filename, ...]) The ComplexSource is derived from the SimpleSource, but
VrtKernelFilteredSource([src_filename, ...]) This is a pixel source derived from the Simple Source, but it also
VrtSimpleSource([src_filename, ...]) The SimpleSource indicates that raster data should be read from
class gdalextras.vrtlib.Kernel(size=None, norm_cutoff=None, width=None, windowing='hamming', windowPar1=None, windowPar2=None)

Kernel for filtering defined with its matrix of coefficients.

eval_fir_coeffs(size, norm_cutoff, width=None, windowing='hamming', windowPar1=None, windowPar2=None)

It evaluates the coefficients of the required FIR filter

Attributes :
  • size: filter’s order. It must be an odd value
  • norm_cutoff: filter’s normalized cutoff frequency
  • width: filter’s width
  • windowing: filter’s window type

It returns the coefficients matrix with size x size dimensions

class gdalextras.vrtlib.Point(xpoint=None, ypoint=None)

Bidimensional point

Attributes :
  • x: x position
  • y: y position
isEmpty()
class gdalextras.vrtlib.Rect(point=None, size=None)

Rectangle defined by its upper-left point and size

Attributes :
  • ulpoint: upper left corner of rectangle
  • size: a Size instance. It is the rectangular dimension
isEmpty()
class gdalextras.vrtlib.Size(xsize=None, ysize=None)

Bidimensional size

Attributes :
  • xsize: dimension along x axis
  • ysize: dimension along y axis
isEmpty()
class gdalextras.vrtlib.VrtAveragedSource(src_filename=None, relative_to_vrt=True, src_band=1, src_rect=None, raster_size=None, block_size=None, datatype=None, dst_rect=None)
The AveragedSource is derived from the SimpleSource and shares the same properties except that it uses an averaging resampling instead of a nearest neighbour algorithm as in SimpleSource, when the size of the destination rectangle is not the same as the size of the source rectangle.
class gdalextras.vrtlib.VrtComplexSource(src_filename=None, relative_to_vrt=True, src_band=1, src_rect=None, raster_size=None, block_size=None, datatype=None, dst_rect=None, scale_offset=0, scale_ratio=1, color_table_component=None, look_up_table=None, nodata_value=None)

The ComplexSource is derived from the SimpleSource, but it provides support to rescale and offset the range of the source values.

When transforming the source values the operations are executed in the following order:

  1. Nodata masking
  2. Color table expansion
  3. Applying the scale ratio
  4. Applying the scale offset
  5. Table lookup

Example:

<ComplexSource>
  <SourceFilename relativeToVRT="1">utm.tif</SourceFilename>
  <SourceBand>1</SourceBand>
  <ScaleOffset>0</ScaleOffset>
  <ScaleRatio>1</ScaleRatio>
  <ColorTableComponent>1</ColorTableComponent>
  <LUT>0:0,2345.12:64,56789.5:128,2364753.02:255</LUT>
  <NODATA>0</NODATA>
  <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
  <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
</ComplexSource>
class gdalextras.vrtlib.VrtKernelFilteredSource(src_filename=None, kernel=None, normalized=False, relative_to_vrt=True, src_band=1, src_rect=None, raster_size=None, block_size=None, datatype=None, dst_rect=None)

This is a pixel source derived from the Simple Source, but it also passes the data through a simple filtering kernel.

The size must always be an odd number, and the Coefs must have Size * Size entries separated by spaces.

Example:

<KernelFilteredSource>
  <SourceFilename>utm.tif</SourceFilename>
  <SourceBand>1</SourceBand>
  <Kernel normalized="1">
    <Size>3</Size>
    <Coefs>0.11111111 0.11111111 0.11111111
           0.11111111 0.11111111 0.11111111
           0.11111111 0.11111111 0.11111111</Coefs>
  </Kernel>
</KernelFilteredSource>
class gdalextras.vrtlib.VrtSimpleSource(src_filename=None, relative_to_vrt=True, src_band=1, src_rect=None, raster_size=None, block_size=None, datatype=None, dst_rect=None)

The SimpleSource indicates that raster data should be read from a separate dataset, indicating the dataset, and band to be read from, and how the data should map into this bands raster space.

Example:

<SimpleSource>
  <SourceFilename relativeToVRT="1">utm.tif</SourceFilename>
  <SourceBand>1</SourceBand>
  <SourceProperties RasterXSize="512" RasterYSize="512"
                    DataType="Byte"
                    BlockXSize="128" BlockYSize="128"/>
  <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
  <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
</SimpleSource>
parse(xmlstring)
Set object attributes parsing xml input string
xml()
It returns a string in XML format describing the source section of the rasterband inside a vrt file
gdalextras.vrtlib.changeVrtBandDataType(tree, derived_datatype, rbInd=0)
Change data type of #rbInd VrtRasterBand (0 for all)
gdalextras.vrtlib.del_band_statistics(band)
gdalextras.vrtlib.del_dataset_statistics(dataset)
gdalextras.vrtlib.dummy_window_type()
gdalextras.vrtlib.fixDerivedRasterband(tree, pixfunc, rbInd=0, transferType=None, derived_datatype=None)

It puts in the correct format the derived rasterband in the xml structure.

Attributes :
  • tree: xml structure to modify
  • pixfunc: pixel function
  • rbInd: output raster band [default 0 all the raster band]
  • transferType: transfer datatype [default None]
  • derived_datatype: data type for derived raster band

Previous topic

gdalextras.quicklook

Next topic

otbtools

This Page