How to Update the Location of a Point Feature and Its XY Fields

22264
8
12-06-2011 12:28 PM
Labels (1)
by Anonymous User
Not applicable
3 8 22.3K
Wouldn’t it be wonderful if we lived in a world where our boss just handed us a 100 percent accurate table of XY data so that we could generate the point feature class using the “Display XY” tool and be done?

Hey, we can dream can't we?

In the real world, though, you’ll probably find that the XY locations you were asked to plot were not 100 percent accurate. The story usually goes like this:

“Two days after creating a point feature class from thousands of XY locations, my boss walked into my office and gave me updated XY information for a few specific points. Now, I have to update these locations on the table and recreate the feature class, or I have to create a feature class using the new table and then append the two. This sure is a lot of work!”


Well, read on, because I’m about to make your world a little brighter! It’s actually not too hard or too much work to handle these update-type jobs!

Running geoprocessing tools on thousands or even hundreds-of-thousands of features to update just a few points can be slow, depending on the size of the data. Consider the following alternative workflow when updating XY locations.Example: You have a feature class called ‘S’ that has 105 point features. You received a new XY table that has updated locations for 13 points. Update the point locations by doing the following:
  1. Bring the ‘S’ feature class into ArcMap.
  2. Add both the ‘Editor’ toolbar and the ‘Edit Vertices’ toolbar to the map document.
  3. Start an editing session using the ‘S’ Feature template.
  4. Select a point that needs to be updated either interactively (using the Edit Tool) or via a query (using the Select by Attribute function).
  5. On the ‘Edit Vertices’ toolbar, click on the Sketch Properties tool.
  6. Update the XY values and the points location will automatically change.

Now, we know the points are placed in the new “exact” locations, but the X and Y fields still need to be updated. How can the X and Y fields be updated for just these few features?

To update the XY fields in the attribute table, do the following:
  1. Select all of the points that need updated X and Y field information either interactively or via a query.
  2. Open the attribute table and right-click the Shape field. Open the field calculator.
  3. Using the python parser, load the python code (like the script shown below), and the job is done!
Sample Script
def XYsetVALUE( shape, X_value, Y_value):
point = shape.getPart(0)
point.X = X_value
point.Y = Y_value
return point

__esri_field_calculator_splitter__
XYsetVALUE ( !SHAPE!, !X_COORD!, !Y_COORD! )

Sisi Y. (with help from Todd S.) - Esri Support Services
8 Comments
RichThomas2
New Contributor II

Similar to this scenario, is there an easy way (in as few steps as possible) to move all points in a feature class to new Latitudes/Longitudes which have been updated in the table attributes. For example, I originally imported a CSV with Latitudes/Longitudes and used Display XY Data... to create the feature points. Later, I got new Latitudes/Longitudes for most of them and so I joined the new table to the original table and used Field Calculator to update the Latitudes/Longitudes attributes in the original table. Now it would be nice if I could just Display XY Data... again, but that is not an option in a feature class. Is there a tool to recreate the points in a feature class using the current Latitudes/Longitudes in the table? Thanks

JonathanQuinn
Esri Frequent Contributor

Two approaches you can use:

1) Python

   Using Python, join the tables and use a combination of the Writing geometries and the UpdateCursor examples to update the geometries of the old points with the lat/long of the new points.

2) GP tool/UI tools

   Join the tables, export the attributes to a table, and then Display XY data.

But if the new CSV has the new geometry and the correct attribute values, what about truncating the original feature class, use the Display XY data to create points from the new CSV, and then append to the original data?

RichThomas2
New Contributor II

Thank you Jonathan 

I left out some details for simplicity in my example, but the reason I didn't Display XY data to create points from the new CSV, and then append to the original data is because the new CSV did not contain all the fields as in the original table, and there has been a lot of manual updating to the attributes of the original table that I don't wan to loose - even some Latitudes/Longitudes have been manually updated. Essentially I was looking for fewer steps to move the existing points in the existing layer to the current XY coordinates than what it takes to export the attribute table to Excel, convert to CSV, add the CSV to the workspace, Display XY data to create an event, and then export data to create another feature layer. Sounds like that's the best way to do it though, without getting into Python. Thanks again.

NW-AllyBuccanero-GISS
New Contributor III

Alternatively, to update the x/y values in your attribute table after moving points in an editing session, simply open your attribute table, highlight the field for your x value, right click, and Calculate Geometry. Do the same for your y value field. Select all edited points in your attribute table to update multiple points after editing. 

arcgis desktop - Update xy fields when I move points? - Geographic Information Systems Stack Exchang... 

RichThomas2
New Contributor II

Thanks Allyson, but that is the opposite of what I need to do. I have good X/Y coordinates in the attribute, which have been updated by some workflow, or just manually edited. But the existing points are still located at the original X/Y coordinates. I want to make the existing points move to the updated X/Y coordinates in the attribute table. Thanks

NW-AllyBuccanero-GISS
New Contributor III

I came across this post while trying to fix my x,y attributes, hopefully this little tidbit helps streamline the process of figuring it out from both angles! 

AdelaideZumwalt1
Occasional Contributor II

Points moved successfully. I'd like to move endpoints of lines in addition (outside a geometric network) - is there a way to do this ? This is giving me the error.

AngelaNicholson
New Contributor

Have any one  figured out how to get this script to run ? I am getting the 99999 error also.