Select to view content in your preferred language

Get Center of Polygon Graphic

6830
10
05-09-2011 08:14 AM
deleted-user-ATjHIWsdQYmT
Regular Contributor
Stupid question (I think..)

I have a Graphic that is a polygon.  How do I find it's center?  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. 

What I want to do is find the mapPoint for the center of a specific graphic, which happens to be a polygon.
0 Kudos
10 Replies
DominiqueBroux
Esri Frequent Contributor
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.

I remember to have seen that in a sample but I don't remember which one!
0 Kudos