<?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: Strange label placement with LabelClass in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602103#M56336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="https://developers.arcgis.com/javascript/3/samples/layers_label/"&gt;API example&lt;/A&gt; shows the same behaviour.&amp;nbsp; Go to Michigan state in the USA and see for yourself.&amp;nbsp; Your Map Service seems to contain enough information per feature part, even a "homepart" field (which I assume you've tried to use in the where clause for the labelling expression) that might help to define the labelling parts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jun 2016 11:32:43 GMT</pubDate>
    <dc:creator>FC_Basson</dc:creator>
    <dc:date>2016-06-10T11:32:43Z</dc:date>
    <item>
      <title>Strange label placement with LabelClass</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602100#M56333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to add labels to a &lt;EM&gt;FeatureLayer&lt;/EM&gt; with &lt;EM&gt;LabelClass &lt;/EM&gt;on version 3.16 of the javascript API. &lt;/P&gt;&lt;P&gt;I'm just displaying countries with different colors and trying to add the country name as a label.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, some of the labels are placed at very strange places instead of in the center of the country.&lt;/P&gt;&lt;P&gt;I have provided two examples in the attached screenshots.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code which I am using to add the labels:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var featureLayer = new FeatureLayer(featureLayerPath, {
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ['iso_a3', 'iso_a2', 'name']
});
featureLayer.setRenderer(this.renderer); // the renderer is defined earlier and works

var labelSymbol = new this.esri.TextSymbol({
&amp;nbsp;&amp;nbsp;&amp;nbsp; font: new this.esri.Font('10', this.esri.Font.STYLE_NORMAL, this.esri.Font.VARIANT_NORMAL,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.esri.Font.WEIGHT_NORMAL, 'Helvetica'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; color: new this.esri.Color('#000000')
});

var lc = new this.esri.LabelClass({
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelExpressionInfo: {value: '{name}'},
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelPlacement: 'center-center'
});
lc.symbol = labelSymbol;

featureLayer.setLabelingInfo([lc]);

map.addLayer(featureLayer);
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have already tried all possible options for the &lt;EM&gt;labelPlacement&lt;/EM&gt; property, but this doesn't change anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have an idea what I might be doing wrong and how I could do it correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thankful for any help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:49:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602100#M56333</guid>
      <dc:creator>RaphaelDürst</dc:creator>
      <dc:date>2021-12-12T01:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Strange label placement with LabelClass</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602101#M56334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Raphael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Can you share your whole code for debugging?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2016 13:16:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602101#M56334</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-06-09T13:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Strange label placement with LabelClass</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602102#M56335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have uploaded an example of my map to our web server:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.comfone.com/maptest/map.html" title="http://www.comfone.com/maptest/map.html"&gt;Map Test&lt;/A&gt; &lt;/P&gt;&lt;P&gt;And the code for my map is in &lt;A href="http://www.comfone.com/maptest/map.js"&gt;this file&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope, you can work with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raphael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2016 07:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602102#M56335</guid>
      <dc:creator>RaphaelDürst</dc:creator>
      <dc:date>2016-06-10T07:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Strange label placement with LabelClass</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602103#M56336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="https://developers.arcgis.com/javascript/3/samples/layers_label/"&gt;API example&lt;/A&gt; shows the same behaviour.&amp;nbsp; Go to Michigan state in the USA and see for yourself.&amp;nbsp; Your Map Service seems to contain enough information per feature part, even a "homepart" field (which I assume you've tried to use in the where clause for the labelling expression) that might help to define the labelling parts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2016 11:32:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602103#M56336</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2016-06-10T11:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Strange label placement with LabelClass</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602104#M56337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Raphael,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; As each country is a multi-part polygon and not multiple individual polygons, you can not do anything about this issue. If you were to take the polygons and explode them into multiple individual polygons and then assign the homepart of 1 to the largest mass polygon and 0 to the other parts then you could do as &lt;A href="https://community.esri.com/migrated-users/20360"&gt;FC Basson&lt;/A&gt;​ suggests, or use your shapearea calculation for which polygon to label. Right now the JS API will choose which part of the multi-part polygon to label based on proximity to other labels and other unknown criteria.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2016 13:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/strange-label-placement-with-labelclass/m-p/602104#M56337</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-06-10T13:08:25Z</dc:date>
    </item>
  </channel>
</rss>

