<?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: Get Center of Polygon Graphic in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554036#M14196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right, but that is not the center(Centroid) of the polygon itself. Instead it is the center of the polygon's &lt;/SPAN&gt;&lt;STRONG&gt;extent&lt;/STRONG&gt;&lt;SPAN&gt;, or Envelope.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 May 2011 15:45:18 GMT</pubDate>
    <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
    <dc:date>2011-05-09T15:45:18Z</dc:date>
    <item>
      <title>Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554034#M14194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stupid question (I think..)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Graphic that is a polygon.&amp;nbsp; How do I find it's center?&amp;nbsp; It's easy enough to do with the Geometry's extent using the ".GetCenter" method, but there doesn't seem to be one that exists for polygons.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I want to do is find the mapPoint for the center of a specific graphic, which happens to be a polygon.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 15:14:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554034#M14194</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2011-05-09T15:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554035#M14195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since Polygon is derived from Geometry class. You can always do Polygon.Extent.GetCenter().&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 15:42:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554035#M14195</guid>
      <dc:creator>nakulmanocha</dc:creator>
      <dc:date>2011-05-09T15:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554036#M14196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right, but that is not the center(Centroid) of the polygon itself. Instead it is the center of the polygon's &lt;/SPAN&gt;&lt;STRONG&gt;extent&lt;/STRONG&gt;&lt;SPAN&gt;, or Envelope.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 15:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554036#M14196</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2011-05-09T15:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554037#M14197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you want the true centroid of the polygon. I would try using a GP service. I haven't tried but I believe Feature To Point GP tool could do the job.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 16:01:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554037#M14197</guid>
      <dc:creator>nakulmanocha</dc:creator>
      <dc:date>2011-05-09T16:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554038#M14198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The GeometryService is probably a simpler option than GP. Here's an example that does just this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#LabelPoints"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#LabelPoints&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 18:15:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554038#M14198</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2011-05-09T18:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554039#M14199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;there are probably half a dozen reasons not to do it this way that Morten and Co. can point out, but doing it client-side using the extension method below works for me.&amp;nbsp; this gets the centroid based on simple 2D euclidean coordinates.&amp;nbsp; nothing fancy going on at all...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Extension()&amp;gt; _
&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Function GetTruePolygonCenter(ByVal pgnPolygon As Polygon) As MapPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim iNumberOfMapPoints As Integer = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim centroidX As Double = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim centroidY As Double = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each pc As PointCollection In pgnPolygon.Rings
&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;&amp;nbsp;&amp;nbsp; For Each mp As MapPoint In pc
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centroidX += mp.X
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centroidY += mp.Y
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iNumberOfMapPoints += 1
&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;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return New MapPoint(centroidX / iNumberOfMapPoints, centroidY / iNumberOfMapPoints, pgnPolygon.SpatialReference)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try
&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:56:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554039#M14199</guid>
      <dc:creator>LanceCrumbliss</dc:creator>
      <dc:date>2021-12-11T23:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554040#M14200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;there are probably half a dozen reasons not to do it this way that Morten and Co. can point out, but doing it client-side using the extension method below works for me.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;It's depending on what you call 'centroid' and what you are trying to do with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the goal is to place a label on a polygon, the geometry service is the best option since it guarantees that the returned point will be inside the polygon. Nevertheless there is a performance drawback that can be avoided by writing your own code at the client side.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 08:01:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554040#M14200</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-05-10T08:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554041#M14201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;indeed I do use this to calculate a label position at the center and inside of the polygon. it has &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;yet&lt;/SPAN&gt;&lt;SPAN&gt; to fail at that!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;even after using it thousands of times, I suppose I should still stress "yet" though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 09:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554041#M14201</guid>
      <dc:creator>LanceCrumbliss</dc:creator>
      <dc:date>2011-05-10T09:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554042#M14202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As far as I can tell, the aboce code calculates the weighted center. There is no guarantee that this is inside the polygon. For instance try it on a polygon shaped like a "C", or a ring with a hole in the center.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2011 14:51:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554042#M14202</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2011-05-11T14:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554043#M14203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;As far as I can tell, the aboce code calculates the weighted center. There is no guarantee that this is inside the polygon. For instance try it on a polygon shaped like a "C", or a ring with a hole in the center.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;true.&amp;nbsp; i'm sure there's a way to code that, too.&amp;nbsp; i suppose it works better than the GetCenter method though since the latter gets the polygon's extent envelope's centoid.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2011 17:16:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554043#M14203</guid>
      <dc:creator>LanceCrumbliss</dc:creator>
      <dc:date>2011-05-11T17:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Center of Polygon Graphic</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554044#M14204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A good approach might be to calculate a value at the client side (either the barycenter or the center of the envelope, not sure that makes a big difference) and then to check that the point is inside the polygon. If the point is inside the polygon, keep it. If the point is not inside the polygon, use a geometry service to find a better location. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I remember to have seen that in a sample but I don't remember which one!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2011 20:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-center-of-polygon-graphic/m-p/554044#M14204</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-05-11T20:37:10Z</dc:date>
    </item>
  </channel>
</rss>

