<?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 Polygon Centroid Incorrect for Small Polygons in 4.4 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-centroid-incorrect-for-small-polygons-in-4/m-p/235386#M21935</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed a problem with the calculated centroid of a polygon graphic when you draw a very small polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to add a text graphic&amp;nbsp;to the center of a polygon graphic by grabbing the centroid of the polygon when drawing is complete and creating a simple text symbol with the centroid geometry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The polygonGraphic.geometry.centroid.x (and y) property works perfectly when the polygons cover multiple acres, but the smaller they get, the farther outside the polygon the text labels appear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I put together an example of the problem for reference here:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://jsbin.com/wewicon/edit?js,output" title="http://jsbin.com/wewicon/edit?js,output"&gt;JS Bin - Collaborative JavaScript Debugging&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*note: you must draw polygons in the clockwise direction*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also attached a screen grab of the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you zoom in a lot and draw a polygon that is 0 acres, you should notice that the text showing its area is drawn far outside the bounds of the polygon. As far as I can tell this is not a spatial reference issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only fix I've found it to use the&amp;nbsp;polygonGraphic.geometry.extent.center.x property instead of the centroid, which works but is not ideal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know this is kind of a niche problem, but any insight would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Sep 2017 22:17:23 GMT</pubDate>
    <dc:creator>AndrewLindley</dc:creator>
    <dc:date>2017-09-22T22:17:23Z</dc:date>
    <item>
      <title>Polygon Centroid Incorrect for Small Polygons in 4.4</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-centroid-incorrect-for-small-polygons-in-4/m-p/235386#M21935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed a problem with the calculated centroid of a polygon graphic when you draw a very small polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to add a text graphic&amp;nbsp;to the center of a polygon graphic by grabbing the centroid of the polygon when drawing is complete and creating a simple text symbol with the centroid geometry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The polygonGraphic.geometry.centroid.x (and y) property works perfectly when the polygons cover multiple acres, but the smaller they get, the farther outside the polygon the text labels appear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I put together an example of the problem for reference here:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://jsbin.com/wewicon/edit?js,output" title="http://jsbin.com/wewicon/edit?js,output"&gt;JS Bin - Collaborative JavaScript Debugging&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*note: you must draw polygons in the clockwise direction*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also attached a screen grab of the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you zoom in a lot and draw a polygon that is 0 acres, you should notice that the text showing its area is drawn far outside the bounds of the polygon. As far as I can tell this is not a spatial reference issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only fix I've found it to use the&amp;nbsp;polygonGraphic.geometry.extent.center.x property instead of the centroid, which works but is not ideal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know this is kind of a niche problem, but any insight would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Sep 2017 22:17:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-centroid-incorrect-for-small-polygons-in-4/m-p/235386#M21935</guid>
      <dc:creator>AndrewLindley</dc:creator>
      <dc:date>2017-09-22T22:17:23Z</dc:date>
    </item>
  </channel>
</rss>

