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

Make XY Event Layer

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

Summary

Creates a new point feature layer based on x- and y-coordinates defined in a source table. If the source table contains z-coordinates (elevation values), that field can also be specified in the creation of the event layer. The layer created by this tool is temporary.

Learn more about adding x,y coordinate data to a map

Usage

  • The output point feature layer created by this tool is temporary and will not persist after the session ends. You can export this event layer to a feature class on disk using the Copy Features, Feature to Point, or Feature Class to Feature Class tool.

  • It is not possible to interactively move the output layer's points through editing controls, since event layers are not editable. Alternatives to directly moving these points are to change the x- and y-coordinate attributes in the input table, then re-create the event layer, or save the event layer to a feature class on disk, then perform edits on the feature class.

  • The standard delimiter for tabular text files with extensions .csv or .txt is a comma, and for files with a .tab extension, a tab. To use an input table with a nonstandard delimiter, you must first specify the correct delimiter used in the table using a schema.ini file.

    Learn more about working with tabular text files

  • If the input table does not have an ObjectID field, you will not be able to make selections or add joins to the resulting layer. Many delimited text files or tables from OLE DS connections do not have ObjectID fields.

Syntax

MakeXYEventLayer_management (table, in_x_field, in_y_field, out_layer, {spatial_reference}, {in_z_field})
ParameterExplanationData Type
table

The table containing the X and Y coordinates that define the locations of the point features to create.

Table View
in_x_field

The field in the input table that contains the x-coordinates.

Field
in_y_field

The field in the input table that contains the y-coordinates.

Field
out_layer

The name of the output point event layer.

Feature Layer
spatial_reference
(Optional)

The spatial reference of the coordinates in the X and Y Fields defined above. This will be the output event layer's spatial reference.

Spatial Reference
in_z_field
(Optional)

The field in the input table that contains the z-coordinates.

Field

Code sample

MakeXYEventLayer example (Python window)

The following Python window script demonstrates how to use the MakeXYEventLayer tool.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.MakeXYEventLayer_management("firestations.dbf", "POINT_X", "POINT_Y", "firestations_points","", "POINT_Z")
MakeXYEventLayer example (stand-alone script)

The following stand-alone Python script demonstrates how to use the MakeXYEventLayer tool.

# MakeXYLayer.py
# Description: Creates an XY layer and exports it to a layer file

# import system modules 
import arcpy

# Set environment settings
arcpy.env.workspace = "C:/data"
 
try:
    # Set the local variables
    in_Table = "firestations.dbf"
    x_coords = "POINT_X"
    y_coords = "POINT_Y"
    z_coords = "POINT_Z"
    out_Layer = "firestations_layer"
    saved_Layer = r"c:\output\firestations.lyr"
 
    # Set the spatial reference
    spRef = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj"
 
    # Make the XY event layer...
    arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
 
    # Print the total rows
    print(arcpy.GetCount_management(out_Layer))
 
    # Save to a layer file
    arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
 
except Exception as err:
    print(err.args[0])

Environments

  • Current Workspace

Licensing information

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

Related topics

  • An overview of the Layers and Table Views toolset
  • Using layers and table views
  • Working with layers and table views

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