Trim unique values


Purpose
This sample updates unique values symbology for a layer based on values in the current layer data source. This sample trims (removes) values from the layer's unique values renderer. The options for this are as follows:
  • Trim all values not present in the current layer data source
  • Trim all values not present in the current extent for the layer
This sample automates the process of removing values from a unique values symbology without disturbing the match between each individual value and symbol. In ArcObjects terminology, values are removed from the UniqueValuesRenderer if they are not present in the current data (or current extent). Removing values from the renderer means that they will no longer appear in the ArcMap table of contents (TOC) or legend. This is particularly useful in the following scenarios:
  • To see only values present in the current extent
  • If the data behind the layer has been edited
  • If the layer points to new data (a new feature class)
  • To synchronize unique values after importing symbology from a layer file (.lyr)
The logic only removes values from the renderer, it does not add new values to the renderer that it might find in the feature class or extent.

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Run the application.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

cartography/TrimUniqueValues.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic