Label | Explanation | Data Type |

Input Table
| The input table. It can be a text file, CSV file, Excel file, dBASE table, or geodatabase table. | Table View |

Output Feature Class
| The output feature class containing densified geodetic lines. | Feature Class |

Start X Field
| A numerical field in the input table containing the x-coordinates (or longitudes) of the starting points of lines to be positioned in the output coordinate system specified by the Spatial Reference parameter. | Field |

Start Y Field
| A numerical field in the input table containing the y-coordinates (or latitudes) of the starting points of lines to be positioned in the output coordinate system specified by the Spatial Reference parameter. | Field |

End X Field
| A numerical field in the input table containing the x-coordinates (or longitudes) of the ending points of lines to be positioned in the output coordinate system specified by the Spatial Reference parameter. | Field |

End Y Field
| A numerical field in the input table containing the y-coordinates (or latitudes) of the ending points of lines to be positioned in the output coordinate system specified by the Spatial Reference parameter. | Field |

Line Type
(Optional) | Specifies the type of geodetic line to construct. - Geodesic — A type of geodetic line that most accurately represents the shortest distance between any two points on the surface of the earth will be constructed. The mathematical definition of the geodesic line is quite lengthy and complex and is therefore omitted here. This is the default.
- Great circle —A type of geodetic line that represents the path between any two points along the intersection of the surface of the earth and a plane that passes through the center of the earth will be constructed. Depending on the output coordinate system specified by the Spatial Reference parameter, in a spheroid-based coordinate system, the line is a great elliptic; in a sphere-based coordinate system, the line is uniquely called a great circle—a circle of the largest radius on the spherical surface.
- Rhumb line —A type of geodetic line, also known as a loxodrome line, that represents a path between any two points on the surface of a spheroid defined by a constant azimuth from a pole will be constructed. A rhumb line is shown as a straight line in the Mercator projection.
- Normal section —A type of geodetic line that represents a path between any two points on the surface of a spheroid defined by the intersection of the spheroid surface and a plane that passes through the two points and is normal (perpendicular) to the spheroid surface at the starting point of the two points will be constructed. Therefore, the normal section line from point A to point B is different from the one from point B to point A.
| String |

ID
(Optional) | A field in the input table. This field and the values are included in the output and can be used to join the output features with the records in the input table. | Field |

Spatial Reference
(Optional) | The spatial reference of the output feature class. The default is GCS_WGS_1984 or the input coordinate system if it is not Unknown. | Spatial Reference |

Preserve attributes (Optional) | Specifies whether the remaining input fields will be written to the output feature class. - Unchecked—The remaining input fields will not be written to the output feature class. This is the default.
- Checked—The remaining input fields will be included in the output feature class. A new field, ORIG_FID, will also be added to the output feature class to store the input feature ID values.
| Boolean |

## Summary

Creates a feature class containing geodetic line features constructed based on the values in a start x-coordinate field, start y-coordinate field, end x-coordinate field, and end y-coordinate field of a table.

## Usage

Each geodetic line is constructed using a particular set of field values representing the x- and y-coordinates of a starting point and the x- and y-coordinates of an ending point. These fields and values will be included in the output.

A geodetic line is a curve on the surface of the earth. However, a geodetic line feature is not stored as a parametric (true) curve in the output; rather, it is stored as a densified polyline representing the path of the geodetic line. If the length of a geodetic line is relatively short, it may be represented by a straight line in the output. As the length of the line increases, more vertices are used to represent the path.

When the output is a feature class in a geodatabase, the values in the Shape_Length field are always in the units of the output coordinate system specified by the Spatial Reference parameter, and they are the planar lengths of the polylines. To measure a geodesic length or distance, use the ArcGIS Pro Measure tool and choose the Geodesic, Loxodrome, or Great Elliptic option accordingly before taking a measurement.

## Parameters

arcpy.management.XYToLine(in_table, out_featureclass, startx_field, starty_field, endx_field, endy_field, {line_type}, {id_field}, {spatial_reference}, {attributes})

Name | Explanation | Data Type |

in_table | The input table. It can be a text file, CSV file, Excel file, dBASE table, or geodatabase table. | Table View |

out_featureclass | The output feature class containing densified geodetic lines. | Feature Class |

startx_field | A numerical field in the input table containing the x-coordinates (or longitudes) of the starting points of lines to be positioned in the output coordinate system specified by the spatial_reference parameter. | Field |

starty_field | A numerical field in the input table containing the y-coordinates (or latitudes) of the starting points of lines to be positioned in the output coordinate system specified by the spatial_reference parameter. | Field |

endx_field | A numerical field in the input table containing the x-coordinates (or longitudes) of the ending points of lines to be positioned in the output coordinate system specified by the spatial_reference parameter. | Field |

endy_field | A numerical field in the input table containing the y-coordinates (or latitudes) of the ending points of lines to be positioned in the output coordinate system specified by the spatial_reference parameter. | Field |

line_type (Optional) | Specifies the type of geodetic line to construct. - GEODESIC — A type of geodetic line that most accurately represents the shortest distance between any two points on the surface of the earth will be constructed. The mathematical definition of the geodesic line is quite lengthy and complex and is therefore omitted here. This is the default.
- GREAT_CIRCLE —A type of geodetic line that represents the path between any two points along the intersection of the surface of the earth and a plane that passes through the center of the earth will be constructed. Depending on the output coordinate system specified by the Spatial Reference parameter, in a spheroid-based coordinate system, the line is a great elliptic; in a sphere-based coordinate system, the line is uniquely called a great circle—a circle of the largest radius on the spherical surface.
- RHUMB_LINE —A type of geodetic line, also known as a loxodrome line, that represents a path between any two points on the surface of a spheroid defined by a constant azimuth from a pole will be constructed. A rhumb line is shown as a straight line in the Mercator projection.
- NORMAL_SECTION —A type of geodetic line that represents a path between any two points on the surface of a spheroid defined by the intersection of the spheroid surface and a plane that passes through the two points and is normal (perpendicular) to the spheroid surface at the starting point of the two points will be constructed. Therefore, the normal section line from point A to point B is different from the one from point B to point A.
| String |

id_field (Optional) | A field in the input table. This field and the values are included in the output and can be used to join the output features with the records in the input table. | Field |

spatial_reference (Optional) | The spatial reference of the output feature class. A spatial reference can be specified as any of the following: - The path to a .prj file, such as C:/workspace/watershed.prj
- The path to a feature class or feature dataset whose spatial reference you want to apply, such as C:/workspace/myproject.gdb/landuse/grassland
- A SpatialReference object, such as arcpy.SpatialReference("C:/data/Africa/Carthage.prj")
| Spatial Reference |

attributes (Optional) | Specifies whether the remaining input fields will be written to the output feature class. - NO_ATTRIBUTES —The remaining input fields will not be written to the output feature class. This is the default.
- ATTRIBUTES —The remaining input fields will be included in the output feature class. A new field, ORIG_FID, will also be added to the output feature class to store the input feature ID values.
| Boolean |

### Code sample

This sample converts a DBF table to two-point geodesic lines.

```
# Import system modules
import arcpy
# Set local variables
input_table = r"c:\workspace\city2city.dbf"
out_lines = r"c:\workspace\flt4421.gdb\routing001"
# XY To Line
arcpy.XYToLine_management(input_table, out_lines, "LOND1", "LATD1", "LOND2",
"LATD2", "GEODESIC", "idnum")
```

## Environments

## Licensing information

- Basic: Yes
- Standard: Yes
- Advanced: Yes