ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / Length3D Method
The input geometry.
Example

In This Topic
    Length3D Method (IGeometryEngine)
    In This Topic
    Gets the 3D length for a specified geometry.
    Syntax
    Function Length3D( _
       ByVal geometry As Geometry _
    ) As Double
    double Length3D( 
       Geometry geometry
    )

    Parameters

    geometry
    The input geometry.

    Return Value

    The calculated length in the same units as the geometry's spatial reference unit. If the geometry is empty, then zero is returned.
    Exceptions
    ExceptionDescription
    Geometry is null.
    The method is not implemented for GeometryBag or Multipatch.
    The geometry is not Z-Aware.
    Cannot do 3D operations on curve segments.
    Geometry is not a polyline or polygon.
    Remarks
    The geometry must be Z-Aware or else an exception is thrown.
    Example
    Determine Length, Length3D of line
    {
      MapPoint c1 = MapPointBuilderEx.CreateMapPoint(1, 2, 3);
      MapPoint c2 = MapPointBuilderEx.CreateMapPoint(4, 2, 4);
    
      // line segment
      LineSegment line = LineBuilderEx.CreateLineSegment(c1, c2);
      double len = line.Length;     // = 3
      double len3D = line.Length3D;   // = Math.Sqrt(10)
    
      // polyline
      Polyline p = PolylineBuilderEx.CreatePolyline(line);
      double p_len = p.Length;        // = len = 3
      double p_len3D = p.Length3D;    // = len3D = Math.Sqrt(10)
    
      double ge_len = GeometryEngine.Instance.Length(p);      // = p_len = len = 3
      double ge_len3d = GeometryEngine.Instance.Length3D(p);    // = p_len3D = len3D = Math.Sqrt(10)
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also