Implementing GeoKeys (GeoTIFF tags)
GeoTIFF files support standard TIFF comments and tags, but also contain six additional data tags describing the image location, scale, projection, and other information useful for topographic applications.
Three tags contain scalar data:
ModelTiepointTag = 33922 (0x8482)
ModelPixelScaleTag = 33550 (0x830E)
ModelTransformationTag = 33920 (0x8480)
Three tags store additional values, called "GeoKeys":
GeoKeyDirectoryTag 34375 (0x87AF) – stores all keys and SHORT values.
GeoDoubleParamsTag 34736 (0x87B0) – stores DOUBLE values.
GeoAsciiParamsTag 34737 (0x87B1) – stores ASCII values.
There are 65536 possible GeoKey values. The GeoTIFF specification recommends the following ranges (domains) for 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 to store your own data. |
To read a particular GeoKey from a file, use LFile::ReadGeoKey.
To enumerate the GeoKeys from an existing file, use LFile::EnumGeoKeys. For each GeoKey enumerated, LFile::EnumGeoKeysCallBack is called.
To set GeoKeys in preparation for writing or saving, use LFile::SetGeoKey. These GeoKeys are maintained as a per-thread array. Use LFile::GetGeoKey to obtain the list of GeoKeys that have been set.
Write GeoKeys in one of two ways:
When saving a new image as FILE_GEOTIFF with a save function, such as: LFile::SaveFile, LFile::Save.
By updating an existing file using LFile::WriteGeoKey or LFile::WriteMetaData.
NOTE: To save a region inside a TIFF file, you must have an unlocked Document, Vector, or Medical Imaging license.
For more information, refer to: