Select to view content in your preferred language

Getting nodal coordinates out of a polyline feature class.

2066
2
10-12-2010 09:36 PM
PrabhasGupta
New Contributor
I have a polyline feature class in the form of a shapefile. The coordinate system is Geographic and the earth datum used is the North American Datum of 1983.

I would like to get a table that contains the lat, lon coordinates of the end points (called 'nodes') of each polyline in the feature class. Note that I do have an associated object class that contains unique identifiers for each polyline in the shapefile, and also for all nodes.

I would appreciate it if someone could provide me some guidance on this issue. I find it strange that we can quickly view a table of point data (given with x, y coordinates) in GIS, but the method to 'deconstruct' things is not so obvious!
0 Kudos
2 Replies
ChrisSnyder
Honored Contributor
Manual method: Add two new fields (type double) to the attribute table of your polyline. Call them END_X and END_Y. Right click on the field > Calculate Geometry > Properties > X/Y Coordinate of line end

Or some v93 Python code (i didn't test this, but I think it should work the 1st time):
gp.AddField_management(myPolylineFC, "END_X", "DOUBLE")
gp.AddField_management(myPolylineFC, "END_Y", "DOUBLE")
shapeFieldName = gp.describe(myPolylineFC).shapefieldname
updateRows = gp.updatecursor(myPolylineFC)
updateRow = updateRow.next()
while updateRow:
   updateRow.END_X = updateRow.getvalue(shapeFieldName).lastpoint.x #start node is ".firstpoint"
   updateRow.END_X = updateRow.getvalue(shapeFieldName).lastpoint.y
   updateRows.updaterow(updateRow)
   updateRow = updateRows.next()            
del updateRow
del updateRows
0 Kudos
PrabhasGupta
New Contributor
Hi! Thanks for this method but I did it using the 'Feature vertices to points' and the 'Add X/Y coordinates' tools in ArcGIS. The first gives us the nodes of the flowline network, while the second populates the attribute table of the nodes with their coordinates.
0 Kudos