GeoTiff

From ObjectVision

Jump to: navigation, search

The (Geo)Tiff format is our advised format for grid data, as it:

  • is open, widely used, binary(fast) and supports multiple compression types.
  • allows geo-referencing projection information to be embedded with (in an accompanying .tfw world file in the same folder) or within the GeoTiff file.

To read GeoTiff files we advice to use the gdal.grid storage manager, except for uint2, uint4 and boolean data. To read data for these value types or to write data (of any numeric or boolean value type) to GeoTiff files, use the GeoDMS specific Tiff StorageManager.

Examples for reading AHN data from the file 26az2.tiff :

Contents

Gdal.grid StorageManager

unit<spoint> AHNTile
:   StorageName = "%SourceDataDir%/AHN/26az2.tif" 
,   StorageType   = "gdal.grid" 
,   DialogData      = "Geografie/rdc" 
{    
   attribute<float32> GridData;    
   attribute<float32> ReadData (subdomain); 
}
	

Tiff StorageManager

unit<spoint> AHNTile
:   StorageName = "%SourceDataDir%/AHN/26az2.tif" 
,   DialogData     = "Geografie/rdc" 
{
   attribute<float32> GridData;
   attribute<float32> ReadData (subdomain); 
}

See StorageManager for a description of the StorageName and StorageType properties.The DialogData property needs to refer to the unit for the coordinate system (RD, LatLong etc) to inform the GeoDMS on how to relate the projection information from the GeoTiff to the base coordinate system of the configuration.

The geographic grid domain AHNTile is implicity defined by the projection information and the number of rows/columns of the GeoTiff and/or accompanying .tfw world file. The GridData attribute has this AHNTile as domain unit and is read for the whole grid.

The ReadData attribute is read for another domain unit, in the example subdomain. This geographic domain unit needs to be configured and can be used to read for example the AHN data for a building or the land use for a country from a European land use file. If only a (small) selection of a GeoTiff file is needed, using such a ReadData attribute as it is much faster than reading the GridData and making the selection afterwards.

Tiles

Grids can be split up in tiles. The following example shows how a grid is split up in a Tiled Domain with tiles of 1024 * 1024 grid cells.

unit<spoint> AHNTile
:   StorageName = "%SourceDataDir%/AHN/26az2.tif" 
,   StorageType   = "gdal.grid" 
,   DialogData     = "Geografie/rdc" 
{   
   unit<wpoint>         AHNSubTile := TileUnit(point(1024w,1024w,AHNTile); 
   attribute<float32> ReadData (AHNSubTile); 
}

The ReadData attribute reads the data of the whole grid file for the TiledDomain: AHNSubTile.

TrueColor

In this variant GeoTiff files contain a color value (rgb code) for each grid cell. The GeoDMS supports TrueColor Bitmap/Tiff images with 24 bits per pixel (1 byte for red, green and blue values). The value type for the grid data values in the GeoDMS needs to be: uint32.

Example:

unit<spoint> referentie_tiff
:   StorageName = "%projDir%/data/tif/kaart.tif"
,   DialogData      = "Geography/point_rd"
{
   attribute<uint32> GridData: DialogType ="BrushColor";
}

The property DialogType = "BrushColor" is configured to inform the GeoDMS the grid values are interpretated as colors and can be used directly to visualise grid cells in the map view.

Palette Based

In this variant GeoTiff files contain an index number for each grid cell. These index numbers are related to colors in a palette. The palette is also stored in the GeoTiff file. Based on the number of entries in the palette (related to the number of different colors in the file), the griddata of a palette based GeoTiff is usually configured with value type uint4 (for maximum 16 color) or uint8 (for maximum 255 colors).

Example:

unit<uint4> colorindex;
{
   attribute<uint32> palette := Grid/PaletteData
  ,  DialogType = "BrushColor";
}
unit<spoint> referentie_tiff
:   StorageName = "%projdir%/data/tiff_pa.tif"
,   DialogData     = "Geography/point_rd"                    
{
   attribute<colorindex>  GridData;
   attribute<units/color>  PaletteData (colorindex);
}

First a colorindex domain unit is configured for the color palette. The subitem palette is an attribute of this colorindex domain that refers to the PalletteData of the configured Tiff. The PaletteData is read from the Tiff file for the colorindex domain.

The property DialogType = "BrushColor" is configured for the palette subitem to inform the GeoDMS the palette values are interpreted as colors and can be used to visualize the grid cells in the map view.

The GridData subitem refers to the index numbers of the colorindex in the tiff file. Other palettes (not read from the Tiff file) can also be used, e.g. defined explicitly in the GeoDMS configuration.

Aggregations

Aggegations can be made from the GeoTiff file by using the SqlString property.

If a SqlString = "number" is configured, a relation is made (if possible) between the grid data domain and the result domain based on the configured projection. This relation is used to count the number of occurrences of the configured class number in the original Tiff file for the new desired grid cell.

Personal tools