Select to view content in your preferred language

Equivalent for arcpy.mapping.Layer.addAllValues()

47
1
Wednesday
Jeff-Reinhart
Frequent Contributor

In ArcGIS Desktop, we had arcpy.mapping.Layer.addAllValues(). I used this for a straightforward workflow to dynamically symbolize a unique values layer and show it in the legend. I only want to show certain values in the legend (those within a certain distance from the feature). The layer has hundreds of unique values. Symbolization color is not incredibly important and was manageable via a custom color ramp.

Workflow:

  • Dynamically build a definition query for which features are in proximity of a feature of interest.
  • Set that definition query on the layer to limit which values would be symbolized (very important on a layer that has hundreds of unique values).
  • Run arcpy.mapping.Layer.addAllValues() on the layer.

Result: Layer and legend would have a symbol class for only those features that meet the definition query.

This was a quick and easy way to get this done. In ArcGIS Pro and arcpy.mp, there does not seem to be an equivalent to arcpy.mapping.Layer.addAllValues() and it looks like cracking into the CIM is going to be necessary and my code is about to get a lot more complicated. Am I missing something?

1 Reply
HaydenWelch
MVP Regular Contributor

I believe you can just set the layer symbology to UniqueValueRenderer

 

https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/uniquevaluerenderer-class.htm

0 Kudos