ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / ShowElevationProfileGraph Method / ShowElevationProfileGraph(IEnumerable<MapPoint>,ElevationProfileParameters) Method
A collection of points.
The set of profile parameters. If null, the default set of parameters is used.
Example

In This Topic
    ShowElevationProfileGraph(IEnumerable<MapPoint>,ElevationProfileParameters) Method
    In This Topic
    Shows an elevation profile of a collection of points. 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 pts As IEnumerable(Of MapPoint), _
       Optional ByVal profileParameters As ElevationProfileParameters _
    ) 
    public void ShowElevationProfileGraph( 
       IEnumerable<MapPoint> pts,
       ElevationProfileParameters profileParameters
    )

    Parameters

    pts
    A collection of points.
    profileParameters
    The set of profile parameters. If null, the default set of parameters is used.
    Exceptions
    ExceptionDescription
    Points cannot be null.
    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 with the default ground surface
    {
        if (!MapView.Active.CanShowElevationProfileGraph())
            return;
    
        // show the elevation profile for a polyline 
        // use the default ground surface layer
        Polyline polyline = PolylineBuilderEx.CreatePolyline();
        MapView.Active.ShowElevationProfileGraph([polyline]);
    
        // show the elevation profile for a set of points
        // use the default ground surface layer
        //Some points
        MapPoint mapPoint = MapPointBuilderEx.CreateMapPoint(34, -118, SpatialReferences.WGS84);
        List<MapPoint> mapPoints = new List<MapPoint> { mapPoint };
        MapView.Active.ShowElevationProfileGraph(mapPoints);
    }
    Show Elevation profile graph with a specific surface
    {
        if (!MapView.Active.CanShowElevationProfileGraph())
            return;
        // use a specific elevation surface
        var eleLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
        // set up the parameters
        var profileParams = new ElevationProfileParameters();
        profileParams.SurfaceLayer = eleLayer;
        profileParams.Densify = true;
    
        // show the elevation profile for a polyline using the params
        //Any line
        Polyline polyline = PolylineBuilderEx.CreatePolyline();
        MapView.Active.ShowElevationProfileGraph([polyline], profileParams);
    
        // show the elevation profile for a set of points using the params
        //Some points
        MapPoint mapPoint = MapPointBuilderEx.CreateMapPoint(34, -118, SpatialReferences.WGS84);
        List<MapPoint> mapPoints = new List<MapPoint> { mapPoint };
        MapView.Active.ShowElevationProfileGraph(mapPoints, profileParams);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.5 or higher.
    See Also