Elevation data from DTED file in v100.4.0

04-04-2019 12:05 PM
New Contributor III

I was using the following code to get elevation data from DTED file in previous versions of ArcGIS Runtime SDK for .NET and it worked fine but now, the application crashes. It works while I am debugging with breakpoints. So, just for test, I put a delay before calling GetElevationAsync(samplepoint) and it works. This happens just in v100.4.0. 

public async void FindElevationAsync(MapPoint samplepoint)
      string parentFolder = $"{Directory.GetCurrentDirectory()}\\DTEDFiles";
      List<string> files = Directory.EnumerateFiles(parentFolder, "*.dt2", SearchOption.AllDirectories).ToList();
      if (files.Count == 0)
         _anElevation = NonExistentElevation;

      RasterElevationSource rasterElevationSource = new RasterElevationSource(files);
      await rasterElevationSource.LoadAsync();
      rasterElevationSource.Name = "DTED";

      _elevSurface = new Surface();
      _elevSurface.Name = "DTED Surface";
      await _elevSurface.LoadAsync();

      //Create a Scene and set the surface created above as the basesurface
      Scene dtedScene = new Scene { BaseSurface = _elevSurface };
      await dtedScene.LoadAsync();

      SceneView aSceneView = new SceneView { Scene = dtedScene };

      _anElevation = await _elevSurface.GetElevationAsync(samplepoint);
      catch (Exception ex)
      _anElevation = NonExistentElevation;
      // throw;

0 Kudos
0 Replies