<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcPy - retrieve scale-based symbol class min/max scales in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1283912#M68551</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.8.1, Python either in notebook or IDLE.&lt;/P&gt;&lt;P&gt;I'm trying to create simple tool to list layer properties of any given aprx/mapx.&amp;nbsp; I'm happy enough with retrieving the basic layer properties needed, however I can't seem to find a way of accessing unique symbol scale settings.&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/scale-based-symbol-classes.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/scale-based-symbol-classes.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've had a look at the unique value renderer Class but can't see anything jumping out at me.&amp;nbsp; Also thinking of complications where scale-based symbology is set up..&lt;/P&gt;&lt;P&gt;Any ideas much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#simple script to get layer scale
import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
for lyr in m.listLayers():
    if lyr.supports("dataSource"):
        print(lyr.name, lyr.minThreshold, lyr.maxThreshold)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Apr 2023 15:03:04 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2023-04-28T15:03:04Z</dc:date>
    <item>
      <title>ArcPy - retrieve scale-based symbol class min/max scales</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1283912#M68551</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.8.1, Python either in notebook or IDLE.&lt;/P&gt;&lt;P&gt;I'm trying to create simple tool to list layer properties of any given aprx/mapx.&amp;nbsp; I'm happy enough with retrieving the basic layer properties needed, however I can't seem to find a way of accessing unique symbol scale settings.&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/scale-based-symbol-classes.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/scale-based-symbol-classes.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've had a look at the unique value renderer Class but can't see anything jumping out at me.&amp;nbsp; Also thinking of complications where scale-based symbology is set up..&lt;/P&gt;&lt;P&gt;Any ideas much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#simple script to get layer scale
import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
for lyr in m.listLayers():
    if lyr.supports("dataSource"):
        print(lyr.name, lyr.minThreshold, lyr.maxThreshold)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 15:03:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1283912#M68551</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-04-28T15:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy - retrieve scale-based symbol class min/max scales</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1284096#M68571</link>
      <description>&lt;P&gt;You have to dive into the CIM for that.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def get_min_max_scale(layer):
    result = dict()
    cim = layer.getDefinition('V3')
    renderer = cim.renderer
    try:
        symbol_classes = renderer.groups[0].classes
    except (AttributeError, IndexError):
        print("Symbology not applicable!")
        symbol_classes = []
    for sc in symbol_classes:
        result[sc.label] = [sc.symbol.minScale, sc.symbol.maxScale]
    return result


lyr_with_unique_symbols = arcpy.mp.ArcGISProject("current").activeMap.listLayers("TestPoints")[0]
get_min_max_scale(lyr_with_unique_symbols)
#{'capital': [0.0, 0.0], 'city': [500000, 0.0], 'town': [100000, 0.0], 'village': [50000, 0.0]}

lyr_with_single_symbol = arcpy.mp.ArcGISProject("current").activeMap.listLayers("TestLines")[0]
get_min_max_scale(lyr_with_single_symbol)
#Symbology not applicable!
#{}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 Apr 2023 21:29:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1284096#M68571</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-28T21:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy - retrieve scale-based symbol class min/max scales</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1284102#M68574</link>
      <description>&lt;P&gt;Absolute genius, thanks Johannes!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 21:49:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-retrieve-scale-based-symbol-class-min-max/m-p/1284102#M68574</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-04-28T21:49:22Z</dc:date>
    </item>
  </channel>
</rss>

