Get center (inside) of graphic instead of extent.getCenter

1353
3
11-09-2011 05:19 AM
JeffPace
MVP Alum
I am having a problem in an application because of a highly irregular (cresent shaped) parcel, that is resulting in a a center point outside of its bounds.

Is there any way to get a center of a feature/graphic inside a polygon (i.e. ArcToolbox Feature to Point with the "Inside (optional)" box checked)?
0 Kudos
3 Replies
derekswingley1
Frequent Contributor
You can use a geometry service's labelPoints method. Or you could use a custom GP service. We don't have a way to do this client side.
0 Kudos
JeffPace
MVP Alum
You can use a geometry service's labelPoints method. Or you could use a custom GP service. We don't have a way to do this client side.


Bummer.  feature request? a getCenter ({inside:true}) method on geometry would be very very useful.
0 Kudos
WeifengHe
Esri Contributor
Calling IArea.LabelPoint will get you a point guaranteed inside the area, while IArea.Centroid will find the center of gravity of the area.  In some cases, when mulitpart polygons, polygons with holes, or irrugular shapes as you encountered, the calculted center will fall outside.  As Derek pointed out, labelpoint is the one you should try.  Because in those cases if you move the point inside, it will no longer be the center.
0 Kudos