Class GeoTiffIIOMetadataDecoder
- Object
-
- 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
-
-
Constructor Summary
Constructors Constructor Description GeoTiffIIOMetadataDecoder(IIOMetadata imageMetadata)
The constructor builds a metadata adapter for the image metadata root IIOMetadataNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsciiTIFFTag(String tagID)
Returns the value of an ASCII TIFFTag referred by tagID.GeographicCitation
getGeographicCitation()
Returns theGeoTiffGCSCodes.GeogCitationGeoKey
value, parsed into its components.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.int
getGeoKeyRevision()
Gets the revision number of the GeoKeys in this metadata.Collection<GeoKeyEntry>
getGeoKeys()
Return the GeoKeys.PixelScale
getModelPixelScales()
Gets the model pixel scales from the correct TIFFFieldTiePoint[]
getModelTiePoints()
Gets the model tie points from the appropriate TIFFFieldAffineTransform
getModelTransformation()
Gets the model tie points from the appropriate TIFFFielddouble
getNoData()
Gets the noData from the related TIFFField.int
getNumGeoKeys()
Gets the number of GeoKeys in the geokeys directory.IIOMetadataNode
getRootNode()
boolean
hasGeoKey()
Returntrue
if the geokey directory is present,false
otherwise.boolean
hasModelTrasformation()
Tells me if the underlyingIIOMetadata
contains ModelTransformationTag tag forAffineTransform
that map from Raster Space to World Space.boolean
hasNoData()
Tells me if the underlyingIIOMetadata
contains NoData Tag.boolean
hasPixelScales()
Tells me if the underlyingIIOMetadata
contains ModelTiepointTag tag forTiePoint
.boolean
hasTiePoints()
Tells me if the underlyingIIOMetadata
contains ModelTiepointTag tag forTiePoint
.
-
-
-
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.
-
getGeoKeyRevision
public int getGeoKeyRevision()
Gets the revision number of the GeoKeys in this metadata.
-
getGeoKeyMinorRevision
public int getGeoKeyMinorRevision()
Gets the minor revision number of the GeoKeys in this metadata.
-
getNumGeoKeys
public int getNumGeoKeys()
Gets the number of GeoKeys in the geokeys directory.
-
getGeographicCitation
public GeographicCitation getGeographicCitation()
Returns theGeoTiffGCSCodes.GeogCitationGeoKey
value, parsed into its components.- Returns:
-
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.- Returns:
- the record with the given keyID, or null if none is found
-
getGeoKeys
public Collection<GeoKeyEntry> getGeoKeys()
Return the GeoKeys.
-
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 usinghasNoData()
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 underlyingIIOMetadata
contains ModelTiepointTag tag forTiePoint
.- Returns:
- true if ModelTiepointTag is present, false otherwise.
-
hasPixelScales
public boolean hasPixelScales()
Tells me if the underlyingIIOMetadata
contains ModelTiepointTag tag forTiePoint
.- Returns:
- true if ModelTiepointTag is present, false otherwise.
-
hasNoData
public boolean hasNoData()
Tells me if the underlyingIIOMetadata
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 TIFFFieldAttention, 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 underlyingIIOMetadata
contains ModelTransformationTag tag forAffineTransform
that map from Raster Space to World Space.- Returns:
- true if ModelTransformationTag is present, false otherwise.
-
getRootNode
public IIOMetadataNode getRootNode()
-
hasGeoKey
public boolean hasGeoKey()
Returntrue
if the geokey directory is present,false
otherwise. In case no geokey dir is present no CRS can be constructed from this set of metadata.A prj can be used otherwise.
- Returns:
true
if the geokey directory is present,false
otherwise.
-
-