Hello everyone!
I am working on python automation for a project and I need to show the labelling for one of the features on the map based on one of the fields.
I am not sure what functions is used usually to show the labeling.
Appreciate your support!
Solved! Go to Solution.
import arcpy
import os
# Place in ArcGIS Project Folder
path = os.getcwd()
aprx = arcpy.mp.ArcGISProject(os.path.join(path, 'APRX_File_Name.aprx'))
for map in aprx.listMaps():
print(' Map: ' + map.name)
for lyr in map.listLayers():
print(' Layer: ' + lyr.name)
if lyr.name == 'The Layer Name whose Labels youd like to enable':
lyr.showLabels = True
aprx.save()
Give this a shot
import arcpy
import os
# Place in ArcGIS Project Folder
path = os.getcwd()
aprx = arcpy.mp.ArcGISProject(os.path.join(path, 'APRX_File_Name.aprx'))
for map in aprx.listMaps():
print(' Map: ' + map.name)
for lyr in map.listLayers():
print(' Layer: ' + lyr.name)
if lyr.name == 'The Layer Name whose Labels youd like to enable':
lyr.showLabels = True
aprx.save()
Give this a shot
It works thank you!
Now I can implement it and move on.