Instructions provided describe how to use ArcMap to calculate the latitude and longitude for points in a point feature class.
In ArcGIS 10.1 and later versions, the Calculate Geometry tool can be used to provide the latitudes and longitudes of a point feature class.
In ArcGIS 9.x and 10.0, by using VBA Script Code in the Field Calculator, a field of type double can be populated with latitude or longitude values.
ArcGIS 10.1 and later versions:
- Open the attribute table of the point feature class in ArcMap. Do not start an edit session.
- Click the Table Options drop-down button, and select Add Field.
- In the Add Field window, name the field Lat (for latitude), with type Double. Click OK. Repeat this step and create another field named Long (for longitude).
- Start an edit session (Editor drop-down > Start Editing).
- Highlight the Lat field, right-click the header, and select Calculate Geometry.
- In the Calculate Geometry window, ensure that Property lists the Y Coordinate of Point, and to use the coordinate system of the data frame or feature layer. Set the Units as desired (in this scenario, Decimal Degrees). Click OK.
- Repeat steps 5 and 6, applying the X Coordinate of Point property to the Long field.
- The Lat and Long fields are populated with latitudinal and longitudinal data.
ArcGIS 9.x / 10.0:
- Add a field of type Double to the attribute table to store either latitude or longitude values.
- Start an edit session.
- Open the attribute table.
- Right-click the field and select Calculate Values.
- Check the Advanced check box.
- Paste the following code into the Pre-Logic VBA Code box:
Dim Output As Double
Dim pPoint As IPoint
Set pPoint = [Shape]
Output = pPoint.X
The above code is for calculating longitude. X should be changed to Y to calculate latitude values.
- Type Output into the lower text box.
- Click OK.