Select to view content in your preferred language

Using Arcade to calculate xy geometry.

14039
14
Jump to solution
11-21-2019 10:36 AM
AbiDhakal
Occasional Contributor III

Hello GIS friends,

Is there an arcade expression I can use to calculate xy values for a point feature? I am using this (return Round(Geometry($feature)x, 6) expression, but it is not doing the work. My field name is Point_X and Point_Y.

Thank you very much,

Abi

Tags (1)
14 Replies
AbiDhakal
Occasional Contributor III

@Scott 

 

Hey Scott,

I also have a federated service in UTM NAD83 Zone16. I would like to automatically populate x and y fields in decimal degrees as the points are dropped. Would it be possible for us to communicate with emails? Here is my email address: abi.dhakal@forestry.alabama.gov 

Thank you,
Abi 

0 Kudos
AbiDhakal
Occasional Contributor III

@ScottKichman 

Hey Scott,

I tried your expression. The calculation for Latitude is coming out in decimal degrees which is what I want, but it is not converting right for my original service in UTM NAD83 Zone16. The calculation for Longitude is giving me in meters not in decimal degrees. Please see below the expression I used exactly copying what you had. If you know the modification for what I have to have I will greately apprecite it.

Coordinates

//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

 

0 Kudos
ScottKichman
New Contributor III

Hi Abi!

I am not sure why its not working. I just tested it and it worked fine. I also used each individual component(lat) and (Lon) separately in a field calculation using the form builder in the (new) Map Viewer. I created a Latitude Field and a Longitude Field and then applied each section as a field calculation in the form.

 

ScottKichman_0-1677273289169.png

 

0 Kudos
AbiDhakal
Occasional Contributor III

@ScottKichman I'll keep trying, Scott. Also, the difference in mine is I'm trying to convert UTM NAD83 Zone16 to WGS84.
Thank you for your support.
Abi

0 Kudos
AbiDhakal
Occasional Contributor III

@ScottKichman 

Hey Scott,

Earlier, I didn't explain it to you properly. First of all, I'm trying to get Lat/Lon values in NAD 1983 UTM Zone 16N for a point feature and within the same attribute rule trying to convert that to WGS84.

The second one is I'm trying to get lat/Lon values in USA Contiguous Albers Equal Area Conic USGS and then convert that to WGS84.

Thank you,
Abi

0 Kudos