Hi.
I have a series of points with X,Y,Z coordinates. I am trying to create a polylines from the points. Points should be vertexes of the polyline and Z-Coordinate should be used to define the elevation of vertexes.
I have created a script which works, but the Z-Coordinate is lost on vertexes and is recorded as ZERO. I am sure that my script is correct because if I pass the Z-Coordinate into the M value, it is recorded correctly. The part of the script which creates the line can be seen below:
vertexArray = arcpy.Array()
for points in pointArray:
xCoord = valueX
yCoord = valueY
zCoord = valueZ
# valueZ is also passed to M dimension to test if there are some problems with values
currentPoint = arcpy.Point(valueX, valueY, valueZ, valueZ)
vertexArray.add(currentPoint)
newLineCursor = arcpy.da.InsertCursor(outputFc, ["SHAPE@"])
polyline = arcpy.Polyline(vertexArray)
newLineCursor.insertRow([polyline])
The script runs wihtout problems, and the polylines are created. But when I check in ArcMAP the polyline under sketch properties all the vertexes on line have null as Z-Coordinate (see image bellow).
I have just tested to convert points with arcpy.PointsToLine_management, and it works correctly. I could implement this in my script, but I am still curious as to why is Z-Coordinate not recorded properly with my script.
Thanks,
Martin
Solved! Go to Solution.
Michael Fells point is important, but be aware that there is some strange behavior in arcpy (as of 10.4.1)