Is it possible to Change the ElevationSource at runtime?
I have two elevation Files (File1.tif and File2.tif) and i want to switch them.
MyScene.BaseSurface.ElevationSources.Clear());
if(file1)
{
elevationSource = new RasterElevationSource(new List<string> { @"C:\File1.tif" });
}
else
{
elevationSource = new RasterElevationSource(new List<string> { @"C:\File2.tif" });
}
elevationSource.LoadAsync();
MyScene.BaseSurface.ElevationSources.Add(elevationSource);
But if i switch, the Elevation sources seemed to be merged.
Solved! Go to Solution.
Thanks
Yes it works
This Code Works:
RasterElevationSource elevationSource = null;
if (isFile1)
{
elevationSource = new RasterElevationSource(new List<string> { @"C:\File1.tif" });
}
else
{
elevationSource = new RasterElevationSource(new List<string> { @"C:\File2.tif" });
}
Surface surface = new Surface();
surface.ElevationSources.Add(elevationSource);
await elevationSource.LoadAsync();
await surface.LoadAsync();
MyScene.BaseSurface = surface;
Hello @FlorianKowalsky
Thank you for reaching out to us with your question. You should be able to do it, except that you found a bug. I've logged an internal bug for it.
As a workaround, you can create and set (on the scene) a new baseSurface object every time, with the desired elevation source. Hopefully, that'll get you going in the meantime. Please let us know if you run into any further issues.
Thank you!
Koushik
Thanks
Yes it works
This Code Works:
RasterElevationSource elevationSource = null;
if (isFile1)
{
elevationSource = new RasterElevationSource(new List<string> { @"C:\File1.tif" });
}
else
{
elevationSource = new RasterElevationSource(new List<string> { @"C:\File2.tif" });
}
Surface surface = new Surface();
surface.ElevationSources.Add(elevationSource);
await elevationSource.LoadAsync();
await surface.LoadAsync();
MyScene.BaseSurface = surface;
That's great to see! If you have any further questions, please reach out.