Hi, why does this code rotate every item's icon instead of each icon separately? I cannot get the necessary information from documentation available. I want each unique value to have a differently rotated symbol:
l = m.listLayers("xylayer")
sym = l.symbology
symList = sym.renderer.symbol.listSymbolsFromGallery("ShipAIS")
current = None
for symbol in symList:
current = symbol
sym.renderer.fields = ["Combined_True_Heading"]
for grp in sym.renderer.groups:
for itm in grp.items:
itm.symbol = current
if(itm.values != "<Null>"):
itm.symbol.angle = 360 - float(itm.values)
l.symbology = sym
if itm.values is not None:
<null> is how it shows in the geodatabase table, None is python. Assuming it is not an empty string then you have to check a bit more
if itm.values not in ("", None):
I made the change and it ended up not catching the cases that are null, probably because the data table this is being run on is the result of a join and what is in those cells are Strings (that is, the String "<Null>").
So presently I've changed this to "if itm.values not in ("<Null>", None):" and it is still catching the instances where it says "<Null>", while also catching any other potential instances of no value for a particular cell, so it's an improvement in the code to be sure.
It's still not solving the issue with the icons rotating as a group rather than allowing me to rotate each individually, though. Is there another way I can get at that?