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

Blog Post created by geonetadmin on Dec 6, 2011
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


Sisi Y. (with help from Todd S.) - Esri Support Services