Adds the fields POINT_X and POINT_Y to the point input features and calculates their values. It also appends the POINT_Z and POINT_M fields if the input features are Z- and M-enabled.
If the POINT_X, POINT_Y, POINT_Z, and POINT_M fields exist, their values are recalculated.
The output POINT_X and POINT_Y field values are based on the coordinate system of the dataset, not the coordinate system of the map display. To force the POINT_X and POINT_Y values to be in a coordinate system different than the input dataset, set the Output Coordinate System environment.
If points are moved after using Add XY Coordinates, their POINT_X and POINT_Y values, and POINT_Z and POINT_M values—if present—must be recomputed by running Add XY Coordinates again.
The Project tool does not modify the values of POINT_X, POINT_Y, POINT_Z, or POINT_M fields.
If the input features are in a geographic coordinate system, POINT_X and POINT_Y represent the longitude and latitude, respectively.
The point features whose x,y coordinates will be appended as POINT_X and POINT_Y fields.
The updated input features.
AddXY example 1 (Python window)
The following Python window script demonstrates how to use the AddXY function in immediate mode.
import arcpy arcpy.env.workspace = "C:/data" arcpy.Copy_management("climate.shp", "climateXYpts.shp") arcpy.AddXY_management("climateXYpts.shp")
AddXY example 2 (stand-alone script)
The following Python script demonstrates how to use the AddXY function in a stand-alone script.
# Name: AddXY_Example2.py # Description: Adding XY points to the climate dataset # Import system modules import arcpy from arcpy import env # Set workspace env.workspace = "C:/data" # Set local variables in_data= "climate.shp" in_features = "climateXPpts2.shp" # Copying data to preserve original dataset # Execute Copy arcpy.Copy_management(in_data, in_features) # Execute AddXY arcpy.AddXY_management(in_features)
- Basic: Yes
- Standard: Yes
- Advanced: Yes