I've figured out how to add a local elevation layer as an Elevation Surface, but now I'm trying to add this layer to the Ground Surface, which is where it really belongs. Does anyone know the steps to make this happen?
Solved! Go to Solution.
I got it. Hidden in plain sight I guess.
var groundSurface = map.GetGroundElevationSurfaceLayer();
var connection = elevationLayer.GetDataConnection();
var creationParams = new ElevationLayerCreationParams(connection)
{
Name = elevationLayerName,
};
_ = LayerFactory.Instance.CreateLayer<Layer>(creationParams, groundSurface );
I got it. Hidden in plain sight I guess.
var groundSurface = map.GetGroundElevationSurfaceLayer();
var connection = elevationLayer.GetDataConnection();
var creationParams = new ElevationLayerCreationParams(connection)
{
Name = elevationLayerName,
};
_ = LayerFactory.Instance.CreateLayer<Layer>(creationParams, groundSurface );
I used the following code snippet to add an ImageServiceLayer with a 'Source Type' of 'Elevation' to my Ground Elevation group:
I used this code snippet:
protected override async void OnClick()
{
var map = MapView.Active?.Map;
if (map == null) return;
try
{
await QueuedTask.Run(() =>
{
//Define a ServiceConnection to use for the new Elevation surface
var serverConnection = new CIMInternetServerConnection
{
Anonymous = true,
HideUserProperty = true,
URL = "https://elevation2.arcgis.com/arcgis/services"
};
CIMAGSServiceConnection serviceConnection = new CIMAGSServiceConnection
{
ObjectName = "Antarctic DEM: Hillshade Multidirectional",
ObjectType = "ImageServer",
URL = "https://elevation2.arcgis.com/arcgis/services/Polar/AntarcticDEM/ImageServer",
ServerConnection = serverConnection
};
//Add the Elevation Surface to the Ground Elevation surface [Group]
var elevationLyrCreationParams = new ElevationLayerCreationParams(serviceConnection);
var groundSurface = map.GetGroundElevationSurfaceLayer();
var elevationSurface = LayerFactory.Instance.CreateLayer<Layer>(
elevationLyrCreationParams, groundSurface);
});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}