Export Line Geometry?

2356
5
06-06-2017 09:23 AM
ZachSchenk
New Contributor III

Hello All,

I'm trying to do some external analysis on a line that I have in ArcGIS. In order to do this, I need to export the line geometry so that I can see the line as a series of 'nodes'. Is there any way to find and export these nodes to a csv format? I know this is possible with QGIS so I expect its possible in ArcGIS as well... but I just can't seem to find it.

I also don't really need it in a csv, basically I need to run these points through a matlab script to calculate curvature ( I find that ArcGIS Curves and Lines tool isn't particularly useful for what I'm trying to do), so as long as these points are in a format that Matlab can read, I'm happy.

Any tips or help is appreciated!

Thanks,

Zach

0 Kudos
5 Replies
BruceHarold
Esri Regular Contributor

The Feature Vertices to Point geoprocessing tool (advanced license) might be what you need, followed by Add XY Coordinates then export the attribute table to TXT.

ZachSchenk
New Contributor III

Any tips if I only happen to have a Standard License?

0 Kudos
DanPatterson_Retired
MVP Emeritus

you can use the free stuff provided by esri if you know a bit of python. FeatureclassToNumPyArray then save the coordinates out from numpy/python using savetxt.  Gives you a nice file which you can then use anywhere

JoshuaBixby
MVP Esteemed Contributor

Something like the following will create a list of named tuples for all of the points that make up the vertices for all of the lines in a polyline feature class:

>>> from collections import namedtuple
>>> 
>>> line_fc = # path to line feature class
>>> point_record = namedtuple('point_record','line_oid x y')
>>> points = []
>>> with arcpy.da.SearchCursor(line_fc,["OID@","SHAPE@"]) as cur:
...     for oid, shape in cur:
...         points.extend([
...             point_record(oid, point.X, point.Y)
...             for part in shape.getPart()
...             for point in part
...         ])
...         
>>> 

You can take the list of named tuples and either write it out to CSV or using an insert cursor to create a table or something else.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I like Dan Patterson‌'s suggestion/approach more:

>>> line_fc = # path to line feature class
>>> points = arcpy.da.FeatureClassToNumPyArray(
...     line_fc,
...     ["OID@", "SHAPE@X", "SHAPE@Y"],
...     explode_to_points=True
... )
... 
>>>