We’ve been asked by several customers to start switching from common place rainbow color scales to scientific color scales which are more tuned to analyzing scientific data particularly on maps.
Here is a link to one of the most well favored generators.
I downloaded the ScientificColourMaps8 file from the link and it seems the colors are provided in text formats, which means you can just read it and apply the colors to your existing style, by doing something like use the first color for the feature with the minimum value, use the last color for the one with the max value or something. If that’s what you are looking for, I think you can create a CustomStyle, override the DrawCore method, and in which calculate the color for each feature based on the feature’s attribute and the loaded color palette. It should be straightforward. Let us know if you have any issues.
I’ve added it to our internal list and will revisit it before next major release. Thanks for raising it up!
I was kind of hoping something like GetColorsInQualityFamily would be there, but it seems loading all of the colors from the palette file, interpolating to the number of ranges user wants and then building the zoom styles works well. Here’s one I created for slope azimuth using the VikO scale to allow wrap around at 360 degrees.
For the future, it would be nice if there was a comprehensive built-in tool for applying color scales to layers from palette files such as the .cpt that in turn also automated the building of legends. Right now, I do all of that in code and it’s pretty cumbersome.
I’m thinking something like the dollowing, do you think that will work for you?
var style = GetScientificColor(string cptFilePath); // or other scientific color files?
style.ColumnName = "slope" // the column we'll use to get the color
style.GetColor = (scale, value) =>GetTheColorRangesBasedOnScale(scale, value) // get the color
based on the current scale and the feature of the value. We will have a default implementation but you can override it using this method.
featureLayer.CustomStyles.Add(style)