Beruflich Dokumente
Kultur Dokumente
Tony Soeller, RESEARCH COMPUTING SUPPORT / NACS / UC IRVINE, MAY 2004 Within a point shapefile, each points coordinates are stored with the shapefile under the shape field. However, those coordinates are not directly readable. You can extract the coordinates and save them into X (or longitude) and Y (or latitude) fields within the shapefiles attribute table. Heres how. 1) In ArcMap open the attribute table for the point shapefile. 2) Click Options > Add Field then add a field with the following characteristics: Name: X_coord Type: Double Precision: 12 Scale: 5 Click OK and the X_coord field will be added to the attribute table. 3) Right-click on the name X_coord in the attribute table, select Calculate Values then click Yes to the message that appears about editing outside an edit session. The Field Calculator window will appear.
4) In the Field Calculator window check the Advanced checkbox then type the following code into the text box under Pre-Logic VBA Script Code: Dim dblX as double Dim pPoint as IPoint Set pPoint = [Shape] dblX = pPoint.X 5) In the window under X_coord simply type dblX then click OK. The X-coordinate value for the points will be written into each cell within the X_coord field. 6) Repeat the procedure for the Y-coordinate by creating a Y_coord field and using the following VBA script code: Dim dblY as double Dim pPoint as IPoint Set pPoint = [Shape] dblY = pPoint.Y Be sure to type dblY in the window under Y_coord within the Field Calculator then click OK. The Y-coordinate value for the points will be written into each cell within the Y_coord field.