ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / GetElevationProfileFromSurfaceAsync Method / GetElevationProfileFromSurfaceAsync(MapPoint,MapPoint,Int32,ElevationSurfaceLayer) Method
The start point.
The end point.
The number of points required in the resulting polyline. Note this count includes the start and end points.
Identifies the surface to be used. If null is specified, then the default Ground Surface will be used.
Example

In This Topic
    GetElevationProfileFromSurfaceAsync(MapPoint,MapPoint,Int32,ElevationSurfaceLayer) Method
    In This Topic
    Gets an elevation profile calculated between startPoint and endPoint. Intermediate points are calculated at equal distances between the end points according to the numPoints specified. All Z values of the calculated polyline are populated from the Ground Surface Layer.
    Syntax
    Public Overloads Function GetElevationProfileFromSurfaceAsync( _
       ByVal startPoint As MapPoint, _
       ByVal endPoint As MapPoint, _
       ByVal numPoints As Integer, _
       ByVal surfaceLayer As ElevationSurfaceLayer _
    ) As Task(Of ElevationProfileResult)

    Parameters

    startPoint
    The start point.
    endPoint
    The end point.
    numPoints
    The number of points required in the resulting polyline. Note this count includes the start and end points.
    surfaceLayer
    Identifies the surface to be used. If null is specified, then the default Ground Surface will be used.

    Return Value

    An ElevationProfileResult. If successful, this contains the generated polyline.
    Exceptions
    ExceptionDescription
    startPoint or endPoint are null.
    startPoint or endPoint cannot be empty.
    numPoints cannot be smaller than 10.
    This Map does not have the specified surfaceLayer.
    This Map does not have a visible Ground Surface Layer.
    Example
    Interpolate a line between two points and calculate the elevation profile
    int numPoints = 20;
    
    // use the default ground elevation surface
    var result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(startPt, endPt, numPoints);
    if (result.Status == SurfaceZsResultStatus.Ok)
    {
      var polylineZ = result.Polyline;
    
      // process the polylineZ
    }
    
    // use a specific elevation surface
    var eleLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
    result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(startPt, endPt, numPoints, eleLayer);
    if (result.Status == SurfaceZsResultStatus.Ok)
    {
      var polylineZ = result.Polyline;
    
      // process the polylineZ
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also