How to add a surface to Ground Surface in 3.1

440
2
Jump to solution
05-31-2023 09:23 AM
_jls_
by
New Contributor

 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?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
_jls_
by
New Contributor

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 );

View solution in original post

2 Replies
_jls_
by
New Contributor

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 );

Wolf
by Esri Regular Contributor
Esri Regular Contributor

I used the following code snippet to add an ImageServiceLayer with a 'Source Type' of 'Elevation' to my Ground Elevation group:

Wolf_0-1685568125593.png

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);
  }
}
0 Kudos