Shader color palette info for my own legend
I'd like to get information on the color palette used by the shader for elevation rasters so I can draw my own legend but I can't seem to find it anywhere. GM_LayerInfo_t has a mPaletteSize but it is always 0. GM_CustomShader_t has mElevColorList but it's empty, probably because I'm using the Atlas shader and not a custom shader. Are the color palettes for the built in shaders available via the SDK or documented somewhere?
Comments
-
The atlas shader doesn't directly expose the palette anywhere, but it's basically as follows as percentages of the elevation range from the minimum to maximum elevation:
0: RGB(0,0,255)
6.6%: RGB(0,255,255)
20%: RGB(0,255,0)
46.6%: RGB(255,255,0)
100%: RGB(255,0,0)
This could in theory be turned into a custom shader, but it predates the custom shader and is also slightly faster with the built-in values.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com -
That's exactly what I need, thank you. Can I get the palette info on the other built-in shaders also? Actually I only need Color Ramp Shader, Global Shader, and HSV Shader as those are the only ones I use.
-
The color ramp is as below:
0% - RGB(0,0,255)
25% - RGB(0,255,255)
50% - RGB(0,255,0)
75% - RGB(255,255,0)
100% - RGB(255,0,0)
The global shader is just a normal ranged custom shader, you can initialize another shader from it in the application and see it's values. The HSV shader doesn't have a set range like that, it is calculated based on several different configurable values.
If you really want to get anything programmatically I would create a custom elevation grid layer with a small array of values using GM_CreateCustomElevGridLayer, then use GM_DrawLayerListToBitmap to render that to a bitmap, then access the colors in that to see how it was shaded.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 637 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website