Working with ArcGIS Pro 2.2, I have to create a 3D polyline from array of XYZ coordinates.
When I try this code snippet :
array = arcpy.Array([arcpy.Point(0, 0, 0),arcpy.Point(0, 100, -1000)])
polyline = arcpy.Polyline(array, has_z=True)
I get an error saying that has_z
is read-only:
AttributeError: DescribeGeometry: Read-only attribute has_z
From the docs it really does not seem so.
When I try not to specify the has_z
parameter:
array = arcpy.Array([arcpy.Point(0, 0, 0),arcpy.Point(0, 100, -1000)])
polyline = arcpy.Polyline(array)
I receive no errors but the Polyline defaults to hasz=False
as it has to.
Doing polyline.firstPoint
confirms this:
<Point (0.0, 0.0, #, #)>
Is there another legit way to do it?
It seems wrong to me that has_z
parameter is read-only.