GetGeoKey Example for Visual C++
void TestGeoKey(ILEADRasterIO * pRasterIO)
{
// This example gets the value set for the GTModelTypeGeoKey key.
// Note that the example can be simpler by not allocating memory because this particular GeoKey has only one SHORT item. But I want to demonstrate how you call L_GetGeoKey twice and get the required size in the first call
short nRet = pRasterIO->GetGeoKey (1024);
if (nRet != 0)
MessageBox(NULL, TEXT("The GeoKey was not set, or an error occurred!"), "Error", MB_OK);
else
{
CString csBuffer;
long lType, lCount;
pRasterIO->get_GeoKeyType (&lType);
pRasterIO->get_GeoKeyCount (&lCount);
csBuffer.Format(TEXT("GeoKey Type = %d\nGeoKey Count = %d"), lType, lCount);
MessageBox(NULL, csBuffer, "Notice", MB_OK);
}
}