ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / GetElevationProfileFromSurface Method / GetElevationProfileFromSurface(IEnumerable<Polyline>,ElevationSurfaceLayer) Method
A set of polylines.
Identifies the surface to be used. If null is specified, then the default Ground Surface will be used.
Example

In This Topic
    GetElevationProfileFromSurface(IEnumerable<Polyline>,ElevationSurfaceLayer) Method
    In This Topic
    Gets an elevation profile for the specified polylines. The Z values of the calculated polyline are populated from the specified Elevation Surface Layer. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Function GetElevationProfileFromSurface( _
       ByVal polylines As IEnumerable(Of Polyline), _
       ByVal surfaceLayer As ElevationSurfaceLayer _
    ) As ElevationProfileResult

    Parameters

    polylines
    A set of polylines.
    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
    polylines cannot be null.
    This Map does not have the specified surfaceLayer.
    This Map does not have a visible Ground Surface Layer.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    If the surface has no data at a particular input geometry point, then the corresponding output geometry point Z will be set to the value specified in SurfaceZsMissingHandler.DefaultOutputZ.
    Example
    Get Elevation profile from a specific surface
    // find a specific elevation surface layer
    var eleLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
    
    // get the elevation profile for a polyline / set of polylines
    // use the specific elevation surface layer
    var zResult = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync([lineGeom], eleLayer);
    if (zResult.Status == SurfaceZsResultStatus.Ok)
    {
      var polylineZ = zResult.Polyline;
    
      // process the polylineZ
    }
    
    // get the elevation profile for a set of points
    // use the specific elevation surface layer
    zResult = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(pts, eleLayer);
    if (zResult.Status == SurfaceZsResultStatus.Ok)
    {
      var polylineZ = zResult.Polyline;
    
      // process the polylineZ
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also