How get Polyline length with arcpy?

2523
2
Jump to solution
04-28-2021 07:33 AM
Radzhabad
New Contributor II

How get Polyline length?

5275638.50297307 5308417.691663428
5275634.752936599 5308476.037372201
5275634.184976945 5308515.710878163
5275617.412332638 5308509.338851113
5275597.092486764 5308511.743163031
5275580.186472058 5308514.360920422
5275533.894758095 5308520.283088091
5275534.214086481 5308529.217629748
5275504.951189122 5308533.458738968
5275485.222822129 5308534.248161392
5275458.805185116 5308535.972561657

i try this code, but its show error

polyline = arcpy.Polyline(array)
polyline.getLength()

 

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\arcobjects.py", line 1561, in getLength
return convertArcObjectToPythonObject(self._arc_object.GetLength(*gp_fixargs((method, units))))
ValueError: Опция GEODESIC не может быть использована с геометрией неизвестной системы координат.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

Perhaps polyline.getLength('PLANAR', 'METERS') or polyline.getLength('GEODESIC', 'METERS') etc.

View solution in original post

2 Replies
DanPatterson
MVP Esteemed Contributor

You need an array of Point objects

See the code example in this link

Polyline—ArcGIS Pro | Documentation

 


... sort of retired...
0 Kudos
DavidPike
MVP Frequent Contributor

Perhaps polyline.getLength('PLANAR', 'METERS') or polyline.getLength('GEODESIC', 'METERS') etc.