Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Layers and Table Views toolset > Tools

Make XY Event Layer (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Makes a point layer based on x and y coordinates from a source table.


Usage tips

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
Data types for geoprocessing tool parameters


Command line example

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

Data types for geoprocessing tool parameters


Script example

# 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()

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.