Hello,
Not sure if I'm doing this wrong but to me this seems like this should work just fine but I get the following error:
SystemError: <built-in method addValues of MappingSymbologyObject object at 0x00000151F8882670> returned NULL without setting an error
The code is as follows:
p = arcpy.mp.ArcGISProject(path-to-aprx)
mapList = p.listMaps()
for m in mapList:
layerList = m.listLayers()
for layer in layerList:
sym = layer.symbology
if hasattr(sym, 'renderer'):
if sym.renderer.type == 'UniqueValueRenderer':
groupName = sym.renderer.groups[0].heading
sym.renderer.removeValues({groupName: ['Spring2022']})
layer.symbology = sym
sym.renderer.addValues({groupName: ['Fall2022']})
layer.symbology = sym
When I go manually into the aprx and change the headings to not a blank string it works fine.
Solved! Go to Solution.
Great! Please mark my response as a solution as a kind gesture for my time. And good luck with all your GIS efforts to make a great web map!!
I have two suggestions, and I don't which, if either, will work.
Let us know and good luck!
Thanks for the reply Roger, I just tested it out and it does work with only a space and it does truncate itself, thanks for the suggestion! I had just changed the heading manually and continued with the project, but this makes the legend in the ultimate web map much cleaner because it just puts the icon in line with the field value.
Great! Please mark my response as a solution as a kind gesture for my time. And good luck with all your GIS efforts to make a great web map!!