Implementing GeoKeys (GeoTIFF tags)
GeoTIFF files are TIFF files containing a few extra TIFF tags describing the image location, scale at which the picture was taken and many other information useful for topographic applications.
The GeoTIFF extra data is stored using six standard tags. The following three tags contain scaling information:
ModelTiepointTag = 33922 (0x8482)
ModelPixelScaleTag = 33550 (0x830E)
ModelTransformationTag = 33920 (0x8480)
The following three tags contain many extra values. We will refer to these values stored in these three tags as "GeoKeys":
GeoKeyDirectoryTag 34375 (0x87AF) – This tag will store all the keys and the SHORT values.
GeoDoubleParamsTag 34736 (0x87B0) – This tag will store the DOUBLE values.
GeoAsciiParamsTag 34737 (0x87B1) – This tag will store the ASCII values.
There are 65536 possible GeoKeys values. The GeoTIFF specification recommends you use the following ranges (domains) for the GeoTIFF data:
0..1023 |
Do not use; reserved for future use. |
1024..2047 |
GeoTIFF configuration keys. |
2048..3071 |
Geographic/Geocentric CS Parameter Keys. |
3072..4095 |
Projected CS Parameter Keys. |
4096..5119 |
Vertical CS Parameter keys. |
5120..32767 |
Reserved. |
32768..65535 |
Private use – use to store your own data. |
For more information on the GeoTIFF tags and for the complete list of the predefined GeoKeys values; refer to the GeoTIFF specifications found on http://home.earthlink.net/~ritter/geotiff/geotiff.html or http://www.remotesensing.org/geotiff/geotiff.html URLs.
GeoTIFF files also support standard TIFF comments and tags. For more information on standard TIFF tags and comments, refer to Implementing TIFF Comments and Tags.
The GeoKeys can be set in preparation for writing or saving files with LFile::SetGeoKey. These GeoKeys are maintained as a per-thread array of GeoKeys. You can obtain the list of GeoKeys that have been set using LFile::GetGeoKey.
The user can write the GeoKeys in two ways:
1. |
When saving a new image as FILE_GEOTIFF with one of the save functions: LFile::SaveFile, LFile::SaveBitmap, etc. |
2. |
You can update an existing file, using LFile::WriteGeoKey or LFile::WriteMetaData. |
You can enumerate the GeoKeys from an existing file using LFile::EnumGeoKeys. For each GeoKeys enumerated by LFile::EnumGeoKeys, LFile::EnumGeoKeysCallBack function is called.
You can read a particular GeoKey from a file using LFile::ReadGeoKey.