Make XY Event Layer (Data Management) |
|
Release 9.3
Last modified March 8, 2012 |
![]() ![]() ![]() Print all topics in : "Tools" |
NOTE: This topic was updated for 9.3.1.
Makes a point layer based on x- and y-coordinates from a source table. The layer that is created by the tool is temporary and will not persist after the session ends unless the document is saved.
Usage tips
This tool allows you to create a layer based on x and y columns from an input table.
The Spatial Reference parameter allows you to specify the spatial reference of the output coordinates.
If the table is editable, you will be able to edit the layer. However, you won't be able to interactively move a point on the map; you can change the x- and y-coordinate attributes in the table.
If the table does not have an ObjectID (such as delimited text files or tables from OLE DB connections), you will not be able to make selections or add joins to the resulting layer.
When working in ArcCatalog, you can use the Save To Layer File tool to write the x,y layer to a layer file. When using ArcMap, the tool adds the layer to the table of contents automatically.
No environment settings affect this tool.
Command line syntax
An overview of the Command Line window
MakeXYEventLayer_management <table> <in_x_field> <in_y_field> <out_layer> {spatial_reference}
Parameter | Explanation | Data Type |
<table> |
The table that contains the x- and y-coordinates that define the location of the points in the layer. |
Table View |
<in_x_field> |
The field in the table that contains the x-coordinates. |
Field |
<in_y_field> |
The field in the table that contains the y-coordinates. |
Field |
<out_layer> |
The name of the point layer generated by Make XY Event Layer. |
Feature Layer |
{spatial_reference} |
The spatial reference of the coordinates in the X and Y fields defined above. This will be the output layer's coordinate system. |
Spatial Reference |
MakeXYEventLayer D:\tables81\xyevent\data\xy.mdb\places_utm11 latitude longitude places_socal spatial_reference1
Scripting syntax
About getting started with writing geoprocessing scripts
MakeXYEventLayer_management (table, in_x_field, in_y_field, out_layer, spatial_reference)
Parameter | Explanation | Data Type |
table (Required) |
The table that contains the x- and y-coordinates that define the location of the points in the layer. |
Table View |
in_x_field (Required) |
The field in the table that contains the x-coordinates. |
Field |
in_y_field (Required) |
The field in the table that contains the y-coordinates. |
Field |
out_layer (Required) |
The name of the point layer generated by Make XY 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 layer's coordinate system. |
Spatial Reference |
# MakeXYLayer.py # Description: Creates an XY layer and exports it to a layer file # Requirements: Python # Author: ESRI # Date 2/06/2004 # Create the Geoprocessor object import arcgisscripting, sys, string, os gp = arcgisscripting.create() try: # Prepare the variables in_Table = r"\\bobmk\temp\xy.mdb\places_utm11" in_x = "latitude" in_y = "longitude" out_Layer = "places_socal" # Set the spatial reference # NOTE: you must have the "Coordinate Systems" turned on # To do this click tools/options and check "Coordinate Systems" # in the General Tab spref = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj" # Make the XY event... gp.MakeXYEventLayer(in_Table, in_x, in_y, out_Layer, spref) # Print the total rows pDSC = gp.describe(out_Layer) print gp.getcount(out_Layer) # Save to a layer file gp.SaveToLayerFile(out_Layer, "D:/temp/places_socal.lyr") except: # If an error occurred, print the message to the screen print gp.GetMessages()