#include "ltwrappr.h"

L_INT LFile::EnumGeoKeys(uFlags, pLoadOptions)

Enumerates all the GeoKeys in a GeoTIFF file.


L_UINT uFlags

Flags parameter reserved for future use. Pass 0.


Pointer to optional extended load options. Pass NULL to use the default load options.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


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


Win32, x64.

See Also




/* 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);  
      if(uType == TAG_SHORT)  
         if(uCount == 1)  
            wsprintf(s, TEXT("%d"), *(L_UINT16 *)pData);  
            wsprintf(s, TEXT("{%d, ...}"), *(L_UINT16 *)pData);  
         if(uCount == 1)  
            wsprintf(s, TEXT("%g"), *(L_DOUBLE *)pData);  
            wsprintf(s, TEXT("{%g, ...}"), *(L_DOUBLE *)pData);  
      MessageBox(NULL, s, TEXT("Key Value"), MB_OK);  
#ifdef LFileChild 
class LFileChild : public LFile 
   L_INT EnumGeoKeysCallBack(L_UINT16 uTag,L_UINT16 uType,L_UINT32 uCount, L_VOID *pData);  
#endif // #ifdef LFileChild 
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.EnableCallBack(TRUE) ;  
   nRet = file.EnumGeoKeys( 0, NULL);  
   if(nRet != SUCCESS)  
      MessageBox(NULL, TEXT("Error enumerating GeoKeys"), TEXT("ERROR"), MB_OK);  
      return nRet; 
      MessageBox(NULL, TEXT("Enumeration SUCCEEDED!"), TEXT("SUCCESS"), MB_OK);  
   return SUCCESS; 
Help Version 22.0.2021.11.10
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help