Show height in mouse position

08-03-2020 03:26 AM
Occasional Contributor

I need to show height above the sea level in mouse cursor point on the surface. How can i get it?

My mouse cursor handler (i display cursor coordinates, but the third parameter should be height) :

private async void MySceneView_MouseMove(object sender, MouseEventArgs e)

    if (MySceneView.GetCurrentViewpoint(ViewpointType.BoundingGeometry) == null)

    System.Windows.Point screenPoint = e.GetPosition(MySceneView);
    MapPoint mapPoint = new MapPoint(0,0,0);

    mapPoint = await MySceneView.ScreenToLocationAsync(screenPoint);

    MapCoordsTextBlock.Text = string.Format("Map Coords: X = {0}, Y = {1}, Z = {2}",
    Math.Round(mapPoint.X, 4), Math.Round(mapPoint.Y, 4), "I need height in meteres here");


And just in case my scene initialization (i use geotiff data for 3d relief) :

private async void CreateNewScene()
    Scene newScene = new Scene(Basemap.CreateImagery());

    RasterElevationSource elevationSource = new RasterElevationSource(new[]@"D:\Programms\ArcGis

    \14072020geotiff\DEM_geotiff\alwdgg.tif" });
    await elevationSource.LoadAsync();

    Surface elevationSurface = new Surface();
    await elevationSurface.LoadAsync();

    newScene.BaseSurface = elevationSurface;
    Scene = newScene;
    await Scene.BaseSurface.LoadAsync();

0 Kudos
0 Replies