Using Arcade to calculate xy geometry.

781
7
Jump to solution
11-21-2019 10:36 AM
Highlighted
Occasional Contributor

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)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Esteemed Contributor

Hi Abi Dhakal ,

You are missing a dot "." in the expression, It should be:

Round(Geometry($feature).X, 6)

... but if it is working for you, then I assume it is just a typo. 

You are mentioning WKID 3857 (Web Mercator Auxiliary Sphere) and that you want it in meters. However, this is a spatial reference that already return the coordinate in meters. If you want to obtain decimal degrees (WGS 1984) you can use a conversion to get that. See example here: https://community.esri.com/message/806053-re-latlong-unit-conversion-with-arcade?commentID=806053#co... 

View solution in original post

7 Replies
Highlighted
Occasional Contributor

Hello GIS friends,

This expression worked for me, but it is in meters. How can is change it to  WKID 3857 from within the expression?

Thank you.

Abi

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Abi Dhakal ,

You are missing a dot "." in the expression, It should be:

Round(Geometry($feature).X, 6)

... but if it is working for you, then I assume it is just a typo. 

You are mentioning WKID 3857 (Web Mercator Auxiliary Sphere) and that you want it in meters. However, this is a spatial reference that already return the coordinate in meters. If you want to obtain decimal degrees (WGS 1984) you can use a conversion to get that. See example here: https://community.esri.com/message/806053-re-latlong-unit-conversion-with-arcade?commentID=806053#co... 

View solution in original post

Highlighted
Occasional Contributor

Sorry. I meant to say I have it in NAD_1983_UTM_Zone_16N and like you mentioned I want to obtain decimal degrees (WGS 1948). Would the same expression work with the OriginalShift and all? I'm actually trying to create an attribute rule for the xy fields to auto populate.

Once again I'm sorry for the confusion.

Abi

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Abi Dhakal ,

Unfortunately in Arcade you do not have access to any projection library (yet?). For this in ArcGIS Pro, you can use Python to do the job. Using a projection in a field calculation on a feature basis, might not be very fast. Depending the number of features you have, you might first want to project the featureclass, calculate the X and Y of the geometry and than join back those fields to the original featureclass.

Reply
0 Kudos
Highlighted
Occasional Contributor

Hey Xander,

Morning!

What I am trying to do is create an attribute rule where by any point collected automatically also has its xy calculated in decimal degrees. Is that possible?

Thank you.

Abi

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi AlabamaForest , 

Currently, that is not possible if it requires a projection of coordinates. 

Highlighted
Occasional Contributor

Thank you very much Xander!

Reply
0 Kudos