ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / CanShowElevationProfileGraph Method
Example

In This Topic
    CanShowElevationProfileGraph Method
    In This Topic
    Checks to see if an elevation profile can be displayed.
    Syntax
    Public Function CanShowElevationProfileGraph() As Boolean
    public bool CanShowElevationProfileGraph()

    Return Value

    True if the mapView supports showing an elevation profile. Elevation profiles can be displayed for scenes only.
    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);
    }
    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
        MapPoint startPt = MapPointBuilderEx.CreateMapPoint(-130, 20, SpatialReferences.WGS84);
        MapPoint endPt = MapPointBuilderEx.CreateMapPoint(-100, 50, SpatialReferences.WGS84);
        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);
    }
    Show Elevation profile graph using an ElevationProfileResult
    {
        MapPoint startPt = MapPointBuilderEx.CreateMapPoint(-130, 20, SpatialReferences.WGS84);
        MapPoint endPt = MapPointBuilderEx.CreateMapPoint(-100, 50, SpatialReferences.WGS84);
        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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.5 or higher.
    See Also