ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS 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
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Add XY Coordinates

Available with Advanced license.

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

Summary

Adds the items X-COORD and Y-COORD for labels or points to the input coverage PAT, or for nodes to the input coverage NAT, and calculates their values.

The tool determines the feature classes of the input coverage and lists those available to which x,y coordinates can be added. The tool is most commonly used to gain access to a coverage's geometry to perform queries and analysis or to extract points or nodes based on their x,y location.

Illustration

Add XY illustration

Usage

  • If the items X-COORD and Y-COORD already exist, they will be overwritten.

  • If the input coverage is single precision, the items will be defined with Item width 4, Display width 12, Item type F, and Decimal places 3. If the input coverage is double precision, the items will be defined with Item width 8, Display width 18, Item type F, and Decimal places 5. Once defined, this definition will not change even if the derived precision is changed.

  • If the point or node locations are moved after using Add XY Coordinates, the X-COORD and Y-COORD values will not represent the new locations. To update their values to the new location, rerun the tool. The values for X-COORD and Y-COORD are not modified by other tools, such as Project and Transform.

  • If your input coverage is in a geographic coordinate system, the X-COORD and Y-COORD represents the longitude and latitude, respectively.

Syntax

arcpy.arc.AddXY(in_cover, {feature_type})
ParameterExplanationData Type
in_cover

The coverage containing points or polygon labels whose x,y coordinates will become attributes in the PAT, or in the coverage containing nodes, to the NAT.

Coverage
feature_type
(Optional)

Type of coverage feature whose x,y coordinates will become feature attributes.

  • POINT —Point feature coordinates to be added to the PAT including label points. This is the default option.
  • NODE —Node feature coordinates to be added to the NAT.
String

Code sample

AddXY example (stand-alone script)

The following stand-alone script demonstrates how to add X-COORD and Y-COORD items to a coverage's PAT. The items are populated with the coordinate values from the coverage's point features.

# Name: AddXY_Example.py
# Description: Adds X and Y coordinates to a coverage's point attribute table
# Requirements: ArcInfo Workstation

# Import system modules
import arcinfo
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
inCover = "wells"
featureType = "POINT"

#Execute AddXY
arcpy.AddXY_arc(inCover, featureType)

Environments

  • Current Workspace
  • Level Of Comparison Between Projection Files
  • Precision For Derived Coverages
  • Precision For New Coverages
  • Scratch Workspace

Licensing information

  • Basic: No
  • Standard: No
  • Advanced: Requires ArcInfo Workstation installed

Related topics

  • An overview of the Tables toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal