# Arcpy - 3D straight line length of polyline

807
4
05-08-2017 09:52 PM New Contributor

Dear guys,

Currently i'm writting a script to calculate the surface length and 3D length (mean that the straight line length from begin vertex to the end vertex, mean that the length which has Z value apply, in math we can calculate by function in this topic: 3D Coordinate Geometry - Distance | Brilliant Math & Science Wiki

At first i used th SurfaceLength_3d function to get surface length then i use the Intersect function which will produce the 3D_length in attribute table for 3D length but 3D length and surface length are equal for every case so i think that 3d length is the Surface length in this case

Do we have any function to get the 3D straight line length of polyline in Arcgis?

Tags (1)
4 Replies New Contributor by MVP Legendary Contributor

use add-geometry-attributes   for 3D length of a Z-enabled polyline.  If you just want the straightline length between the start and the end, simply use the X,Y and Z values for the start and end for this calculation. New Contributor

Thank you Mr Dan Patterson,

After some more research i have used math function to achieve this

Best regards by MVP Legendary Contributor

Yes the 'math' functions are quite extensive in the Spatial Analyst extension... and are useful for putting together models or working with scripts... although the calculator approach is attractive for simple calculations.  similarly, the polyline class in arcpy is useful from a scripting standpoint 