I have a Point layer in ArcGIS Pro 3.2. The underlying attribute table has a field called ImagePath. In that field are unique UNC paths to images (e.g. *.png etc) that I want to act as the symbol for that point feature on the map.
Currently, I have the following code, partly generated from genAI, but can't figure out how to get this working - if it's at all possible. Does anyone have experience with automating this process as a script in ArcGIS Pro?
import arcpy# Define the project and mapproject = arcpy.mp.ArcGISProject("CURRENT")map = project.listMaps("YourMapName")[0]# Define the layerlayer = map.listLayers("YourLayerName")[0]# Create a new unique value renderersymbology = layer.symbologysymbology.updateRenderer('UniqueValueRenderer')symbology.renderer.fields = ['ImagePath']# Clear any existing classesunique_value_renderer = symbology.rendererunique_value_renderer.removeAllValues()# Add a class for each unique value in the ImagePath fieldunique_values = set()with arcpy.da.SearchCursor(layer, ['ImagePath']) as cursor:for row in cursor:unique_values.add(row[0])for value in unique_values:if value:unique_value_renderer.addValue(value, value, value)symbol = unique_value_renderer.getSymbol(value)picture_marker = arcpy.mp.PictureMarkerSymbol()picture_marker.url = valuesymbol.updateSymbol(picture_marker)# Apply the symbology to the layerlayer.symbology = symbology# Refresh the active viewarcpy.mp.ArcGISProject("CURRENT").activeView.refresh()
Before you go the coding route, have you managed to set it up properly?
Marker symbol layers—ArcGIS Pro | Documentation
picture symbols are expected to be in a blob field in an attribute table or preferably an attachment table