#include "l_bitmap.h"

L_LTFIL_API L_INT L_SetGeoKey (uTag, uType, uCount, pData);

L_UINT16 uTag;

GeoKey ID

L_UINT uType;

GeoKey type

L_UINT uCount;

number of GeoKey values

L_VOID* pData;

pointer to GeoKey data

Sets the GeoKey data to be saved in a file.

Parameter Description
uTag 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
uType 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).
uCount The number of items in the pData buffer. Note that this doesn't 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).
pData 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.



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 L_SetGeoKey(uTag, 0, 0, NULL).

To clear all the GeoKeys, call L_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.

L_SetGeoKey will overwrite any values saved for these tags previously using L_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 L_SetGeoKey by using L_GetGeoKey.

To write the GeoKey data directly to an existing file, call L_WriteFileGeoKey.

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.

Required DLLs and Libraries



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, Linux.

See Also


L_GetGeoKey, L_WriteFileGeoKey, L_ReadFileGeoKey, L_EnumFileGeoKeys, L_SaveFile, L_SaveBitmap, L_ReadFileGeoKeys


Implementing GeoKeys (GeoTIFF tags)


Implementing TIFF Comments and Tags


Raster Image Functions: Working with GeoKeys


This example sets the GTModelTypeGeoKey key to the Project Coordination System value

L_INT SetGeoKeyExample(L_VOID) 
   L_INT nRet; 
   L_UINT16 uProjectCoordinationSystem = 1; 
   nRet = L_SetGeoKey(1024, TAG_SHORT, 1, &uProjectCoordinationSystem); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Every GeoTIFF file that is saved from now on will contain this GeoKey */ 
   return SUCCESS; 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help