Select to view content in your preferred language

Getting Tin as null from Terrain

738
2
12-13-2011 11:40 AM
LalitArora1
Emerging Contributor
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.
0 Kudos
2 Replies
NeilClemmons
Honored Contributor
I've never worked with terrains but from the sound of it you really need a Surface to work with.  Looking at the developer help for ITerrain I see there is a method called CreateDynamicSurface.  IDynamicSurface has a method called GetTin.  From ITin, you can QI to ISurface, which has methods to get elevation, slope and aspect.  Have you tried any of this?  If not, give it a shot.
0 Kudos
LalitArora1
Emerging Contributor
I've never worked with terrains but from the sound of it you really need a Surface to work with.  Looking at the developer help for ITerrain I see there is a method called CreateDynamicSurface.  IDynamicSurface has a method called GetTin.  From ITin, you can QI to ISurface, which has methods to get elevation, slope and aspect.  Have you tried any of this?  If not, give it a shot.


Thanks Neil for reply. I have treid with GetTin with the help of below link,

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_perform_surface_...

But its giving Null(ITinSurfaceElement) if i get the Tin with less resolution. My requirement is to provide a webservice which should query set of points on Terrain and respond with terrain properties for given set of points . If i provide high resolution Tin it takes more time to GetTin from DynamicSurface.

How ArcMap is showing Terrain data fast and IIdentify works well, We dont have map to query. IIdentify is also not giving IArray on query.
0 Kudos