AnsweredAssumed Answered

Creating Unique value colorizer for raster

Question asked by gkmieliauskas_cellexp on Jul 16, 2019
Latest reply on Dec 19, 2019 by wkaiser-esristaff


I am trying to create raster layer from grid and apply unique value colorizer on the same button click. I have tried different techniques from samples with feature layers, from geonet question (part about Classify colorizer) but can't get results as I expected. Sometimes I see correct legend but no raster on map, otherwise bad legend and bad colorized raster on map. I modified ChangeColorizerForRasterLayer project from sdk samples to load my raster and added color ramp to

SetToUniqueValueColorizer method. My code:


public static async Task SetToUniqueValueColorizer(BasicRasterLayer basicRasterLayer)


// Creates a new UV Colorizer Definition using the default constructor.

string fieldName = "Value";

string colorRampName = "Muted pastels";

string colorRampStyle = "ArcGIS Colors";

// Sets the newly created colorizer on the layer.

await QueuedTask.Run(async() =>


IList<ColorRampStyleItem> rampList = GetColorRampsFromStyleAsync(Project.Current, colorRampStyle, colorRampName);

CIMColorRamp colorRamp = rampList[0].ColorRamp;

UniqueValueColorizerDefinition UVColorizerDef = new UniqueValueColorizerDefinition(fieldName, colorRamp);

// Creates a new UV colorizer using the colorizer definition created above.

CIMRasterUniqueValueColorizer newColorizer = await basicRasterLayer.CreateColorizerAsync(UVColorizerDef) as CIMRasterUniqueValueColorizer;




@Uma Harano could you please help me again. I can attach my raster.