How to calculate points geometry from x and y fields using Arcade

11-06-2020 10:37 AM
Esri Contributor


I need to calculate the geometry of a point feature based on the coordinates in the X and Y fields in the attribute table.

In the case below, I am replacing the existing Geometry. The configuration in the Field Calculator to do this looks like this:

Once I apply this, the existing point disappears from the map where I'd expect it to display in a new location based on the X and Y coordinates. 

What am I doing wrong here?

Appreciate your assistance.

Tags (2)
7 Replies
Esri Frequent Contributor

Albertus - couldn't you use the XY Table to Point (Data Management) GP tool instead to create a new feature class based upon the Point_X and Point_Y fields instead of recalculating the Shape field?  Would that work better?

0 Kudos
Esri Contributor

Hi Robert,

This is a Point feature class so not able to use the table to point tool. The idea here is that I add this arcade script in a Attribute rule in the geodatabase, where features will be inserted and upon insert, the point geometry is to be calculated.

Hope that explains it.

Esri Esteemed Contributor

Hi @Alber_Verster ,


Can you elaborate a little more on the idea of using this in an attribute rule? An attribute will be triggered by a defined event. Does this event take place in the featureclass where you want to update the geometry or does this take place inside a different featureclass? If the latter is true it will require a whole different expression. 

Some examples can be found here: 



Esri Contributor

Hi Albert

I don't think you could replace the existing geometry field but might try to create a query layer instead.



0 Kudos
MVP Frequent Contributor

I've just had a play with Arcade and I too could not achieve the updating of the Shape field; may be it's not possible or if it is, it is not well documented as I could not find anything on the Help file.

That said it is completely achievable with python, this worked:


The code block is:

def replacepoint(x,y):
    sr = arcpy.SpatialReference(27700)
    point = arcpy.Point(x,y)
    pg = arcpy.PointGeometry(point,sr)
    return pg


0 Kudos
Esri Esteemed Contributor

Hi @DuncanHornby and @Alber_Verster 


A field calculation is something different from an Calculation Attribute Rule. It is definitely possible to update a geometry using a Calculation Attribute Rule as described here: 

0 Kudos
by Anonymous User
Not applicable

Yeah, I was testing the arcade expression using the field calculator before I setup the Attribute Rule in the EGDB on the point feature class.

Eventually I got it to working although I had to create a new point feature class table with the projection set as WGS84 (WKID 4326).

var new_point = {
"x": $feature.longitude,
"y": $feature.latitude,
"z": 0,
"spatialReference": { "wkid": 4326}};



With decimal degrees populating into the Latitude and Longitude fields, upon the record's insert into the table, the geometry is calculated and the point displays in the correct location.

For some reason this does not work for projected points in a Transverse Mercator type feature class and I have not found out why that is.