<?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 Re: Create script for advanced feature labelling in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061227#M61228</link>
    <description>&lt;P&gt;I was thinking something along the lines of the following code might work, but it only seems to affect the halo width, all other properties are unchanged:&lt;/P&gt;&lt;P&gt;featurename = arcpy.GetParameterAsText(0)&lt;BR /&gt;labelcolumn = str(arcpy.GetParameterAsText(1))&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;m = aprx.activeMap&lt;/P&gt;&lt;P&gt;for lyr in m.listLayers(featurename):&lt;BR /&gt;lblClass = lyr.listLabelClasses()[0]&lt;BR /&gt;lblClass.expression = "[" + labelcolumn + "]"&lt;/P&gt;&lt;P&gt;# Get the layer's CIM definition&lt;BR /&gt;l_cim = lyr.getDefinition('V2')&lt;/P&gt;&lt;P&gt;# Get first label class&lt;BR /&gt;lc = l_cim.labelClasses[0]&lt;/P&gt;&lt;P&gt;# Set label class symbol properties&lt;BR /&gt;lc.textSymbol.symbol.color = 'white'&lt;BR /&gt;lc.textSymbol.symbol.font = 8&lt;BR /&gt;lc.textSymbol.symbol.haloColor = 'black'&lt;BR /&gt;lc.textSymbol.symbol.haloSize = 1&lt;/P&gt;&lt;P&gt;# Set layer's CIM definition&lt;BR /&gt;lyr.setDefinition(l_cim)&lt;/P&gt;&lt;P&gt;# Show labels&lt;BR /&gt;lyr.showLabels = True&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 04:06:11 GMT</pubDate>
    <dc:creator>DavidField</dc:creator>
    <dc:date>2021-05-25T04:06:11Z</dc:date>
    <item>
      <title>Create script for advanced feature labelling</title>
      <link>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061217#M61227</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to work out if it is possible to create a script for ArcGIS Pro that allows me to turn on labels for a feature, and then lets me control:&lt;/P&gt;&lt;P&gt;-colour&lt;/P&gt;&lt;P&gt;-font size&lt;/P&gt;&lt;P&gt;-halo on / off&lt;/P&gt;&lt;P&gt;-halo colour&lt;/P&gt;&lt;P&gt;-halo width&lt;/P&gt;&lt;P&gt;Ideally the script would have user-defined inputs for all of the above.&lt;/P&gt;&lt;P&gt;It seems that this may be possible in ArcMap, but I can't seem to find any discussion for ArcGIS Pro. Can anyone point me to documentation, code samples or a tutorials that might get me started?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 03:02:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061217#M61227</guid>
      <dc:creator>DavidField</dc:creator>
      <dc:date>2021-05-25T03:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create script for advanced feature labelling</title>
      <link>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061227#M61228</link>
      <description>&lt;P&gt;I was thinking something along the lines of the following code might work, but it only seems to affect the halo width, all other properties are unchanged:&lt;/P&gt;&lt;P&gt;featurename = arcpy.GetParameterAsText(0)&lt;BR /&gt;labelcolumn = str(arcpy.GetParameterAsText(1))&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;m = aprx.activeMap&lt;/P&gt;&lt;P&gt;for lyr in m.listLayers(featurename):&lt;BR /&gt;lblClass = lyr.listLabelClasses()[0]&lt;BR /&gt;lblClass.expression = "[" + labelcolumn + "]"&lt;/P&gt;&lt;P&gt;# Get the layer's CIM definition&lt;BR /&gt;l_cim = lyr.getDefinition('V2')&lt;/P&gt;&lt;P&gt;# Get first label class&lt;BR /&gt;lc = l_cim.labelClasses[0]&lt;/P&gt;&lt;P&gt;# Set label class symbol properties&lt;BR /&gt;lc.textSymbol.symbol.color = 'white'&lt;BR /&gt;lc.textSymbol.symbol.font = 8&lt;BR /&gt;lc.textSymbol.symbol.haloColor = 'black'&lt;BR /&gt;lc.textSymbol.symbol.haloSize = 1&lt;/P&gt;&lt;P&gt;# Set layer's CIM definition&lt;BR /&gt;lyr.setDefinition(l_cim)&lt;/P&gt;&lt;P&gt;# Show labels&lt;BR /&gt;lyr.showLabels = True&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 04:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061227#M61228</guid>
      <dc:creator>DavidField</dc:creator>
      <dc:date>2021-05-25T04:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create script for advanced feature labelling</title>
      <link>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061229#M61229</link>
      <description>&lt;P&gt;I just add tags. See this:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/text-formatting-tags.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/text-formatting-tags.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you change the expression only.&lt;/P&gt;&lt;P&gt;It works for me&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 05:12:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061229#M61229</guid>
      <dc:creator>mody_buchbinder</dc:creator>
      <dc:date>2021-05-25T05:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create script for advanced feature labelling</title>
      <link>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061230#M61230</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;I had a look at tags, they look much more user-friendly, however I don't think they will allow me to adjust halo settings?&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 05:17:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-script-for-advanced-feature-labelling/m-p/1061230#M61230</guid>
      <dc:creator>DavidField</dc:creator>
      <dc:date>2021-05-25T05:17:34Z</dc:date>
    </item>
  </channel>
</rss>

