Add XY Coordinates (Data Management)

License Level:BasicStandardAdvanced

Summary

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.

Illustration

Add XY Coordinates

Usage

Syntax

AddXY_management (in_features)
ParameterExplanationData Type
in_features

The point features whose x,y coordinates will be appended as POINT_X and POINT_Y fields.

Feature Layer

Code Sample

AddXY example 1 (Python window)

The following Python window script demonstrates how to use the AddXY function in immediate mode.

import arcpy
from arcpy import env

env.workspace = "C:/data"
arcpy.Copy_management("climate.shp", "climateXYpts.shp")
arcpy.AddXY_management("climateXYpts.shp")
AddXY example 2 (stand-alone Python 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)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015