<?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: Label placement over other features and labels in ArcGIS Pro in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1039713#M60534</link>
    <description>&lt;P&gt;Thanks, but&amp;nbsp;it still doesn't work properly.&amp;nbsp;I need the label stay inside the polygon, even if the polygon overlaps with another polygon.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Mar 2021 11:14:43 GMT</pubDate>
    <dc:creator>anyry</dc:creator>
    <dc:date>2021-03-23T11:14:43Z</dc:date>
    <item>
      <title>Label placement over other features and labels in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1037572#M60439</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I need place labels regardless of collisions with other layers. I use ArcPy and CIM. I need to place the label in the center of the polygon. At the same time, I need it not to change its position or disappear if it collides with another labels or feature. I try this code, but some labels are placed outside the polygons.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lang-py s-code-block hljs python"&gt;show_labels = m.listLayers(&lt;SPAN class="hljs-string"&gt;"polygon23*"&lt;/SPAN&gt;)[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;]
show_labels.showLabels = &lt;SPAN class="hljs-literal"&gt;True&lt;/SPAN&gt;

&lt;SPAN class="hljs-keyword"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="hljs-keyword"&gt;in&lt;/SPAN&gt; m.listLayers(&lt;SPAN class="hljs-string"&gt;"polygon23*"&lt;/SPAN&gt;):
        &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; lyr.supports(&lt;SPAN class="hljs-string"&gt;"SHOWLABELS"&lt;/SPAN&gt;):
            &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; lyr.showLabels:
                &lt;SPAN class="hljs-keyword"&gt;for&lt;/SPAN&gt; lblClass &lt;SPAN class="hljs-keyword"&gt;in&lt;/SPAN&gt; lyr.listLabelClasses():
                    lblClass.expression = &lt;SPAN class="hljs-string"&gt;''' "&amp;lt;FNT size='6'&amp;gt;" + $feature.label + "&amp;lt;/FNT&amp;gt;"'''&lt;/SPAN&gt;
                    
                    
label_show = m.listLayers(&lt;SPAN class="hljs-string"&gt;'polygon23*'&lt;/SPAN&gt;)[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;]
l_cim = label_show.getDefinition(&lt;SPAN class="hljs-string"&gt;'V2'&lt;/SPAN&gt;)
lc = l_cim.labelClasses[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;]

lc.maplexLabelPlacementProperties.polygonPlacementMethod = &lt;SPAN class="hljs-string"&gt;'StraightInPolygon'&lt;/SPAN&gt;
lc.maplexLabelPlacementProperties.placeOnlyInsidePolygon = &lt;SPAN class="hljs-literal"&gt;True&lt;/SPAN&gt;
lc.CIMStandardLabelPlacementProperties = &lt;SPAN class="hljs-string"&gt;'allowOverlappingLabels'&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Mar 2021 13:02:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1037572#M60439</guid>
      <dc:creator>anyry</dc:creator>
      <dc:date>2021-03-17T13:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Label placement over other features and labels in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1037586#M60440</link>
      <description>&lt;P&gt;One thing to watch out for: the default value for &lt;STRONG&gt;canOverrunFeature&lt;/STRONG&gt; tends to be 80 points, which can allow labels to be placed outside of the polygon, even when you've turned on the setting that would apparently disallow this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1615988600449.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8689i25E7DEB4273B75AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1615988600449.png" alt="jcarlson_0-1615988600449.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would also suggest setting &lt;STRONG&gt;enablePolygonFixedPosition&lt;/STRONG&gt; to "True", then set the &lt;A href="https://github.com/Esri/cim-spec/blob/master/docs/v2/CIMLabelPlacement.md#cimmaplexinternalzonepriorities" target="_self"&gt;internal zone priorities&lt;/A&gt; such that &lt;STRONG&gt;center&lt;/STRONG&gt; is the only non-zero option, thus forcing your labels to render at the center of the polygon, no matter what.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 13:49:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1037586#M60440</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-03-17T13:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Label placement over other features and labels in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1039713#M60534</link>
      <description>&lt;P&gt;Thanks, but&amp;nbsp;it still doesn't work properly.&amp;nbsp;I need the label stay inside the polygon, even if the polygon overlaps with another polygon.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 11:14:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/label-placement-over-other-features-and-labels-in/m-p/1039713#M60534</guid>
      <dc:creator>anyry</dc:creator>
      <dc:date>2021-03-23T11:14:43Z</dc:date>
    </item>
  </channel>
</rss>

