raster layer added to scene but can not get elevation

558
3
Jump to solution
09-01-2021 01:37 AM
2xlearner
New Contributor

I added raster layer to scene by using code below:

 

 

Raster myRaster = new Raster(.../myDoc.tif);

RasterLayer newRasterLayer = new RasterLayer(myRaster);

MySceneView.Scene.OperationalLayers.Add(newRasterLayer);

 

 

Then tried to get elevation by using MySceneView.Scene.BaseSurface.GetElevationAsync(e.Location);

But it returns 0 for all points at scene.

 

Then I changed my code to: 

 

 

Raster myRaster = new Raster(.../myDoc.tif);

var elev = new ArcGISTiledElevationSource(new Uri(.../myDoc.tif));

RasterLayer newRasterLayer = new RasterLayer(myRaster);

MySceneView.Scene.BaseSurface.ElevationSources.Add(elev);

MySceneView.Scene.OperationalLayers.Add(newRasterLayer);

 

But result did not change, I still get 0 from MySceneView.Scene.BaseSurface.GetElevationAsync(e.Location);

 

Can anybody write where I make mistake?

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Hi.

You should use a RasterElevationSource rather than an ArcGISTiledElevationSource.

Of course, your myDoc.tif file should be suitable for use as an elevation source.

Once you've done that, do double-check that the Scene's BaseSurface has IsEnabled set to true.

Does that help?

View solution in original post

0 Kudos
3 Replies
2xlearner
New Contributor

By the way, I am working with offline scene

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hi.

You should use a RasterElevationSource rather than an ArcGISTiledElevationSource.

Of course, your myDoc.tif file should be suitable for use as an elevation source.

Once you've done that, do double-check that the Scene's BaseSurface has IsEnabled set to true.

Does that help?

0 Kudos
2xlearner
New Contributor

Thanks for your help. That worked for me

0 Kudos