7

I have a 256 item vector of RGB triplets derived from viscm (a tool for creating perceptual color bars in a CIE color space). I am not able to replicate it correctly using the algorithmic color bar facilities in ArcGIS, even when using the CIE LCh and LAB options (because the path taken through the color space is an arc rather than a line, as seems to be assumed in ArcGIS).

Is there a way to specify a color bar by giving it my 256 values directly? If I wanted a multi-part color bar, is there a way to specify that in text format for so that I can interpolate between each of my 256 colors, without having to do it through the GUI?

As a first step, this is designed for raster symbology, but should also be applicable to vectors. Note also that I don't want a discrete colour map, but one that interpolates between the values I specify, ideally in one of the CIE spaces.

3
  • I did find:developers.arcgis.com/java/api-reference/com/esri/core/renderer/… but I have no experience with this API, and don't know if it applies to ArcGIS 9.3/10...
    – Benjamin
    Nov 21, 2015 at 1:17
  • If you post the colors desired, I can whip up some code to create this. Nov 22, 2015 at 1:17
  • @Craig, the specific colors don't matter, you can use 256 random RGB triplets... What matters is how you get it into a multi-part algorithmic ramp programatically.
    – Benjamin
    Nov 23, 2015 at 13:26

1 Answer 1

1

If you know how to program in .NET, and you have installed the ArcObjects SDK, you could probably do something like this:

public void Test()
{
    var rnd = new Random();

    const esriColorRampAlgorithm algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm;
    const int size = 10;
    const string name = "Ramp";

    var colors = new List<IColor>();
    // Add random colors to the list, you need to provide your own here
    for (var i = 0; i < 10; i++)
    {
        colors.Add(new RgbColorClass { Red = rnd.Next(256), Green = rnd.Next(256), Blue = rnd.Next(256) });
    }

    var ramp = new MultiPartColorRampClass {Name = name, Size = size};
    for (var i = 1; i < colors.Count; i++)
    {
        ramp.AddRamp(new AlgorithmicColorRampClass
        {
            FromColor = colors[i - 1],
            ToColor = colors[i],
            Algorithm = algorithm,
            Size = size,
            Name = string.Format("{0} {1}", name, i)
        });
    }

    bool ok;            
    ramp.CreateRamp(out ok);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.