Deciphering online land use data
BurroWrangler
Global Mapper UserTrusted User
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:
How would I export the land use data values as a raster file where the land use integers could be read?
Thanks!
Chris
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
-
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 -
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);
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website