I am using a combination of ArcMap and ArcPy to stage data for sharing as a hosted Feature Service on AGOL.

The data will be used in a data-driven pages type of way, where each feature will be reviewed and have a 'ReviewStatus' attribute updated before moving to the next feature for the same review.

The way I have it set up, every feature has a default value in my tracking field of 'Awaiting Review'. As the feature is reviewed, a field is updated to indicate whether the changes were 'Accepted', 'Rejected', or 'Marked for Revisit'.

To facilitate this, I have created and applied a domain consisting of only those four values discussed above and created a layer file symbolizing each value as a different color.

When I have all my layers loaded on my desktop session, I am attempting to loop through each layer and apply the symbology from my staged layer file. The issue is...each feature has a default value of 'Awaiting Review', so before any review has happened, there are no features with any other values in my domain. When I use the ApplySymbologyFromLayer tool, it only brings the symbology for 'Awaiting Review'. It ignored 'Accepted', 'Rejected', and 'Marked for Revisit'.

I have tried messing with FeatureTemplates to no avail.

The manual workflow that HAS been successful is to simply import the layer file as symbology through the layer properties. When I close the properties dialog, everything works as expected. It is trying this pythonically that fails.

In my routine, I have also tried the layer method addAllValues() AFTER applying symbology and before. I even tried to reload the symbology after adding all values.

I know arcpy.mapping can be a bit clunky sometimes and often needs some inelegant workaround to accomplish a task, but am I missing something? Is there a way to include the symbology for ALL values in a layer file even if the dataset doesn't yet contain features with all those values?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.