Moving points based on actual Lat/Long

1159
1
06-22-2012 08:48 AM
DavidFox
New Contributor III
Could someone update this solution for ArcGIS 10? I've tried it but get the error message: 'ERROR 999999: Error executing function. Expected end of statement. Failed to execute (CalculateField).'

My original question: "I created a point feature class and then manually dotted in points on a map in their approximate location. I have since collected actual Lat/Long for many of the points and would like to spatially adjust them based on the coordinates in the fields 'Latitude' and 'Longitude'. How can I do this?"

I've copied data from the Lat and Long fields into fields named and .

This was the solution from Ray Carnes, ESRI Technical Marketing for Arc9.3.1. What am I missing to get it working for Arc10?


1) In ArcMap, add the feature class to the map and open the attribute table.

2) Start an edit session.

3) Right click on the 'SHAPE' field, Select 'Calculate Values' and enter the following expression into the field calculator (making sure you click 'Advanced' first): (I clicked the 'Show codeblock' in Arc10 and entered this into the 'Prelogic Script code' area)

Dim pPoint As IPoint
Set pPoint = [Shape]
pPoint.X =
pPoint.Y =

Enter the following in the box under 'Shape = ':

pPoint

4) Stop editing and save your changes.

You points will have moved to the locations specified by the data in the fields you used in the expression. If your feature-linked annotation was defined to be modified when the feature is modified, it will move with the point and be located in the same relative position from the point that it was before.

You will have to change the names of the fields to 'Long' and 'Lat' (or whatever you have used) if they are not called X and Y.

Depending on the difference between the original X and Y and the 'new' X and Y, you could see your points move slightly or significantly. If you have any incorrect values in your columns (the work you did in Access), your points may be invalid.

Thanks, Dave
Tags (2)
0 Kudos
1 Reply
MarcinGasior
Occasional Contributor III
You can use Python expression to calculate new geometry in SHAPE column:

Pre-Logic Script Code:
def movePoint(shape, xCoord, yCoord):
  point = shape.getPart(0)
  point.X = xCoord
  point.Y = yCoord
  return point

SHAPE =
movePoint( !SHAPE!, !X!, !Y!)