ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / ShowElevationProfileGraph Method / ShowElevationProfileGraph(MapPoint,MapPoint,Int32,ElevationProfileParameters) 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. There must be at least 10 points.
The set of profile parameters. If null, the default set of parameters is used.
Example

In This Topic
    ShowElevationProfileGraph(MapPoint,MapPoint,Int32,ElevationProfileParameters) Method
    In This Topic
    Shows an elevation profile of the line calculated between startPoint and endPoint. Intermediate points are calculated at equal distances between the end points according to the numPoints specified. The calculation is performed according to the profileParameters specified. The profileParameters allows you to specify the elevation surface layer the calculation is performed against along with whether the generated elevation profile line is densified.
    Syntax
    Public Overloads Sub ShowElevationProfileGraph( _
       ByVal startPoint As MapPoint, _
       ByVal endPoint As MapPoint, _
       ByVal numPoints As Integer, _
       Optional ByVal profileParameters As ElevationProfileParameters _
    ) 

    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. There must be at least 10 points.
    profileParameters
    The set of profile parameters. If null, the default set of parameters is used.
    Exceptions
    ExceptionDescription
    startPoint or endPoint are null.
    startPoint or endPoint cannot be empty.
    numPoints cannot be smaller than 10.
    An elevation profile cannot be displayed on the current map.
    The specified profileParameters are invalid.
    The Map does not have a visible Ground Surface Layer.
    The Map does not have the specified surfaceLayer.
    Remarks
    Pass null for the profileParameters if you want to use the default values; that is the Ground Surface layer is used to calculate the Z values and the generated elevation profile line is densified.

    Use the ElevationProfileGraphAdded delegate to determine when the elevation profile graph is added to the mapView. Once this has occurred, MapView.GetElevationProfileGraph will return a non-null ElevationProfileGraph.

    Example
    Show Elevation profile graph between two points
    int numPoints = 20;
    
    if (!MapView.Active.CanShowElevationProfileGraph())
      return;
    
    // show the elevation profile 
    // use the default ground elevation surface
    MapView.Active.ShowElevationProfileGraph(startPt, endPt, numPoints);
    
    // find a specific elevation surface layer
    var tinLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
    
    // set up the params
    var elevProfileParams = new ElevationProfileParameters();
    elevProfileParams.SurfaceLayer = tinLayer;
    elevProfileParams.Densify = false;
    
    // show the elevation profile using the params
    MapView.Active.ShowElevationProfileGraph(startPt, endPt, numPoints, elevProfileParams);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.5 or higher.
    See Also