Hello,

I have arcgis pro 2.7.2 and sde point feature class..using attribute rule for X and Y in decimal degrees (DD). I found two different scripts from geonet. Please see issues and screenshots below. Please advise. Thank you.

**Script #1** one field type text and 100 characters ATTRUBUTE RULE. nothing happen.

```
var polyx = text(centroid($feature).x);
var polyy = text(centroid($feature).y);
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 latlon = "";
var result = "";
var latlon = metersToLatLon(polyx, polyy);
result = Round(latlon[0], 6) + ', ' + Round(latlon[1], 6);
return result;
```

**Script # 2** TWO fields x and y. DOUBLE(38, 8). It is populated but not the correct DD number.

it displays 7.1233 and 4.1234 something. But it is supposed to be -80 and 25 something.

```
//Latitude
var y = Centroid($feature).y
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return lat
```

```
//Longitude
var x = Centroid($feature).x
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
return lon
```

But then I tried to add **calculate geometry tool **and **add geometry attribute tool** manual. I got both same error.