org.geotools.coverage.grid.io.imageio.geotiff
Class GeoTiffIIOMetadataDecoder

Object
  extended by GeoTiffIIOMetadataDecoder

public final class GeoTiffIIOMetadataDecoder
extends Object

This class provides an abstraction from the details of TIFF data access for the purpose of retrieving GeoTIFFWritingUtilities metadata from an image.

All of the GeoKey values are included here as constants, and the portions of the GeoTIFFWritingUtilities specification pertaining to each have been copied for easy access.

The majority of the possible GeoKey values and their meanings are NOT reproduced here. Only the most important GeoKey code values have been copied, for others see the specification.

Convenience methods have been included to retrieve the various TIFFFields that are not part of the GeoKey directory, such as the Model Transformation and Model TiePoints. Retrieving a GeoKey from the GeoKey directory is a bit more specialized and requires knowledge of the correct key code.

Making use of the geographic metadata still requires some basic understanding of the GeoKey values that is not provided here.

For more information see the GeoTIFFWritingUtilities specification at http://www.remotesensing.org/geotiff/spec/geotiffhome.html

Author:
Mike Nidel, Simone Giannecchini, GeoSolutions
Module:

Constructor Summary
GeoTiffIIOMetadataDecoder(IIOMetadata imageMetadata)
          The constructor builds a metadata adapter for the image metadata root IIOMetadataNode.
 
Method Summary
 String getGeoKey(int keyID)
          Gets a GeoKey value as a String.
 int getGeoKeyDirectoryVersion()
          Gets the version of the GeoKey directory.
 int getGeoKeyMinorRevision()
          Gets the minor revision number of the GeoKeys in this metadata.
 GeoKeyEntry getGeoKeyRecord(int keyID)
          Gets a record containing the four TIFFShort values for a geokey entry.
 GeoKeyEntry getGeoKeyRecordByIndex(int index)
          Gets a record containing the four TIFFShort values for a geokey entry.
 int getGeoKeyRevision()
          Gets the revision number of the GeoKeys in this metadata.
 PixelScale getModelPixelScales()
          Gets the model pixel scales from the correct TIFFField
 TiePoint[] getModelTiePoints()
          Gets the model tie points from the appropriate TIFFField
 AffineTransform getModelTransformation()
          Gets the model tie points from the appropriate TIFFField Attention, for the moment we support only 2D baseline transformations.
 double getNoData()
          Gets the noData from the related TIFFField.
 int getNumGeoKeys()
          Gets the number of GeoKeys in the geokeys directory.
 IIOMetadataNode getRootNode()
           
 boolean hasModelTrasformation()
          Tells me if the underlying IIOMetadata contains ModelTransformationTag tag for AffineTransform that map from Raster Space to World Space.
 boolean hasNoData()
          Tells me if the underlying IIOMetadata contains NoData Tag.
 boolean hasPixelScales()
          Tells me if the underlying IIOMetadata contains ModelTiepointTag tag for TiePoint.
 boolean hasTiePoints()
          Tells me if the underlying IIOMetadata contains ModelTiepointTag tag for TiePoint.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoTiffIIOMetadataDecoder

public GeoTiffIIOMetadataDecoder(IIOMetadata imageMetadata)
The constructor builds a metadata adapter for the image metadata root IIOMetadataNode.

Parameters:
imageMetadata - The image metadata
Method Detail

getGeoKeyDirectoryVersion

public int getGeoKeyDirectoryVersion()
Gets the version of the GeoKey directory. This is typically a value of 1 and can be used to check that the data is of a valid format.

Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException - DOCUMENT ME!

getGeoKeyRevision

public int getGeoKeyRevision()
Gets the revision number of the GeoKeys in this metadata.

Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException - DOCUMENT ME!

getGeoKeyMinorRevision

public int getGeoKeyMinorRevision()
Gets the minor revision number of the GeoKeys in this metadata.

Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException - DOCUMENT ME!

getNumGeoKeys

public int getNumGeoKeys()
Gets the number of GeoKeys in the geokeys directory.

Returns:
DOCUMENT ME!
Throws:
UnsupportedOperationException - DOCUMENT ME!

getGeoKey

public String getGeoKey(int keyID)
Gets a GeoKey value as a String. This implementation should be "quiet" in the sense that it should not throw any exceptions but only return null in the event that the data organization is not as expected.

Parameters:
keyID - The numeric ID of the GeoKey
Returns:
A string representing the value, or null if the key was not found.

getGeoKeyRecord

public GeoKeyEntry getGeoKeyRecord(int keyID)
Gets a record containing the four TIFFShort values for a geokey entry. For more information see the GeoTIFFWritingUtilities specification.

Parameters:
keyID - DOCUMENT ME!
Returns:
the record with the given keyID, or null if none is found
Throws:
UnsupportedOperationException - DOCUMENT ME!

getGeoKeyRecordByIndex

public GeoKeyEntry getGeoKeyRecordByIndex(int index)
Gets a record containing the four TIFFShort values for a geokey entry. For more information see the GeoTIFFWritingUtilities specification.

Parameters:
index - DOCUMENT ME!
Returns:
the record with the given keyID, or null if none is found
Throws:
UnsupportedOperationException - DOCUMENT ME!

getModelPixelScales

public PixelScale getModelPixelScales()
Gets the model pixel scales from the correct TIFFField


getModelTiePoints

public TiePoint[] getModelTiePoints()
Gets the model tie points from the appropriate TIFFField

Returns:
the tie points, or null if not found

getNoData

public double getNoData()
Gets the noData from the related TIFFField. Check metadata has noData using hasNoData() method before calling this method.

Returns:
the noData value or Double.NaN in case of unable to get noData.

hasTiePoints

public boolean hasTiePoints()
Tells me if the underlying IIOMetadata contains ModelTiepointTag tag for TiePoint.

Returns:
true if ModelTiepointTag is present, false otherwise.

hasPixelScales

public boolean hasPixelScales()
Tells me if the underlying IIOMetadata contains ModelTiepointTag tag for TiePoint.

Returns:
true if ModelTiepointTag is present, false otherwise.

hasNoData

public boolean hasNoData()
Tells me if the underlying IIOMetadata contains NoData Tag.

Returns:
true if NoData Tag is present, false otherwise.
See Also:
GeoTiffConstants#TIFFTAG_NODATA.

getModelTransformation

public AffineTransform getModelTransformation()
Gets the model tie points from the appropriate TIFFField

Attention, for the moment we support only 2D baseline transformations.

Returns:
the transformation, or null if not found

hasModelTrasformation

public boolean hasModelTrasformation()
Tells me if the underlying IIOMetadata contains ModelTransformationTag tag for AffineTransform that map from Raster Space to World Space.

Returns:
true if ModelTransformationTag is present, false otherwise.

getRootNode

public IIOMetadataNode getRootNode()


Copyright © 1996-2009 Geotools. All Rights Reserved.