Make XY Event Layer (Data Management)

Summary

Creates a point event layer from a table containing fields with x- and y-coordinate values, and optionally, z-coordinate (elevation) values.

Usage

  • The output event layer created by this tool is temporary and is not stored on disk or in a geodatabase. You can export an event layer to a feature class to permanently store it using the Copy Features, Feature To Point, or Export Features tool.

  • If you are working with tabular data that updates often, you can create an event layer that updates automatically when the source table updates. This may be more efficient than repetitively converting the table to a new point feature class.

  • Event layer features are not editable. Copy or export the event layer to a feature class if editing is required.

  • The standard delimiter for tabular text files with a .csv or .txt extension 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.

  • If the input table is from a file format that does not have an Object ID field or a database table without a primary key, you cannot make selections, apply definition queries or other filters, or add joins or relates to the event layer.

Parameters

LabelExplanationData Type
Input Table

The table containing the x- and y-coordinates that define the locations of the point features that will be created.

Table View
X Field

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

Field
Y Field

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

Field
Output Layer Name

The name of the output event layer.

Feature Layer
Coordinate System
(Optional)

The coordinate system of the coordinates specified in the X Field and Y Field parameters. This will be the output event layer's coordinate system.

Spatial Reference
Z Field
(Optional)

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

Field

arcpy.management.MakeXYEventLayer(table, in_x_field, in_y_field, out_layer, {spatial_reference}, {in_z_field})
NameExplanationData Type
table

The table containing the x- and y-coordinates that define the locations of the point features that will be created.

Table View
in_x_field

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

Field
in_y_field

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

Field
out_layer

The name of the output event layer.

Feature Layer
spatial_reference
(Optional)

The coordinate system of the coordinates specified in the in_x_field and in_y_field parameters. This will be the output event layer's coordinate system.

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

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.MakeXYEventLayer("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 function.

# Description: Create an XY layer and export it to a layer file.

# Import system modules 
import arcpy

# Set environment settings
arcpy.env.workspace = "C:/data"
 
# 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
spatial_ref = r"NAD_1983_UTM_Zone_11N"

# Make the XY event layer...
arcpy.management.MakeXYEventLayer(in_table, x_coords, y_coords, out_layer, 
                                  spatial_ref, z_coords)

# Save to a layer file
arcpy.management.SaveToLayerFile(out_layer, saved_layer)

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics