Select to view content in your preferred language

Get the X Coordenate in Arcade

284
4
04-19-2024 12:45 PM
SoniaUguna_Urgilés
New Contributor II

Hi, comunity

I ‘m using this statement in Arcade to calculate the X Coordinate:

var x = Round(Geometry($feature).X,6)

But, I have this error message.

Execution Error:Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.

 

My map have the Coordenate System: WGS 1984 UTM Zone 17S.

 

Help me, please

 

Thanks.

0 Kudos
4 Replies
CodyPatterson
Regular Contributor

Hey @SoniaUguna_Urgilés 

Would this possibly work for you?

var spatialRef = SpatialReference(32717);
var x = Round(Geometry($feature, spatialRef).X, 6);

Cody

0 Kudos
SoniaUguna_Urgilés
New Contributor II

Hi, 

I used your suggestion, but, I have the following error message:

Execution Error:Runtime Error: Function Not Found: SpatialReference

I am using ArcGIS Enterprise Standard version 10.8, Maybe it can be the cause of the error?.

 

Thanks.

 

0 Kudos
CodyPatterson
Regular Contributor

Hey @SoniaUguna_Urgilés

My apologies, it seems I'm thinking of another function, I copied your setup into a map, and created a feature class point with the same spatial reference, I then added a point somewhere in Brazil and attempted to use the functions, I was able to get it working without issue. I was curious if you would be able to use these functions and see if everything lines up, specifically the spatial reference of the map itself along with the point class.

CodyPatterson_0-1713958109941.png

Console(GetEnvironment())
Console("\n")
Console(Geometry($feature))
Console("\n")
Console(Geometry($feature).spatialreference)
Console("\n")
Console(Geometry($feature).x)
Console("\n")
Console(Round(Geometry($feature).X,6))

The arrow indicates the engine running, which is the correct spatial reference, and the highlights reveal the map and point spatial reference, please return with your results so we can figure this out further!

Hope that helps!

Cody

0 Kudos
SoniaUguna_Urgilés
New Contributor II

Hi Cody

Thank you for your support, but I still have the same error.

Execution Error:Runtime Error: Function Not Found: GetEnvironment

The GetEnvironment function has been used since version 1.23, and this version of Arcade has been used since version 11.2 of ArcGis Enterprise Server. I am working on version 10.8.  😢

0 Kudos