Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the JavaScript API 1.6 on ArcGIS 9.3. I have a polygon geometry in an ArcGIS map, and I'm trying to find a way to get the point that lies in the exact center of the geometry. What is the best way to do this?


share|improve this question
up vote 1 down vote accepted

Each instance of geometry (esri.geometry.Geometry) has a method called getExtent() which returns the extent of the geometry (polygon in your example). esri.geometry.Extent has a method called getCenter() that returns a point.

So you could do something like:

var myPolygonCenterLatLon = myPolygon.getExtent().getCenter();

You could alternatively calculate the centroids to polygons beforehand in ArcMap. Then host the layer which has a one-to-one relationship with the polygons.

share|improve this answer
That will only calculate the center of the extent, and not the center of the actual polygon. Additionally, the center of the extent may not actually fall in the polygon. – Sasa Ivetic Mar 31 '11 at 18:28
If you're referring to my first solution, yes. But that might not matter. – CaptDragon Mar 31 '11 at 18:31
This is what I'm looking for - thanks! – AndyGeek Apr 1 '11 at 14:27
This answer does not guarantee a the point fall inside a circle or U shape polygon. – Zhenyang Hua Jul 21 at 19:48

You could set up a model in Model Builder to use the Feature to Point tool (in ArcToolbox), export the script (JScript), and call it in your code.

share|improve this answer

This an updated version (2.2 Javascript API)

This example finds the centre point of the polygon to label the coordinates

This uses the Geometry Service

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.