ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TinLayer Class / GetSurfaceLength Method / GetSurfaceLength(Multipart,SurfaceInterpolationMethod,Double,Double) Method
The multipart to calculate the 3D length for.
The method of interpolation. The default method of interpolation for TINs is SurfaceInterpolationMethod.Linear.
A densification parameter. If specified, the multipart will be densified by the value prior to interpolating heights from the surface.
A 2D distance filter to prevent oversampled output. If specified, this value ensures that no two consecutive vertices will be closer than this distance. Use 0 to turn off weeding.
Example

In This Topic
    GetSurfaceLength(Multipart,SurfaceInterpolationMethod,Double,Double) Method
    In This Topic
    Gets the 3D length of the multipart by interpolating heights from the surface and calculating the sum of 3D distances between the vertices. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    multipart
    The multipart to calculate the 3D length for.
    interpolationMethod
    The method of interpolation. The default method of interpolation for TINs is SurfaceInterpolationMethod.Linear.
    stepSize
    A densification parameter. If specified, the multipart will be densified by the value prior to interpolating heights from the surface.
    profileWeedTolerance
    A 2D distance filter to prevent oversampled output. If specified, this value ensures that no two consecutive vertices will be closer than this distance. Use 0 to turn off weeding.

    Return Value

    the 3D length of the multipart.
    Exceptions
    ExceptionDescription
    multipart is null.
    An exception occurred within the GetSurfaceLength calculation.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Portions of the multipart falling outside the interpolation zone are excluded from the calculation.

    Input polylines and polygons are densified by the stepSize. This takes place before interpolating heights from the surface. The densification ensures no two vertices are spaced more than stepSize apart.

    If the interpolation method is linear and the surface is a TIN, the stepSize argument isn't very important since the default sampling scheme of using input vertices and triangle edge intersections is sufficient to capture all surface information. With linear interpolation that occurs when stepSize is less than or equal to 0 or is set to NaN. The use of stepSize is more relevant when the interpolation method is something other than linear.

    If the interpolation method is natural neighbors, a stepSize less than or equal to 0 outputs input vertices and hard edge crossings only. If stepSize is NaN, the output includes the input vertices and all triangle edge intersections.

    Weeding is most applicable when using linear interpolation. This is because the 'natural densification' used by linear interpolation, the insertion of vertices at triangle edge intersections, can result in very closely spaced vertices at certain locations. To turn off weeding set the profileWeedTolerance to 0.

    Example
    Get 3D length of multipart by interpolating heights
    var tinLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();
    await QueuedTask.Run(() =>
    {
      // interpolate heights and calculate the sum of 3D distances between the vertices
      double length3d = tinLayer.GetSurfaceLength(polygon, SurfaceInterpolationMethod.NaturalNeighbor);
    
      // or use a different interpolation method
      length3d = tinLayer.GetSurfaceLength(polyline, SurfaceInterpolationMethod.NaturalNeighborZNearest);
    
    
      // densify the shape before interpolating
      length3d = tinLayer.GetSurfaceLength(polygon, SurfaceInterpolationMethod.NaturalNeighbor, 0.01, 0);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also