ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Data.Analyst3D Namespace / Terrain Class
Members Example

In This Topic
    Terrain Class
    In This Topic
    Represents a terrain dataset.
    Object Model
    Terrain ClassDatastore ClassTerrainDefinition ClassEnvelope ClassFeatureDataset ClassTerrainTileProperties Class
    Syntax
    public sealed class Terrain : ArcGIS.Core.Data.Dataset, System.IDisposable  
    Public NotInheritable Class Terrain 
       Inherits ArcGIS.Core.Data.Dataset
       Implements System.IDisposable 
    Remarks
    A terrain is a multiresolution, TIN-based surface built from measurements stored as features in a geodatabase. They're typically made from lidar, sonar, and photogrammetric sources. Terrains have participating feature classes and rules. See TerrainDataSource .

    Terrain data is organized for fast retrieval. This organization involves the creation of terrain pyramids that are used to quickly retrieve only the data necessary to construct a surface of the required level of detail (LOD) for a given area of interest (AOI) from the database. See TerrainPyramidLevel.

    Example
    Open a Terrain
    public async Task OpenTerrain()
    {
      try
      {
        await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
        {
          string path = @"d:\Data\Terrain\filegdb_Containing_A_Terrain.gdb";
          var fileConnection = new FileGeodatabaseConnectionPath(new Uri(path));
    
          using (Geodatabase dataStore = new Geodatabase(fileConnection))
          {
            string dsName = "nameOfTerrain";
    
            using (var dataset = dataStore.OpenDataset<ArcGIS.Core.Data.Analyst3D.Terrain>(dsName))
            {
            }
          }
        });
      }
      catch (GeodatabaseNotFoundOrOpenedException exception)
      {
        // Handle Exception.
      }
    }
    
    Retrieve dataset objects
    //Must be on the QueuedTask.Run()
    
    Envelope extent;
    SpatialReference sr;
    using (var tin = tinLayer.GetTinDataset())
    {
      using (var tinDef = tin.GetDefinition())
      {
        extent = tinDef.GetExtent();
        sr = tinDef.GetSpatialReference();
      }
    }
    
    using (var terrain = terrainLayer.GetTerrain())
    {
      using (var terrainDef = terrain.GetDefinition())
      {
        extent = terrainDef.GetExtent();
        sr = terrainDef.GetSpatialReference();
      }
    }
    
    using (var lasDataset = lasDatasetLayer.GetLasDataset())
    {
      using (var lasDatasetDef = lasDataset.GetDefinition())
      {
        extent = lasDatasetDef.GetExtent();
        sr = lasDatasetDef.GetSpatialReference();
      }
    }
    Create a TerrainLayer from a dataset
    //Must be on the QueuedTask.Run()
    
    var terrainCP_ds = new TerrainLayerCreationParams(terrain);
    terrainCP_ds.Name = "My Terrain Layer";
    terrainCP_ds.IsVisible = true;
    
    //Create the layer to the terrain
    var terrainLayer_ds = LayerFactory.Instance.CreateLayer<TerrainLayer>(terrainCP_ds, map);
    Create a TerrainLayer with renderers
    //Must be on the QueuedTask.Run()
    
    var terrainCP_renderers = new TerrainLayerCreationParams(terrain);
    terrainCP_renderers.Name = "My LAS Layer";
    terrainCP_renderers.IsVisible = true;
    
    // define the edge type renderer - use defaults
    var edgeRD = new TinBreaklineRendererDefinition();
    
    // define the face/surface renderer
    var faceRD = new TinFaceClassBreaksRendererDefinition();
    faceRD.ClassificationMethod = ClassificationMethod.NaturalBreaks;
    // accept default color ramp, breakCount
    
    // define the dirty area renderer - use defaults
    var dirtyAreaRD = new TerrainDirtyAreaRendererDefinition();
    
    // add renderers to dictionary
    var t_dict = new Dictionary<SurfaceRendererTarget, TinRendererDefinition>();
    t_dict.Add(SurfaceRendererTarget.Edges, edgeRD);
    t_dict.Add(SurfaceRendererTarget.Surface, faceRD);
    t_dict.Add(SurfaceRendererTarget.DirtyArea, dirtyAreaRD);
    
    // assign dictionary to creation params
    terrainCP_renderers.RendererDefinitions = t_dict;
    
    //Create the layer to the terrain
    var terrainLayer_rd = LayerFactory.Instance.CreateLayer<TerrainLayer>(terrainCP_renderers, map);
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.Dataset
             ArcGIS.Core.Data.Analyst3D.Terrain

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also