<?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: Place labels at points centers in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834220#M3462</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Narelle,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems I found the root cause of the bug. My full workflow is: create layer, change name of label class, set its properties. In your example you get already added layer (after some time after adding, I suppose) and change label class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I insert thread sleep for small amount of time before changing placement, placement will be changed as expected. I believe the problem is related to &lt;A _jive_internal="true" href="https://community.esri.com/thread/234941-featurelayeraddlabelclass-ignores-passed-class-name" target="_blank"&gt;https://community.esri.com/thread/234941-featurelayeraddlabelclass-ignores-passed-class-name&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My workaround at now is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LabelClasses&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ToList&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ForEach&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;RemoveLabelClass&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;AddLabelClass&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LabelClassName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
SpinWait&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;SpinUntil&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LabelClasses&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Any&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; lc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; LabelClassName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that I am able to change placement properties.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:06:46 GMT</pubDate>
    <dc:creator>MaxMax2</dc:creator>
    <dc:date>2021-12-12T10:06:46Z</dc:date>
    <item>
      <title>Place labels at points centers</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834218#M3460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to add label class for points layer and place labels at points centers. My code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; maplexLabelPlacementProperties &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; labelClass&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;GetMaplexLabelPlacementProperties&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;CIMMaplexLabelPlacementProperties&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
maplexLabelPlacementProperties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PointPlacementMethod &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MaplexPointPlacementMethod&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CenteredOnPoint&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
maplexLabelPlacementProperties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CanRemoveOverlappingLabel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
maplexLabelPlacementProperties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CanTruncateLabel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
maplexLabelPlacementProperties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;EnablePointPlacementPriorities &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
labelClass&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;SetMaplexLabelPlacementProperties&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;maplexLabelPlacementProperties&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I explicitly set&amp;nbsp;&lt;STRONG&gt;MaplexPointPlacementMethod.CenteredOnPoint&lt;/STRONG&gt;. But placement is not applied. If I go to Label Classes dock pane, I will see Best position in placement combobox.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible or am I doing something wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:06:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834218#M3460</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2021-12-12T10:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Place labels at points centers</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834219#M3461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Max,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am unable to duplicate this problem, in either ArcGIS Pro 2.3 Final or a pre-ArcGIS Pro 2.4 build.&amp;nbsp; &amp;nbsp;Here is my code (very similar to yours)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;protected override void OnClick()&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;var layer = MapView.Active.Map.Layers.FirstOrDefault() as FeatureLayer;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if (layer == null) return;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;var labelClass = layer.LabelClasses.FirstOrDefault(l =&amp;gt; l.Name == "My label");&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if (labelClass == null) return;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; var maplexLabelPlacementProperties = labelClass.GetMaplexLabelPlacementProperties() ?? new&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CIMMaplexLabelPlacementProperties();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; maplexLabelPlacementProperties.PointPlacementMethod = MaplexPointPlacementMethod.CenteredOnPoint;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; maplexLabelPlacementProperties.CanRemoveOverlappingLabel = false;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; maplexLabelPlacementProperties.CanTruncateLabel = false;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; maplexLabelPlacementProperties.EnablePointPlacementPriorities = false;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass.SetMaplexLabelPlacementProperties(maplexLabelPlacementProperties);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;});&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My label class successfully changes from Best Position to Centered on Point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you perhaps have multiple label classes on this layer and&amp;nbsp;might be showing&amp;nbsp;one of those in the label&amp;nbsp;properties dialog?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2019 01:34:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834219#M3461</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2019-06-11T01:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Place labels at points centers</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834220#M3462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Narelle,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems I found the root cause of the bug. My full workflow is: create layer, change name of label class, set its properties. In your example you get already added layer (after some time after adding, I suppose) and change label class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I insert thread sleep for small amount of time before changing placement, placement will be changed as expected. I believe the problem is related to &lt;A _jive_internal="true" href="https://community.esri.com/thread/234941-featurelayeraddlabelclass-ignores-passed-class-name" target="_blank"&gt;https://community.esri.com/thread/234941-featurelayeraddlabelclass-ignores-passed-class-name&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My workaround at now is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LabelClasses&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ToList&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ForEach&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;RemoveLabelClass&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;AddLabelClass&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LabelClassName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
SpinWait&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;SpinUntil&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LabelClasses&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Any&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; lc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; LabelClassName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that I am able to change placement properties.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:06:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/place-labels-at-points-centers/m-p/834220#M3462</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2021-12-12T10:06:46Z</dc:date>
    </item>
  </channel>
</rss>

