Make XY Event Layer (Data Management) |
|
Release 9.2
Last modified November 29, 2010 |
![]() ![]() ![]() Print all topics in : "Tools" |
Makes a point layer based on x and y coordinates from a source table.
Usage tips
This tool allows you to create a layer based on x and y columns from an input table.
Once you have added the data to your map, the layer behaves like other point feature layers.
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 must change the coordinates 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.
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 and the Python win32all extension. # 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()