Label | Explanation | Data 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 |
Output Feature Class
| The feature class containing the output point features. | Feature Class |
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 |
Z Field
(Optional) | The field in the input table that contains the z-coordinates. | Field |
Coordinate System
(Optional) | The coordinate system of the x- and y-coordinates. This will be the coordinate system of the output feature class. | Spatial Reference |
Summary
Creates a point feature class based on x-, y-, and z-coordinates from a table.
Usage
Attribute fields from the input table parameter value will be transferred to the output feature class.
The coordinate system specified in the Coordinate System parameter will be applied to the output. This coordinate system determines how the x-, y-, and z-coordinates in the input table are interpreted. As this tool is commonly used with tables that contain longitude and latitude values, the default coordinate system is the WGS84 geographic coordinate system. If the x- and y-coordinates in the input table contain projected coordinates, specify the appropriate projected coordinate system.
If the Output Coordinate System environment has been set, the output feature class will be reprojected to this coordinate system from the coordinate system specified in the Coordinate System parameter.
When the Z Field parameter value is specified, the default coordinate system also includes the WGS84 vertical coordinate system. If the z-values are not in meters, modify the coordinate system to use the correct elevation unit.
The x- and y-coordinate values of 0 or Null are considered valid and will be included in the output. Coordinates of 0 will have output point features placed at that location; coordinates that are null will have an empty geometry.
The x- and y-coordinate values in a geographic coordinate system are considered invalid if they are less than -400 or greater than 400. An output record will not be created and a warning message will be included in the tool messages to indicate the invalid input ID.
The input x-, y-, and z-coordinate fields must be numeric fields. Only coordinate values in the following formats should be used as input to this tool:
- Decimal degrees in a geographic coordinate system
- Linear measurements in a projected coordinate system that use numbers to indicate the position with an x- and y-offset from an origin location
Other coordinate formats or notations can be used as input to the Convert Coordinate Notation tool.
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.
Parameters
arcpy.management.XYTableToPoint(in_table, out_feature_class, x_field, y_field, {z_field}, {coordinate_system})
Name | Explanation | Data Type |
in_table | The table containing the x- and y-coordinates that define the locations of the point features that will be created. | Table View |
out_feature_class | The feature class containing the output point features. | Feature Class |
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 |
z_field (Optional) | The field in the input table that contains the z-coordinates. | Field |
coordinate_system (Optional) | The coordinate system of the x- and y-coordinates. This will be the coordinate system of the output feature class. | Spatial Reference |
Code sample
The following Python window script demonstrates how to use the XYTableToPoint function.
import arcpy
arcpy.env.workspace = r"c:\output.gdb"
arcpy.management.XYTableToPoint(r"c:\data\tree.csv", "tree_points",
"longitude", "latitude", "elevation",
arcpy.SpatialReference(4759, 115700))
The following stand-alone Python script demonstrates how to use the XYTableToPoint function.
# XYTableToPoint.py
# Description: Creates a point feature class from input table
# import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = r"c:\output.gdb"
# Set the local variables
in_table = r"c:\data\tree.csv"
out_feature_class = "tree_points"
x_coords = "longitude"
y_coords = "latitude"
z_coords = "elevation"
# Make the XY event layer...
arcpy.management.XYTableToPoint(in_table, out_feature_class,
x_coords, y_coords, z_coords,
arcpy.SpatialReference(4759, 115700))
# Print the total rows
print(arcpy.management.GetCount(out_feature_class))
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes