I am looking for some examples in Pro of how to use the CIMRasterClassifyColorizer, specifically in setting the ClassBreaks to symbolize some GRID raster data.
Ideally I was hoping to use a pre-existing .lyr file and import the symbology, but have not been able to determine a way to do that.
I have looked at the LayerFactory.Create method, expecting to be able to pass a path to a .lyr file to automatically bring in the proper symbology. I am able to successfully import the .lyr file in the Pro application, so I know it likes the .lyr file. I assume there is a programmatic way to bring in the .lyr symbology. This approach would be ideal as I would not have to mess with all the overhead of building the bits for the CIMRasterClassifyColorizer.
The attached file is a screen shot of the raster legend I am looking for.
Any assistance would be greatly appreciated.
Solved! Go to Solution.
The easiest way would be to create the layer using LayerFactory and then apply the symbology to the layer (you just created) using Geoprocessing.ExecuteToolAsync() and the layer file. Something like:
var gpresult = await Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management", new string[] {theNewLayerName,@"C:\Location\my_layer_file.lyr"});
Here are some links that might help:
Apply Symbology From Layer
Performing Geoprocessing
Create and Add a Layer to the Active Map
The easiest way would be to create the layer using LayerFactory and then apply the symbology to the layer (you just created) using Geoprocessing.ExecuteToolAsync() and the layer file. Something like:
var gpresult = await Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management", new string[] {theNewLayerName,@"C:\Location\my_layer_file.lyr"});
Here are some links that might help:
Apply Symbology From Layer
Performing Geoprocessing
Create and Add a Layer to the Active Map
Charles,
Thanks so much for the reply. I realize with the Developers Conference starting next week, you must be quite busy.
As I expected, your response worked like a charm.
I had looked around the github pro site, which I think is very well done. However, I assumed the piece I was after would be in the MapAuthoring section (https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-MapAuthoring) as it contains examples regarding symbolizing.
I was a bit surprised that the raster rendering solution would come from the Geoprocessing module. Oh well, plenty to learn.
I look forward to next weeks’ sessions.
Thanks again