L_INT LFile::SetGeoKey(uTag, uType, uCount, pData)
Sets the GeoKey data to be saved in a file.
ID of the GeoKey to set. Values of the GeoKey ID range between 0 and 65535. Possible ranges are:
Range | Meaning |
---|---|
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 |
The type of GeoKey to set. This indicates whether the data pointed to by pData is SHORT, DOUBLE or ASCII. Possible values are:
Value | Meaning |
---|---|
TAG_ASCII | [2] The data pointed to by pData is an array of ASCII bytes. |
TAG_SHORT | [3] The data pointed to by pData is an array of SHORT values (2 bytes each). |
TAG_DOUBLE | [12] The data pointed to by pData is an array of floating points in DOUBLE format (8 bytes each). |
TAG_IFD | [13] 32-bit IFD offset. |
TAG_LONG8 | [16] Unsigned 64-bit integer (valid only for BigTIFF formats). |
TAG_SLONG8 | [17] Signed 64-bit integer (valid only for BigTIFF formats). |
TAG_IFD8 | [18] 64-bit IFD offset (valid only for BigTIFF formats). |
The number of items in the pData buffer. Note that this does not describe the number of bytes. The number of bytes is uCount * number of bytes per value (1 for ASCII, 2 for SHORT, 8 for DOUBLE).
Pointer to a buffer that contains the GeoKey data.
If the pData passed as NULL, the GeoKey data associated with uTag will be cleared; and the uType and uCount parameters will be ignored.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function copies the data pointed to by pData into an internal list of buffers maintained by LTFIL. The user is responsible for freeing the buffer pointed to by pData after calling this function.
Any GeoTIFF file that you save will include the GeoKey data set until you clear the GeoKey data. To save this data to a file, save FILE_GEOTIFF files.
To clear a particular GeoKey, call LFile::SetGeoKey(uTag, 0, 0, NULL).
To clear all the GeoKeys, call LFile::SetGeoKey(0, 0, 0, NULL).
The data set will be saved in the files into 3 TIFF tags:
GeoKeyDirectoryTag: 34735 (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.
LFile::SetGeoKey will overwrite any values saved for these tags previously using LFileSettings::SetTag.
For more information on the various GeoKey values and for links to the GeoTIFF specification, refer to Implementing GeoKeys (GeoTIFF tags).
You can get the last value set with LFile::SetGeoKey by using LFile::GetGeoKey.
To write the GeoKey data directly to an existing file, call LFile::WriteGeoKey.
Note that LEADTOOLS does not verify the validity of the GeoKeys that you set. It is your responsibility to make sure you write correct values according to the GeoTIFF specification.
Win32, x64.
This example sets the GTModelTypeGeoKey key to the Project Coordination System value.
L_INT LFile__SetGeoKeyExample(LFile& file)
{
L_INT nRet;
L_UINT16 uProjectCoordinationSystem = 1;
nRet = file.SetGeoKey(1024, TAG_SHORT, 1, &uProjectCoordinationSystem);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("works Fine!"), TEXT("SUCCESS"), MB_OK);
else
return nRet;
//Every GeoTIFF file I save from now on will contain this GeoKey
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document