JohannesRuban

make a feature layer and change his color

Discussion created by JohannesRuban on Jul 26, 2017
Latest reply on Jul 31, 2017 by jyaist-esristaff

Hello, i have trouble with ArcGIS Pro and arcpy.

I want to make a feature layer, change his color and finally add him to the current Map

My Problem is, this Syntax work in Python Window in ArcGIS Pro, but not in my selfmade Tool.

Can someone help me.

 

lyr = arcpy.MakeFeatureLayer_management(r"C:\ArcGIS\Projects\Geologie\local_scene.gdb\aussrtm_Seligenstadt","test")
aprx = arcpy.mp.ArcGISProject("CURRENT")

for m in aprx.listMaps():
        for lyr in m.listLayers():
            if lyr.name == "test":
                sym = lyr.symbology
                sym.renderer.symbol.color = {'RGB': [10, 10, 10, 255]}
                lyr.symbology = sym

Outcomes