AnsweredAssumed Answered

I found many problems with 3D arcpy.Polylines

Question asked by valraa on Sep 4, 2018
Latest reply on Sep 4, 2018 by bixb0012

This is just to inform about things that are most likely bugs.

I already posted a question and answer myself here: arcgis desktop - arcpy - creating a 3d arcpy.Polyline - Geographic Information Systems Stack Exchange.

The thing is: I need to create a 3d polyline with arcpy having a series of XYZ coordinates.

 

If I do:

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 property is Read-only. From the arcpy.Polyline official docs, this is an optional input parameter, and lke so, the user should be able to set it (to True or False).

 

However, if I set has_z parameter via python positional parameters rather than named parameter, it works:

polyline = arcpy.Polyline(array, None, True)

Another problem with 3d Polylines in general, is that their Shape_Length is always 0 for vertical lines (i.e. with equal first and lastPoint).
Also, length is probably calculated regardless the Z coordinate, resulting in strange lengths values.

Outcomes