lalitarora

Getting Tin as null from Terrain

Discussion created by lalitarora on Dec 13, 2011
Latest reply on Dec 14, 2011 by lalitarora
I have a Terrain dataset in my SQL server. I have to query the dataset for Elevation, Slope, Aspect values for a given X&Y "without map interaction". I found an interface ITinSurfaceElement which returns properties of Tin Layer. This requires Tin/TinSurface object from terrain which I am not getting.

I tried getting GetCurrentSurface from TerrainLayer which also gives null. But when I add the same layer in Map and get the currentsurface, i can get the surface and Tin object.

Am I missing some step in the below code for getting 'Tin' from 'Terrain'. Please suggest if there is another way to get this.

workspace = GetWorkspace();
featureWS = workspace as IFeatureWorkspace;
dsName = "HEIGHT.LIDAR.NOTTS";
tinName = "HEIGHT.LIDAR.NOTTS_Terrain";

featureDS = featureWS.OpenFeatureDataset(dsName);

featureDSExtContainer = featureDS as IFeatureDatasetExtensionContainer;
dsContainer = (IDatasetContainer3)featureDSExtContainer.FindExtension(esriDatasetType.esriDTTerrain);
terrainDS = dsContainer.get_DatasetByName(esriDatasetType.esriDTTerrain, tinName) as ITerrain;
ITerrainLayer terrainLayer = new TerrainLayerClass();
terrainLayer.Terrain = terrainDS;
renderer = terrainLayer.GetRenderer(1); //Elevation Renderer
ITin tin = renderer.Tin;//tin is null

Note:I have tried with IIdentify interface as well with the TerrainLayer. It din't return any results in IArray.

Outcomes