Set "Scale Symbols" of a layer with Python

810
2
Jump to solution
11-05-2021 11:16 AM
dstrigl
New Contributor III

Hi community,

any idea how I can set the property "Scale Symbols" of a layer to true or false?

I didn't find anything in the doc.

Regards,

Daniel.

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

not everything is exposed

Python CIM access—ArcGIS Pro | Documentation

so you have to look carefully

"layerDefinitions" : [
    {
      "type" : "CIMFeatureLayer",
      "name" : "GreatLakes",
      "uRI" : "CIMPATH=map/greatlakes.xml",
      "useSourceMetadata" : true,
      "description" : "GreatLakes",
      "layerType" : "Operational",
      "showLegends" : true,
      "visibility" : true,
      "displayCacheType" : "Permanent",
      "maxDisplayCacheAge" : 5,
      "showPopups" : true,
      "serviceLayerID" : -1,
      "autoGenerateFeatureTemplates" : true,
      "featureElevationExpression" : "0",
      "featureTable" : {
      "htmlPopupEnabled" : true,
      "selectable" : true,
      "featureCacheType" : "Session",
      "scaleSymbols" : true,
      "snappable" : true

 .... notice line 21 


... sort of retired...

View solution in original post

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

not everything is exposed

Python CIM access—ArcGIS Pro | Documentation

so you have to look carefully

"layerDefinitions" : [
    {
      "type" : "CIMFeatureLayer",
      "name" : "GreatLakes",
      "uRI" : "CIMPATH=map/greatlakes.xml",
      "useSourceMetadata" : true,
      "description" : "GreatLakes",
      "layerType" : "Operational",
      "showLegends" : true,
      "visibility" : true,
      "displayCacheType" : "Permanent",
      "maxDisplayCacheAge" : 5,
      "showPopups" : true,
      "serviceLayerID" : -1,
      "autoGenerateFeatureTemplates" : true,
      "featureElevationExpression" : "0",
      "featureTable" : {
      "htmlPopupEnabled" : true,
      "selectable" : true,
      "featureCacheType" : "Session",
      "scaleSymbols" : true,
      "snappable" : true

 .... notice line 21 


... sort of retired...
0 Kudos
dstrigl
New Contributor III

Thanks a lot for the hint!

I have done it now the following way:

project = arcpy.mp.ArcGISProject("current")
map = project.listMaps("Map")[0]
layer = map.listLayers(...)[0]
l_cim = layer.getDefinition("V2")
l_cim.scaleSymbols = False
l_cim.visibility = False
layer.setDefinition(l_cim)

Regards,

Daniel.

0 Kudos