ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ElevationProfileResult Class / Polyline Property
Example

In This Topic
    Polyline Property (ElevationProfileResult)
    In This Topic
    Gets the elevation profile polyline, provided the Status is SurfaceZsResultStatus.Ok. The polyline is null if no elevation profile cane be determined.
    Syntax
    public Polyline Polyline {get;}
    Public ReadOnly Property Polyline As Polyline
    Example
    Get Elevation profile from the default ground surface
    // get the elevation profile for a polyline / set of polylines
    var result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync([lineGeom]);
    if (result.Status == SurfaceZsResultStatus.Ok)
    {
      var polylineZ = result.Polyline;
    
      // process the polylineZ
    }
    
    // get the elevation profile for a set of points
    result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(pts);
    if (result.Status == SurfaceZsResultStatus.Ok)
    {
      var polylineZ = result.Polyline;
    
      // process the polylineZ
    }
    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
    }
    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
    }
    Show Elevation profile graph using an ElevationProfileResult
    var elevProfileResult = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(startPt, endPt, 10);
    if (elevProfileResult.Status != SurfaceZsResultStatus.Ok)
      return;
    
    if (!MapView.Active.CanShowElevationProfileGraph())
      return;
    
    // show the elevation profile using the result
    MapView.Active.ShowElevationProfileGraph(elevProfileResult);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also