Deciphering online land use data

BurroWranglerBurroWrangler Global Mapper UserPosts: 26Trusted User
edited January 2012 in SDK
Mike,

When I download online land use data, such as the NLCD or CORINE data, is there a way to convert the data to integer values (1, 2, 3...) instead of just image (RGB) values for each point in the raster? As an example, I can get online elevation data and convert the elevation data to an elevation GeoTIFF, but I cannot do the same with Land Use data. Is there a mechanism for doing this in the SDK?

Here is an example of what I'm trying to do:
  GM_LayerHandle_t32 gmHandle;
  GM_Error_t32 err(GM_LoadOnlineLayer("NLCD 2006 (US National Land Cover "
    "Database) (30m Resolution)", NULL, &gmHandle, NULL));
  if (err == GM_Error_None)
  {
    GM_Rectangle_t gmRect;
    gmRect.mMinX = -12444780.000000000;
    gmRect.mMinY = 4882950.0000000000;
    gmRect.mMaxX = -12407150.000000000;
    gmRect.mMaxY = 4928340.0000000000;
    err = GM_ExportElevation("C:\\temp\\test.gm_nlcd.web.tif",
      GM_Export_ElevGeoTIFF, gmHandle, &gmRect, 1254, 1513, 0,
      GM_ElevUnit_Meters);
    // No TIFF file is created and error code 8 (GM_Error_NothingToExport)
    // is returned
  }

How would I export the land use data values as a raster file where the land use integers could be read?

Thanks!

Chris

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2012
    Chris,

    You would need to do an export to a palette-based raster image using GM_ExportRaster command. If the default palette for the layer is used (an image optimized palette export should do that by default) then you should get the land use codes back out. I did have to make a minor tweak to make this happen right for the NLCD source. I have placed a new build at http://www.globalmapper.com/GlobalMapperSDK_latest_beta.zip with the change for you to try.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • BurroWranglerBurroWrangler Global Mapper User Posts: 26Trusted User
    edited January 2012
    Ok, that works now. I just did the following for the last line and it exports a TIFF with a 256 color palette that can be read back in and I can get the land use from the resulting TIFF file: err = GM_ExportRaster("c:\\temp\\test.gm_nlcd.web.tif", GM_Export_GeoTIFF, gmHandle, &gmRect, 1254, 1513, GM_ExportFlags_Palette);
Sign In or Register to comment.