I'm using arcpy.mp module, and facing some basic concerns. I would really appreciate if anyone could help out with this.
I ran the code below, and it worked fine. I want to symbolyze the point feature class as graduated color with 5 quantile here.
But I wonder why the last sentence "aprx.saveACopy(r"C:\Users\kenta\Documents\ArcGIS\Projects\CoHRE_Collaboration\Output.aprx)" is needed. I want my code be reflected on the project defined as "aprx", but it is not possible? Do I always need to do saveACopy to reflect the symbology changes? Thank you so much for your help!
from arcpy import env
env.overwriteOutput = True
env.workspace = r"C:\Users\kenta\Documents\ArcGIS\Projects\CoHRE_Collaboration\CoHRE_Collaboration.gdb"
# First, reference the project
aprx = arcpy.mp.ArcGISProject(r"C:\Users\kenta\Documents\ArcGIS\Projects\CoHRE_Collaboration\CoHRE_Collaboration.aprx")
m = aprx.listMaps("Oki")
lyr = m.listLayers("oki2018_point")
sym = lyr.symbology
if hasattr(sym, 'renderer'):
sym.renderer.classificationField = 'SMI2'
sym.renderer.classificationMethod = 'Quantile'
sym.renderer.breakCount = 5
lyr.symbology = sym