ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Add XY Coordinates

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

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

    Caution:

    This tool modifies the input data. See Tools with no outputs for more information and strategies to avoid undesired data changes.

  • 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.

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

  • Current Workspace
  • Extent
  • Output Coordinate System
  • Geographic Transformations

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Features toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal