arcgis-runtimearcgis-runtime-net

ArcGIS Runtime : SceneView load tif file not work


I want to load a tif file into SceneView, I tried the method from this, the code is as follows:

Esri.ArcGISRuntime.Geometry.Envelope pacificSouthwestEnvelope = ...;

// Create an ImageFrame with a local image file and the extent envelope  
ImageFrame imageFrame = new ImageFrame(new System.Uri(TifFilePath), pacificSouthwestEnvelope);
//ImageFrame imageFrame = new ImageFrame(image, pacificSouthwestEnvelope);

// Add the ImageFrame to an ImageOverlay and set it to be 50% transparent
ImageOverlay imageOverlay = new ImageOverlay(imageFrame);
imageOverlay.Opacity = 1;

// Add the ImageOverlay to the scene view's ImageOverlay collection
MySceneView.ImageOverlays.Add(imageOverlay);
imageFrame.LoadAsync().Wait();
await MySceneView.SetViewpointAsync(new Viewpoint(imageFrame.Extent));

But it did not succeed.

Envelope's range is obtained in arcmap.
The LoadAsync() method is called to ensure that the layer has been loaded.
Finally, I set the display range of SceneView to the range of imageFrame.

But I did not see my picture on SceneView.

Then I tried to load .png and .jpg files, but they were also unsuccessful.

I don't know what's wrong with my code?


Solution

  • Finally, I used RasterLayer to complete the loading of the tif file.

    Raster raster = new Raster(filePath);
    RasterLayer rasterLayer = new RasterLayer(raster);
    MySceneView.Scene.Basemap.BaseLayers.Add(rasterLayer);