Digital Spatial Data Clearing House |
Calculating the XY Coordinates for a point shapefile
- Optionally, start an edit session in ArcMap. Calculating a field is faster outside of an edit session, but you won't be able to undo the calculation.
- Open the attribute table of the layer you want to edit.
- Right-click the field heading for the X field (if there is no X field you can add a new field by clicking the Options button and selecting the new field option).
- Click Calculate Values.
- Check Advanced.
- Type the following VBA statement in the first text box.
Dim dblX As Double
Dim pPoint As IPoint
Set pPoint = [Shape]
dblX = pPoint.X
- Type the variable dblX in the text box directly under the X field name.
- Click OK.
You can repeat the same process for updating a field with the y coordinates of each point in the layer.
Tip: The property X returns a field type of double. For best results, your X field should also be a
double field type.
This text comes directly from the ArcGIS help window and can be reached by first locating
"Fields in tables" in the index and then "calculating values".
Return to top of page
Comments for the AGSL? Send them to agsl@uwm.edu.
|