How do I retrieve start and end point coordinates with Python/arcpy for a polyline feature class? I expect to pass a segment identifier to a subroutine and have it pass back start and end coordinates. The Field Calculator method doesn't work for me, because I need the value for other calculations that can't be performed within it. (I also prefer not to change the data to store these coordinates as attributes.) I am attempting to calculate address ranging for a "center out" addressing scheme. The address value depends on the distance to the "county center".
|
The process for this seems to have changed between ArcGIS 10.0 and 10.1. I will include a sample for both. Here is the help document on reading geometries in 10.1 using arcpy: Reading Geometries 10.1 10.1
10.0 Here is the help document on reading geometries in 10.0 using arcpy: Reading Geometries 10.0
The difference between the two basically lies in how you access the feature geometry. There have been some shortcuts added in 10.1 to make it easier to get to the geometry object. |
|||
|
|
|
I have done this before and prefer to use a Search Cursor and read the geometry. It creates a loop and allows you to do calcs on each shape.
That loop allows you to add some calculations with it and go shape by shape. There is some extra help in the ESRI docs here: link Hope this helps. |
|||
|
|
|
You should be able to use the firstPoint and lastPoint properties of the Polyline object. |
|||
|
|