// find the first TIN layervartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();// find the first Terrain layervarterrainLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TerrainLayer>().FirstOrDefault();// find the first LAS dataset layervarlasDatasetLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<LasDatasetLayer>().FirstOrDefault();// find the set of surface layersvarsurfacelayers= MapView.Active.Map.GetLayersAsFlattenedList().OfType<SurfaceLayer>();
Retrieve dataset objects
//Must be on the QueuedTask.Run()Envelopeextent;SpatialReferencesr;using(vartin= tinLayer.GetTinDataset()){using(vartinDef= tin.GetDefinition()){extent= tinDef.GetExtent();sr= tinDef.GetSpatialReference();}}using(varterrain= terrainLayer.GetTerrain()){using(varterrainDef= terrain.GetDefinition()){extent= terrainDef.GetExtent();sr= terrainDef.GetSpatialReference();}}using(varlasDataset= lasDatasetLayer.GetLasDataset()){using(varlasDatasetDef= lasDataset.GetDefinition()){extent= lasDatasetDef.GetExtent();sr= lasDatasetDef.GetSpatialReference();}}
Create a TinLayer
//Must be on the QueuedTask.Run()stringtinPath=@"d:\Data\Tin\TinDataset";vartinURI=new Uri(tinPath);vartinCP=new TinLayerCreationParams(tinURI);
tinCP.Name ="My TIN Layer";
tinCP.IsVisible =false;//Create the layer to the TINvartinLayer= LayerFactory.Instance.CreateLayer<TinLayer>(tinCP, map);
Create a TinLayer from a dataset
//Must be on the QueuedTask.Run()vartinCP_ds=new TinLayerCreationParams(tinDataset);
tinCP_ds.Name ="My TIN Layer";
tinCP_ds.IsVisible =false;//Create the layer to the TINvartinLayer_ds= LayerFactory.Instance.CreateLayer<TinLayer>(tinCP_ds, map);
Create a TinLayer with renderers
//Must be on the QueuedTask.Run()vartinCP_renderers=new TinLayerCreationParams(tinDataset);
tinCP_renderers.Name ="My TIN layer";
tinCP_renderers.IsVisible =true;// define the node renderer - use defaultsvarnode_rd=new TinNodeRendererDefinition();// define the face/surface renderervarface_rd=new TinFaceClassBreaksRendererDefinition();
face_rd.ClassificationMethod = ClassificationMethod.NaturalBreaks;// accept default color ramp, breakCount// set up the renderer dictionaryvarrendererDict=newDictionary<SurfaceRendererTarget,TinRendererDefinition>();
rendererDict.Add(SurfaceRendererTarget.Points, node_rd);
rendererDict.Add(SurfaceRendererTarget.Surface, face_rd);// assign the dictionary to the creation params
tinCP_renderers.RendererDefinitions =rendererDict;// create the layervartinLayer_rd= LayerFactory.Instance.CreateLayer<TinLayer>(tinCP_renderers, MapView.Active.Map);
Create a TerrainLayer
//Must be on the QueuedTask.Run()stringterrainPath=@"d:\Data\Terrain\filegdb_Containing_A_Terrain.gdb";varterrainURI=new Uri(terrainPath);varterrainCP=new TerrainLayerCreationParams(terrainURI);
terrainCP.Name ="My Terrain Layer";
terrainCP.IsVisible =false;//Create the layer to the terrainvarterrainLayer= LayerFactory.Instance.CreateLayer<TerrainLayer>(terrainCP, map);
Create a TerrainLayer from a dataset
//Must be on the QueuedTask.Run()varterrainCP_ds=new TerrainLayerCreationParams(terrain);
terrainCP_ds.Name ="My Terrain Layer";
terrainCP_ds.IsVisible =true;//Create the layer to the terrainvarterrainLayer_ds= LayerFactory.Instance.CreateLayer<TerrainLayer>(terrainCP_ds, map);
Create a TerrainLayer with renderers
//Must be on the QueuedTask.Run()varterrainCP_renderers=new TerrainLayerCreationParams(terrain);
terrainCP_renderers.Name ="My LAS Layer";
terrainCP_renderers.IsVisible =true;// define the edge type renderer - use defaultsvaredgeRD=new TinBreaklineRendererDefinition();// define the face/surface renderervarfaceRD=new TinFaceClassBreaksRendererDefinition();
faceRD.ClassificationMethod = ClassificationMethod.NaturalBreaks;// accept default color ramp, breakCount// define the dirty area renderer - use defaultsvardirtyAreaRD=new TerrainDirtyAreaRendererDefinition();// add renderers to dictionaryvart_dict=newDictionary<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 terrainvarterrainLayer_rd= LayerFactory.Instance.CreateLayer<TerrainLayer>(terrainCP_renderers, map);
Create a LasDatasetLayer
//Must be on the QueuedTask.Run()stringlasPath=@"d:\Data\LASDataset.lasd";varlasURI=new Uri(lasPath);varlasCP=new LasDatasetLayerCreationParams(lasURI);
lasCP.Name ="My LAS Layer";
lasCP.IsVisible =false;//Create the layer to the LAS datasetvarlasDatasetLayer= LayerFactory.Instance.CreateLayer<LasDatasetLayer>(lasCP, map);
Create a LasDatasetLayer from a LasDataset
//Must be on the QueuedTask.Run()varlasCP_ds=new LasDatasetLayerCreationParams(lasDataset);
lasCP_ds.Name ="My LAS Layer";
lasCP_ds.IsVisible =false;//Create the layer to the LAS datasetvarlasDatasetLayer_ds= LayerFactory.Instance.CreateLayer<LasDatasetLayer>(lasCP_ds, map);
Create a LasDatasetLayer with renderers
//Must be on the QueuedTask.Run()varlasCP_renderers=new LasDatasetLayerCreationParams(lasDataset);
lasCP_renderers.Name ="My LAS Layer";
lasCP_renderers.IsVisible =false;// create a point elevation renderervarptR=new LasStretchRendererDefinition();// accept all defaults// create a simple edge renderervaredgeR=new TinEdgeRendererDefintion();// accept all defaults// add renderers to dictionaryvarl_dict=newDictionary<SurfaceRendererTarget,TinRendererDefinition>();
l_dict.Add(SurfaceRendererTarget.Points, ptR);
l_dict.Add(SurfaceRendererTarget.Edges, edgeR);// assign dictionary to creation params
lasCP_renderers.RendererDefinitions =l_dict;//Create the layer to the LAS datasetvarlasDatasetLayer_rd= LayerFactory.Instance.CreateLayer<LasDatasetLayer>(lasCP_renderers, map);
Renderers for TinLayer, TerrainLayer, LasDatasetLayer
Get Renderers
// get the list of renderersIReadOnlyList<CIMTinRenderer>renderers= surfaceLayer.GetRenderers();// get the renderers as a dictionaryDictionary<SurfaceRendererTarget,CIMTinRenderer>dict= surfaceLayer.GetRenderersAsDictionary();
Simple Node Renderer
// applies to TIN layers onlyvarnodeRendererDef=new TinNodeRendererDefinition();
nodeRendererDef.Description ="Nodes";
nodeRendererDef.Label ="Nodes";
nodeRendererDef.SymbolTemplate = nodeSymbol.MakeSymbolReference();vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();if(tinLayer==null)return;if(tinLayer.CanCreateRenderer(nodeRendererDef)){CIMTinRendererrenderer= tinLayer.CreateRenderer(nodeRendererDef);if(tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);}
Elevation Node Renderer - Equal Breaks
// applies to TIN layers onlyvarequalBreaksNodeRendererDef=new TinNodeClassBreaksRendererDefinition();
equalBreaksNodeRendererDef.BreakCount =7;if(tinLayer.CanCreateRenderer(equalBreaksNodeRendererDef)){CIMTinRendererrenderer= tinLayer.CreateRenderer(equalBreaksNodeRendererDef);if(tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);}
Elevation Node Renderer - Defined Interval
// applies to TIN layers onlyvardefiendIntervalNodeRendererDef=new TinNodeClassBreaksRendererDefinition();
defiendIntervalNodeRendererDef.ClassificationMethod = ClassificationMethod.DefinedInterval;
defiendIntervalNodeRendererDef.IntervalSize =4;
defiendIntervalNodeRendererDef.SymbolTemplate = nodeSymbol.MakeSymbolReference();if(tinLayer.CanCreateRenderer(defiendIntervalNodeRendererDef)){CIMTinRendererrenderer= tinLayer.CreateRenderer(defiendIntervalNodeRendererDef);if(tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);}
Elevation Node Renderer - Standard Deviation
// applies to TIN layers onlyvarstdDevNodeRendererDef=new TinNodeClassBreaksRendererDefinition();
stdDevNodeRendererDef.ClassificationMethod = ClassificationMethod.StandardDeviation;
stdDevNodeRendererDef.DeviationInterval = StandardDeviationInterval.OneHalf;
stdDevNodeRendererDef.ColorRamp = ColorFactory.Instance.GetColorRamp("Cyan to Purple");if(tinLayer.CanCreateRenderer(stdDevNodeRendererDef)){CIMTinRendererrenderer= tinLayer.CreateRenderer(stdDevNodeRendererDef);if(tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);}
Simple Edge Renderer
// applies to TIN or LAS dataset layers onlyvaredgeRendererDef=new TinEdgeRendererDefintion();
edgeRendererDef.Description ="Edges";
edgeRendererDef.Label ="Edges";
edgeRendererDef.SymbolTemplate = lineSymbol.MakeSymbolReference();if(surfaceLayer.CanCreateRenderer(edgeRendererDef)){CIMTinRendererrenderer= surfaceLayer.CreateRenderer(edgeRendererDef);if(surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);}
Edge Type Renderer
varbreaklineRendererDef=new TinBreaklineRendererDefinition();// use default symbol for regular edge but specific symbols for hard,soft,outside
breaklineRendererDef.HardEdgeSymbol = hardEdgeSymbol.MakeSymbolReference();
breaklineRendererDef.SoftEdgeSymbol = softEdgeSymbol.MakeSymbolReference();
breaklineRendererDef.OutsideEdgeSymbol = outsideEdgeSymbol.MakeSymbolReference();if(surfaceLayer.CanCreateRenderer(breaklineRendererDef)){CIMTinRendererrenderer= surfaceLayer.CreateRenderer(breaklineRendererDef);if(surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);}
Contour Renderer
varcontourDef=new TinContourRendererDefinition();// now customize with a symbol
contourDef.Label ="Contours";
contourDef.SymbolTemplate = contourLineSymbol.MakeSymbolReference();
contourDef.ContourInterval =6;
contourDef.IndexLabel ="Index Contours";
contourDef.IndexSymbolTemplate = indexLineSymbol.MakeSymbolReference();
contourDef.ContourFactor =4;
contourDef.ReferenceHeight =7;if(surfaceLayer.CanCreateRenderer(contourDef)){CIMTinRendererrenderer= surfaceLayer.CreateRenderer(contourDef);if(surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Contours))
surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Contours);}
// applies to LAS dataset layers onlyvarlasPointsClassificationRendererDef=new LasUniqueValueRendererDefinition(LasAttributeType.Classification);// accept the defaults for color ramp, symbolTemplate, symbol scale factorvarlasDatasetLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<LasDatasetLayer>().FirstOrDefault();if(lasDatasetLayer==null)return;if(lasDatasetLayer.CanCreateRenderer(lasPointsClassificationRendererDef)){CIMTinRendererrenderer= lasDatasetLayer.CreateRenderer(lasPointsClassificationRendererDef);if(lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);}
LAS Points Returns Unique Value Renderer
// applies to LAS dataset layers onlyvarlasPointsReturnsRendererDef=new LasUniqueValueRendererDefinition(LasAttributeType.ReturnNumber);
lasPointsReturnsRendererDef.ModulateUsingIntensity =true;
lasPointsReturnsRendererDef.SymbolScaleFactor =1.0;// accept the defaults for color ramp, symbolTemplateif(lasDatasetLayer.CanCreateRenderer(lasPointsReturnsRendererDef)){CIMTinRendererrenderer= lasDatasetLayer.CreateRenderer(lasPointsReturnsRendererDef);if(lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);}
LAS Points Elevation Stretch Renderer
// applies to LAS dataset layers onlyvarelevLasStretchRendererDef=new LasStretchRendererDefinition(ArcGIS.Core.CIM.LASStretchAttribute.Elevation);// accept the defaults for color ramp, etcif(lasDatasetLayer.CanCreateRenderer(elevLasStretchRendererDef)){CIMTinRendererrenderer= lasDatasetLayer.CreateRenderer(elevLasStretchRendererDef);if(lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);}// OR use a stretch renderer with stretchType standard DeviationsvarelevLasStretchStdDevRendererDef=new LasStretchRendererDefinition(ArcGIS.Core.CIM.LASStretchAttribute.Elevation);
elevLasStretchStdDevRendererDef.StretchType = LASStretchType.StandardDeviations;
elevLasStretchStdDevRendererDef.NumberOfStandardDeviations =2;// accept the defaults for color ramp, etcif(lasDatasetLayer.CanCreateRenderer(elevLasStretchStdDevRendererDef)){CIMTinRendererrenderer= lasDatasetLayer.CreateRenderer(elevLasStretchStdDevRendererDef);if(lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);}
LAS Points Classified Elevation Renderer
// applies to LAS dataset layers onlyvarlasPointsClassBreaksRendererDef=new LasPointClassBreaksRendererDefinition();
lasPointsClassBreaksRendererDef.ClassificationMethod = ClassificationMethod.NaturalBreaks;
lasPointsClassBreaksRendererDef.ModulateUsingIntensity =true;// increase the symbol size by a factor
lasPointsClassBreaksRendererDef.SymbolScaleFactor =1.0;if(lasDatasetLayer.CanCreateRenderer(lasPointsClassBreaksRendererDef)){CIMTinRendererrenderer= lasDatasetLayer.CreateRenderer(lasPointsClassBreaksRendererDef);if(lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);}
// search all "inside" nodesusing(ArcGIS.Core.Data.Analyst3D.TinNodeCursor nodeCursor= tinLayer.SearchNodes(null)){while(nodeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinNode node= nodeCursor.Current){}}}// search "inside" nodes with an extent
ArcGIS.Core.Data.Analyst3D.TinNodeFilter nodeFilter=new ArcGIS.Core.Data.Analyst3D.TinNodeFilter();
nodeFilter.FilterEnvelope =envelope;using(ArcGIS.Core.Data.Analyst3D.TinNodeCursor nodeCursor= tinLayer.SearchNodes(nodeFilter)){while(nodeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinNode node= nodeCursor.Current){}}}// search for super nodes onlyvarsupernodeFilter=new ArcGIS.Core.Data.Analyst3D.TinNodeFilter();
supernodeFilter.FilterEnvelope = tinDataset.GetSuperNodeExtent();
supernodeFilter.DataElementsOnly =false;
supernodeFilter.SuperNode =true;using(ArcGIS.Core.Data.Analyst3D.TinNodeCursor nodeCursor= tinLayer.SearchNodes(nodeFilter)){while(nodeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinNode node= nodeCursor.Current){}}}// search all edges within an extent// this could include outside or edges attached to super nodes depending upon the extent
ArcGIS.Core.Data.Analyst3D.TinEdgeFilter edgeFilterAll=new ArcGIS.Core.Data.Analyst3D.TinEdgeFilter();
edgeFilterAll.FilterEnvelope =envelope;
edgeFilterAll.DataElementsOnly =false;using(ArcGIS.Core.Data.Analyst3D.TinEdgeCursor edgeCursor= tinLayer.SearchEdges(edgeFilterAll)){while(edgeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinEdge edge= edgeCursor.Current){}}}// search for hard edges in the TINvaredgeFilter=new ArcGIS.Core.Data.Analyst3D.TinEdgeFilter();
edgeFilter.FilterByEdgeType =true;
edgeFilter.EdgeType = ArcGIS.Core.Data.Analyst3D.TinEdgeType.HardEdge;using(ArcGIS.Core.Data.Analyst3D.TinEdgeCursor edgeCursor= tinLayer.SearchEdges(edgeFilter)){while(edgeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinEdge edge= edgeCursor.Current){}}}// search for "inside" triangles in an extent
ArcGIS.Core.Data.Analyst3D.TinTriangleFilter triangleFilter=new ArcGIS.Core.Data.Analyst3D.TinTriangleFilter();
triangleFilter.FilterEnvelope =envelope;
triangleFilter.DataElementsOnly =true;using(ArcGIS.Core.Data.Analyst3D.TinTriangleCursor triangleCursor= tinLayer.SearchTriangles(triangleFilter)){while(triangleCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinTriangle triangle= triangleCursor.Current){}}}
LAS Dataset Layer Display Filter
Get and Set Display Filter
// get the current display filterLasPointDisplayFilterptFilter= lasDatasetLayer.GetDisplayFilter();// display only ground points
lasDatasetLayer.SetDisplayFilter(LasPointDisplayFilterType.Ground);// display first return points
lasDatasetLayer.SetDisplayFilter(LasPointDisplayFilterType.FirstReturnPoints);// set display filter to a set of classification codesList<int>classifications=newList<int>(){4,5,7,10};
lasDatasetLayer.SetDisplayFilter(classifications);// set display filter to a set of returnsList<ArcGIS.Core.Data.Analyst3D.LasReturnType>returns=newList<ArcGIS.Core.Data.Analyst3D.LasReturnType>(){ ArcGIS.Core.Data.Analyst3D.LasReturnType.ReturnFirstOfMany};
lasDatasetLayer.SetDisplayFilter(returns);// set up a display filtervarnewDisplayFilter=new LasPointDisplayFilter();
newDisplayFilter.Returns =newList<ArcGIS.Core.Data.Analyst3D.LasReturnType>(){ ArcGIS.Core.Data.Analyst3D.LasReturnType.ReturnFirstOfMany, ArcGIS.Core.Data.Analyst3D.LasReturnType.ReturnLastOfMany};
newDisplayFilter.ClassCodes =newList<int>(){2,4};
newDisplayFilter.KeyPoints =true;
newDisplayFilter.WithheldPoints =false;
newDisplayFilter.SyntheticPoints =false;
newDisplayFilter.NotFlagged =false;
lasDatasetLayer.SetDisplayFilter(returns);
Active Surface Constraints
varactiveSurfaceConstraints= lasDatasetLayer.GetActiveSurfaceConstraints();// clear all surface constraints (i.e. none are active)
lasDatasetLayer.SetActiveSurfaceConstraints(null);// set all surface constraints activeusing(varlasDataset= lasDatasetLayer.GetLasDataset()){varsurfaceConstraints= lasDataset.GetSurfaceConstraints();varnames= surfaceConstraints.Select(sc => sc.DataSourceName).ToList();
lasDatasetLayer.SetActiveSurfaceConstraints(names);}
LAS Dataset Layer Searching
Search for LAS Points
// searching on the LasDatasetLayer will honor any LasPointDisplayFilter// search all pointsusing(ArcGIS.Core.Data.Analyst3D.LasPointCursor ptCursor= lasDatasetLayer.SearchPoints(null)){while(ptCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.LasPoint point= ptCursor.Current){}}}// search within an extent
ArcGIS.Core.Data.Analyst3D.LasPointFilter pointFilter=new ArcGIS.Core.Data.Analyst3D.LasPointFilter();
pointFilter.FilterGeometry =envelope;using(ArcGIS.Core.Data.Analyst3D.LasPointCursor ptCursor= lasDatasetLayer.SearchPoints(pointFilter)){while(ptCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.LasPoint point= ptCursor.Current){}}}// search within an extent and limited to specific classification codespointFilter=new ArcGIS.Core.Data.Analyst3D.LasPointFilter();
pointFilter.FilterGeometry =envelope;
pointFilter.ClassCodes =newList<int>{4,5};using(ArcGIS.Core.Data.Analyst3D.LasPointCursor ptCursor= lasDatasetLayer.SearchPoints(pointFilter)){while(ptCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.LasPoint point= ptCursor.Current){}}}
Search using pre initialized arrays
// search all points and process with a set size of array retrieving only coordinatesusing(ArcGIS.Core.Data.Analyst3D.LasPointCursor ptCursor= lasDatasetLayer.SearchPoints(null)){intcount;
Coordinate3D[]lasPointsRetrieved=new Coordinate3D[10000];while(ptCursor.MoveNextArray(lasPointsRetrieved,null,null,null,out count)){varpoints= lasPointsRetrieved.ToList();// ...}}// search within an extent// use MoveNextArray retrieving coordinates, fileIndex and pointIds
ArcGIS.Core.Data.Analyst3D.LasPointFilter filter=new ArcGIS.Core.Data.Analyst3D.LasPointFilter();
filter.FilterGeometry =envelope;using(ArcGIS.Core.Data.Analyst3D.LasPointCursor ptCursor= lasDatasetLayer.SearchPoints(filter)){intcount;
Coordinate3D[]lasPointsRetrieved=new Coordinate3D[50000];int[]fileIndexes=newint[50000];double[]pointIds=newdouble[50000];while(ptCursor.MoveNextArray(lasPointsRetrieved,null, fileIndexes, pointIds,out count)){varpoints= lasPointsRetrieved.ToList();}}
LAS Dataset Layer Eye Dome Lighting
Eye Dome Lighting
// get current EDL settingsboolisEnabled= lasDatasetLayer.IsEyeDomeLightingEnabled;varradius= lasDatasetLayer.EyeDomeLightingRadius;varstrength= lasDatasetLayer.EyeDomeLightingStrength;// set EDL values
lasDatasetLayer.SetEyeDomeLightingEnabled(true);
lasDatasetLayer.SetEyeDomeLightingStrength(65.0);
lasDatasetLayer.SetEyeDomeLightingRadius(2.0);
Line of Sight
Get Line of Sight
varlosParams=new LineOfSightParams();
losParams.ObserverPoint =observerPoint;
losParams.TargetPoint =targetPoint;// add offsets if appropriate// losParams.ObserverHeightOffset = observerOffset;// losParams.TargetHeightOffset = targerOffset;// set output spatial reference
losParams.OutputSpatialReference = MapView.Active.Map.SpatialReference;LineOfSightResultresults=null;try{if(tinLayer.CanGetLineOfSight(losParams))results= tinLayer.GetLineOfSight(losParams);}catch(Exceptionex){// log exception message}if(results!=null){booltargetIsVisibleFromObserverPoint= results.IsTargetVisibleFromObserverPoint;//These properties are not used. They will always be false// results.IsTargetVisibleFromVisibleLine;// results.IsTargetVisibleFromInvisibleLine;if(results.VisibleLine !=null)
MapView.Active.AddOverlay(results.VisibleLine, visibleLineSymbol.MakeSymbolReference());if(results.InvisibleLine !=null)
MapView.Active.AddOverlay(results.VisibleLine, invisibleLineSymbol.MakeSymbolReference());if(results.ObstructionPoint !=null)
MapView.Active.AddOverlay(results.ObstructionPoint, obstructionPointSymbol.MakeSymbolReference());}
TIN Layer Functionalities
Get Elevation, Slope, Aspect from TIN layer at a location
vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();await QueuedTask.Run(()=>{// get elevation, slope and aspect valuesSurfaceValuesvalues= tinLayer.GetSurfaceValues(mapPoint);varelev= values.Elevation;varslopeRadians= values.Slope;varslopeDegrees= values.SlopeDegrees;varslopePercent= values.SlopePercent;varaspectRadians= values.Aspect;varaspectDegrees= values.AspectDegrees;});
Get Z values from a TIN Layer
vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();await QueuedTask.Run(()=>{if(tinLayer.CanGetZs()){// get z value for a mapPointvarzResult= tinLayer.GetZs(mapPoint);if(zResult.Status == SurfaceZsResultStatus.Ok){// cast to a mapPointvarmapPointZ= zResult.Geometry as MapPoint;varz= mapPointZ.Z;}// get z values for a polylinezResult= tinLayer.GetZs(polyline);if(zResult.Status == SurfaceZsResultStatus.Ok){// cast to a PolylinevarpolylineZ= zResult.Geometry as Polyline;}}});
Interpolate Shape
vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();await QueuedTask.Run(()=>{Geometryoutput=null;// interpolate z values for a geometryif(tinLayer.CanInterpolateShape(polyline))output= tinLayer.InterpolateShape(polyline, SurfaceInterpolationMethod.NaturalNeighbor);if(output!=null){// process the output}// densify the shape before interpolatingif(tinLayer.CanInterpolateShape(polygon))output= tinLayer.InterpolateShape(polygon, SurfaceInterpolationMethod.Linear,0.01,0);if(output!=null){// process the output}});
Interpolate Shape Verticies
vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();await QueuedTask.Run(()=>{// interpolate z values at the geometry vertices onlyGeometryoutput= tinLayer.InterpolateShapeVertices(polyline, SurfaceInterpolationMethod.NaturalNeighbor);if(output!=null){// process the output}// or use a different interpolation methodoutput= tinLayer.InterpolateShapeVertices(polyline, SurfaceInterpolationMethod.Linear);});
Interpolate Z at an x,y location
vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();await QueuedTask.Run(()=>{// interpolate values at the specified x,y locationdoublez= tinLayer.InterpolateZ(x, y, SurfaceInterpolationMethod.NaturalNeighborZNearest);// or use a different interpolation methodz= tinLayer.InterpolateZ(x, y, SurfaceInterpolationMethod.Linear);});
Get 3D length of multipart by interpolating heights
vartinLayer= MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();await QueuedTask.Run(()=>{// interpolate heights and calculate the sum of 3D distances between the verticesdoublelength3d= tinLayer.GetSurfaceLength(polygon, SurfaceInterpolationMethod.NaturalNeighbor);// or use a different interpolation methodlength3d= tinLayer.GetSurfaceLength(polyline, SurfaceInterpolationMethod.NaturalNeighborZNearest);// densify the shape before interpolatinglength3d= tinLayer.GetSurfaceLength(polygon, SurfaceInterpolationMethod.NaturalNeighbor,0.01,0);});