Update points position based on new XY coordinates. ArcGIS Pro 2.8

3886
8
Jump to solution
11-16-2021 11:54 PM
MarcusNielsen
New Contributor II

 

Hello

I have created a points feature class from a spreadsheet with the Add data-> XY Point data.
I have since gotten an updated spreadsheet where some of the points have new X and Y coordinates. 

Is there a way to update the position of the old points based on the new coordinates?

 

Thank you

0 Kudos
2 Solutions

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

I am assuming your xy event theme is not a featureclass.

You could join the new data to the old data using the ID field and use the field calculator to copy over the x, y coordinates from the new data's fields to the old data's x, y fields, then.... add the table as an X Y event theme. If it works, then copy features to a new feature class since the shape field won't get updates in a featureclass


... sort of retired...

View solution in original post

Sean_Wray
Occasional Contributor

You could map the new data the same way you did the original data. Then since there is a common ID field, you could then join the original data to the new data, calculate your fields if necessary to make the new data match the original data, and then your point locations will be updated.

View solution in original post

8 Replies
DanPatterson
MVP Esteemed Contributor

Is the new data just the updated point locations and their data?

Has an id or some other key field been used in the spreadsheet that would facilitate joins? 


... sort of retired...
0 Kudos
MarcusNielsen
New Contributor II

Yes the new data is the just the updated coordinates.

They do have an ID field attached to them.

0 Kudos
DanPatterson
MVP Esteemed Contributor

I am assuming your xy event theme is not a featureclass.

You could join the new data to the old data using the ID field and use the field calculator to copy over the x, y coordinates from the new data's fields to the old data's x, y fields, then.... add the table as an X Y event theme. If it works, then copy features to a new feature class since the shape field won't get updates in a featureclass


... sort of retired...
Sean_Wray
Occasional Contributor

You could map the new data the same way you did the original data. Then since there is a common ID field, you could then join the original data to the new data, calculate your fields if necessary to make the new data match the original data, and then your point locations will be updated.

by Anonymous User
Not applicable

As said before join the new data to the old data using an ID field. Fields containing new x and y values is named x_new and y_new. Then With Calculate Field use a python expression...

Field Name (Existing or New):
SHAPE

Expression:
shiftCoordinates(!SHAPE!,!x_new!,!y_new!)

Code block:
def shiftCoordinates(shape,x_new,y_new):
    point = shape.getPart(0)
    point.X = x_new
    point.Y = y_new
    return point

Hit Run and the geometry is updated.

0 Kudos
CCMM
by
New Contributor II

The Calculate Field using the "shiftCoordinates" expression does not move the points, does it? Doesn't that just update the coordinates in the attribute table?

0 Kudos
CCMM
by
New Contributor II

If anyone (including OP) is still watching this thread... I have the same problem except in my case I have photos attached to the feature class in the geodatabase and now I need to update the location of those points (about 1,000 of them) to the X,Y coordinates (lat/long) in the attribute table.  


So what I need to do is run a tool that will move the points to the latitude and longitude I already have specified in the attribute table for each point. This seems like such a simple task for GIS and one that people run into often, but I cannot find any solutions. 

HELP!!

0 Kudos
CCMM
by
New Contributor II

I figured out a solution using UpdateCursor that was actually really simple! See script below.

import arcpy

 

# Set the local parameters

inFeatures = "Survey"

 

# Move the Features

with arcpy.da.UpdateCursor(inFeatures, ["SHAPE@XY","Longitude","Latitude"]) as cursor:

    for row in cursor:

        row[0] = ([row[1],row[2]])

        cursor.updateRow(row)

0 Kudos