Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LFile::EnumGeoKeys
#include "ltwrappr.h"
virtual L_INT LFile::EnumGeoKeys(uFlags, pLoadOptions)
L_UINT uFlags; |
/* reserved for future use. */ |
pLOADFILEOPTION pLoadOptions; |
/* pointer to optional extended load options */ |
Enumerates all the GeoKeys in a GeoTIFF file.
Parameter |
Description |
uFlags |
Flags parameter reserved for future use. Pass 0. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
For multipage GeoTIFF files, you can enumerate the tags from a particular page. Specify the page number on which to enumerate the keys using the pLoadOptions parameter.
The callback is called for each GeoKey value stored in the three standard GeoTIFF tags (34735, 34736 and 34737). For enumerating the other standard GeoTIFF data stored as separate tags, you can use LFile::EnumTags. Or you can call LFile::ReadTag for each of these tags (since there are not that many of them to warrant the use of LFile::EnumTags).
For more information about GeoKeys tags, refer to Implementing GeoKeys (GeoTIFF tags).
Required DLLs and Libraries
LTFIL LFTIF For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
See Also
Functions: |
LFile::SetGeoKey, LFile::GetGeoKey, LFile::WriteGeoKey, LFile::WriteMetaData, LFile::EnumGeoKeys, LFile::SaveFile, LFile::Save, LFile::EnumGeoKeysCallBack |
Topics: |
|
|
|
|
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName /* Displays a GeoKey in a message box*/ static L_VOID DisplayKey(L_UINT16 uTag,L_UINT16 uType,L_UINT32 uCount,L_VOID *pData) { L_TCHAR s[500]; wsprintf(s, TEXT("Key = %d, Type = %s, Count = %d"), uTag, uType == TAG_ASCII ? TEXT("ASCII") : (uType == TAG_SHORT ? TEXT("SHORT") : TEXT("DOUBLE")),uCount); MessageBox(NULL, s, TEXT("Key Info"), MB_OK); /* LEADTOOLS makes the string null-terminated, so it is OK to pass it to MessageBox. Note that for Unicode builds you will need to convert this array of bytes to array of WCHAR*/ if(uType == TAG_ASCII) MessageBox(NULL, (LPCWSTR)pData, TEXT("Key Value"), MB_OK); else { if(uType == TAG_SHORT) { if(uCount == 1) wsprintf(s, TEXT("%d"), *(L_UINT16 *)pData); else wsprintf(s, TEXT("{%d, ...}"), *(L_UINT16 *)pData); } else { if(uCount == 1) wsprintf(s, TEXT("%g"), *(L_DOUBLE *)pData); else wsprintf(s, TEXT("{%g, ...}"), *(L_DOUBLE *)pData); } MessageBox(NULL, s, TEXT("Key Value"), MB_OK); } } /*<struct>*/ #ifdef LFileChild class LFileChild : public LFile { L_INT EnumGeoKeysCallBack(L_UINT16 uTag,L_UINT16 uType,L_UINT32 uCount, L_VOID *pData); }; #endif // #ifdef LFileChild /*</struct>*/ L_INT LFileChild::EnumGeoKeysCallBack(L_UINT16 uTag,L_UINT16 uType,L_UINT32 uCount, L_VOID *pData) { DisplayKey(uTag,uType,uCount,pData) ; return SUCCESS ; } L_INT LFile__EnumGeoKeysExample(LFileChild& file) { L_INT nRet; file.SetFileName(MAKE_IMAGE_PATH(TEXT("clean.tif"))); file.EnableCallBack(TRUE) ; nRet = file.EnumGeoKeys( 0, NULL); if(nRet != SUCCESS) { MessageBox(NULL, TEXT("Error enumerating GeoKeys"), TEXT("ERROR"), MB_OK); return nRet; } else MessageBox(NULL, TEXT("Enumeration SUCCEEDED!"), TEXT("SUCCESS"), MB_OK); return SUCCESS; }