HOW TO
In ArcGIS Pro, the calculation of polygon feature coordinates can enhance spatial query accuracy, facilitate geospatial computations, and support advanced mapping and visualization tasks. However, since the coordinates of a polygon feature, which has an area, are indefinite, the coordinates of a polygon feature are represented by the centroids of the polygons. Centroids are point features that represent the center of the polygon features.
This article details the workflow to calculate the coordinates of polygon features based on their centroids using an ArcGIS Arcade expression in ArcGIS Pro.
//return the geometry of the feature var poly = Geometry($feature); var result = ""; //return the centroid of the polygon feature if (!IsEmpty(poly)) { var pnt_centr = Centroid(poly); Console(pnt_centr); result = "(" + Round(pnt_centr.X, 2) + ", " + Round(pnt_centr.Y, 2) + ")"; } //return the result return result
The image below displays the Coordinate field populated with the coordinates of the polygons based on the map's coordinate system in the attribute table.
Alternatively, specify the following Arcade expression in the expression box to calculate the coordinates in decimal degrees.
function MetersToLatLon(mx, my) { var originShift = 2.0 * PI * 6378137.0 / 2.0; var lon = (mx / originShift) * 180.0; var lat = (my / originShift) * 180.0; lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0); return [lat, lon]; } var poly = Geometry($feature); var result = ""; if (!IsEmpty(poly)) { var pnt_centr = Centroid(poly); var latlon = MetersToLatLon(pnt_centr.x, pnt_centr.y); result = "(" + Round(latlon[0], 6) + ", " + Round(latlon[1], 6) + ")"; } else { result = ""; } return result
The image below displays the Coordinate field populated with the coordinates of the polygons in decimal degrees in the attribute table.
Article ID: 000033014
Get help from ArcGIS experts
Download the Esri Support App