// 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=newUri(tinPath);vartinCP=newTinLayerCreationParams(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=newTinLayerCreationParams(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=newTinLayerCreationParams(tinDataset);tinCP_renderers.Name="My TIN layer";tinCP_renderers.IsVisible=true;// define the node renderer - use defaultsvarnode_rd=newTinNodeRendererDefinition();// define the face/surface renderervarface_rd=newTinFaceClassBreaksRendererDefinition();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 paramstinCP_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=newUri(terrainPath);varterrainCP=newTerrainLayerCreationParams(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=newTerrainLayerCreationParams(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=newTerrainLayerCreationParams(terrain);terrainCP_renderers.Name="My LAS Layer";terrainCP_renderers.IsVisible=true;// define the edge type renderer - use defaultsvaredgeRD=newTinBreaklineRendererDefinition();// define the face/surface renderervarfaceRD=newTinFaceClassBreaksRendererDefinition();faceRD.ClassificationMethod=ClassificationMethod.NaturalBreaks;// accept default color ramp, breakCount// define the dirty area renderer - use defaultsvardirtyAreaRD=newTerrainDirtyAreaRendererDefinition();// 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 paramsterrainCP_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=newUri(lasPath);varlasCP=newLasDatasetLayerCreationParams(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=newLasDatasetLayerCreationParams(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=newLasDatasetLayerCreationParams(lasDataset);lasCP_renderers.Name="My LAS Layer";lasCP_renderers.IsVisible=false;// create a point elevation renderervarptR=newLasStretchRendererDefinition();// accept all defaults// create a simple edge renderervaredgeR=newTinEdgeRendererDefintion();// 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 paramslasCP_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=newTinNodeRendererDefinition();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=newTinNodeClassBreaksRendererDefinition();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=newTinNodeClassBreaksRendererDefinition();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=newTinNodeClassBreaksRendererDefinition();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=newTinEdgeRendererDefintion();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=newTinBreaklineRendererDefinition();// use default symbol for regular edge but specific symbols for hard,soft,outsidebreaklineRendererDef.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=newTinContourRendererDefinition();// now customize with a symbolcontourDef.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);}
varaspectFaceRendererDef=newTinFaceClassBreaksAspectRendererDefinition();aspectFaceRendererDef.SymbolTemplate=polySymbol.MakeSymbolReference();// accept default color rampif(surfaceLayer.CanCreateRenderer(aspectFaceRendererDef)){CIMTinRendererrenderer=surfaceLayer.CreateRenderer(aspectFaceRendererDef);if(surfaceLayer.CanSetRenderer(renderer,SurfaceRendererTarget.Surface))surfaceLayer.SetRenderer(renderer,SurfaceRendererTarget.Surface);}
Slope Face Renderer - Equal Interval
varslopeFaceClassBreaksEqual=newTinFaceClassBreaksRendererDefinition(TerrainDrawCursorType.FaceSlope);// accept default breakCount, symbolTemplate, color rampif(surfaceLayer.CanCreateRenderer(slopeFaceClassBreaksEqual)){CIMTinRendererrenderer=surfaceLayer.CreateRenderer(slopeFaceClassBreaksEqual);if(surfaceLayer.CanSetRenderer(renderer,SurfaceRendererTarget.Surface))surfaceLayer.SetRenderer(renderer,SurfaceRendererTarget.Surface);}
Slope Face Renderer - Quantile
varslopeFaceClassBreaksQuantile=newTinFaceClassBreaksRendererDefinition(TerrainDrawCursorType.FaceSlope);slopeFaceClassBreaksQuantile.ClassificationMethod=ClassificationMethod.Quantile;// accept default breakCount, symbolTemplate, color rampif(surfaceLayer.CanCreateRenderer(slopeFaceClassBreaksQuantile)){CIMTinRendererrenderer=surfaceLayer.CreateRenderer(slopeFaceClassBreaksQuantile);if(surfaceLayer.CanSetRenderer(renderer,SurfaceRendererTarget.Surface))surfaceLayer.SetRenderer(renderer,SurfaceRendererTarget.Surface);}
Elevation Face Renderer - Equal Interval
varelevFaceClassBreaksEqual=newTinFaceClassBreaksRendererDefinition();// accept default breakCount, symbolTemplate, color rampif(surfaceLayer.CanCreateRenderer(slopeFaceClassBreaksEqual)){CIMTinRendererrenderer=surfaceLayer.CreateRenderer(slopeFaceClassBreaksEqual);if(surfaceLayer.CanSetRenderer(renderer,SurfaceRendererTarget.Surface))surfaceLayer.SetRenderer(renderer,SurfaceRendererTarget.Surface);}
Dirty Area Renderer
// applies to Terrain layers onlyvardirtyAreaRendererDef=newTerrainDirtyAreaRendererDefinition();// accept default labels, symbolTemplatevarterrainLayer=MapView.Active.Map.GetLayersAsFlattenedList().OfType<TerrainLayer>().FirstOrDefault();if(terrainLayer==null)return;if(terrainLayer.CanCreateRenderer(dirtyAreaRendererDef)){CIMTinRendererrenderer=terrainLayer.CreateRenderer(dirtyAreaRendererDef);if(terrainLayer.CanSetRenderer(renderer,SurfaceRendererTarget.DirtyArea))terrainLayer.SetRenderer(renderer,SurfaceRendererTarget.DirtyArea);}
Terrain Point Class Breaks Renderer
// applies to Terrain layers onlyvarterrainPointClassBreaks=newTerrainPointClassBreaksRendererDefinition();// accept defaultsif(terrainLayer.CanCreateRenderer(terrainPointClassBreaks)){CIMTinRendererrenderer=terrainLayer.CreateRenderer(terrainPointClassBreaks);if(terrainLayer.CanSetRenderer(renderer,SurfaceRendererTarget.Points))terrainLayer.SetRenderer(renderer,SurfaceRendererTarget.Points);}
LAS Points Classification Unique Value Renderer
// applies to LAS dataset layers onlyvarlasPointsClassificationRendererDef=newLasUniqueValueRendererDefinition(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=newLasUniqueValueRendererDefinition(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=newLasStretchRendererDefinition(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=newLasStretchRendererDefinition(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=newLasPointClassBreaksRendererDefinition();lasPointsClassBreaksRendererDef.ClassificationMethod=ClassificationMethod.NaturalBreaks;lasPointsClassBreaksRendererDef.ModulateUsingIntensity=true;// increase the symbol size by a factorlasPointsClassBreaksRendererDef.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.TinNodeCursornodeCursor=tinLayer.SearchNodes(null)){while(nodeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinNodenode=nodeCursor.Current){}}}// search "inside" nodes with an extentArcGIS.Core.Data.Analyst3D.TinNodeFilternodeFilter=newArcGIS.Core.Data.Analyst3D.TinNodeFilter();nodeFilter.FilterEnvelope=envelope;using(ArcGIS.Core.Data.Analyst3D.TinNodeCursornodeCursor=tinLayer.SearchNodes(nodeFilter)){while(nodeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinNodenode=nodeCursor.Current){}}}// search for super nodes onlyvarsupernodeFilter=newArcGIS.Core.Data.Analyst3D.TinNodeFilter();supernodeFilter.FilterEnvelope=tinDataset.GetSuperNodeExtent();supernodeFilter.DataElementsOnly=false;supernodeFilter.SuperNode=true;using(ArcGIS.Core.Data.Analyst3D.TinNodeCursornodeCursor=tinLayer.SearchNodes(nodeFilter)){while(nodeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinNodenode=nodeCursor.Current){}}}// search all edges within an extent// this could include outside or edges attached to super nodes depending upon the extentArcGIS.Core.Data.Analyst3D.TinEdgeFilteredgeFilterAll=newArcGIS.Core.Data.Analyst3D.TinEdgeFilter();edgeFilterAll.FilterEnvelope=envelope;edgeFilterAll.DataElementsOnly=false;using(ArcGIS.Core.Data.Analyst3D.TinEdgeCursoredgeCursor=tinLayer.SearchEdges(edgeFilterAll)){while(edgeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinEdgeedge=edgeCursor.Current){}}}// search for hard edges in the TINvaredgeFilter=newArcGIS.Core.Data.Analyst3D.TinEdgeFilter();edgeFilter.FilterByEdgeType=true;edgeFilter.EdgeType=ArcGIS.Core.Data.Analyst3D.TinEdgeType.HardEdge;using(ArcGIS.Core.Data.Analyst3D.TinEdgeCursoredgeCursor=tinLayer.SearchEdges(edgeFilter)){while(edgeCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinEdgeedge=edgeCursor.Current){}}}// search for "inside" triangles in an extentArcGIS.Core.Data.Analyst3D.TinTriangleFiltertriangleFilter=newArcGIS.Core.Data.Analyst3D.TinTriangleFilter();triangleFilter.FilterEnvelope=envelope;triangleFilter.DataElementsOnly=true;using(ArcGIS.Core.Data.Analyst3D.TinTriangleCursortriangleCursor=tinLayer.SearchTriangles(triangleFilter)){while(triangleCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.TinTriangletriangle=triangleCursor.Current){}}}
LAS Dataset Layer Display Filter
Get and Set Display Filter
// get the current display filterLasPointDisplayFilterptFilter=lasDatasetLayer.GetDisplayFilter();// display only ground pointslasDatasetLayer.SetDisplayFilter(LasPointDisplayFilterType.Ground);// display first return pointslasDatasetLayer.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=newLasPointDisplayFilter();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.LasPointCursorptCursor=lasDatasetLayer.SearchPoints(null)){while(ptCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.LasPointpoint=ptCursor.Current){}}}// search within an extentArcGIS.Core.Data.Analyst3D.LasPointFilterpointFilter=newArcGIS.Core.Data.Analyst3D.LasPointFilter();pointFilter.FilterGeometry=envelope;using(ArcGIS.Core.Data.Analyst3D.LasPointCursorptCursor=lasDatasetLayer.SearchPoints(pointFilter)){while(ptCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.LasPointpoint=ptCursor.Current){}}}// search within an extent and limited to specific classification codespointFilter=newArcGIS.Core.Data.Analyst3D.LasPointFilter();pointFilter.FilterGeometry=envelope;pointFilter.ClassCodes=newList<int>{4,5};using(ArcGIS.Core.Data.Analyst3D.LasPointCursorptCursor=lasDatasetLayer.SearchPoints(pointFilter)){while(ptCursor.MoveNext()){using(ArcGIS.Core.Data.Analyst3D.LasPointpoint=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.LasPointCursorptCursor=lasDatasetLayer.SearchPoints(null)){intcount;Coordinate3D[]lasPointsRetrieved=newCoordinate3D[10000];while(ptCursor.MoveNextArray(lasPointsRetrieved,null,null,null,outcount)){varpoints=lasPointsRetrieved.ToList();// ...}}// search within an extent// use MoveNextArray retrieving coordinates, fileIndex and pointIdsArcGIS.Core.Data.Analyst3D.LasPointFilterfilter=newArcGIS.Core.Data.Analyst3D.LasPointFilter();filter.FilterGeometry=envelope;using(ArcGIS.Core.Data.Analyst3D.LasPointCursorptCursor=lasDatasetLayer.SearchPoints(filter)){intcount;Coordinate3D[]lasPointsRetrieved=newCoordinate3D[50000];int[]fileIndexes=newint[50000];double[]pointIds=newdouble[50000];while(ptCursor.MoveNextArray(lasPointsRetrieved,null,fileIndexes,pointIds,outcount)){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 valueslasDatasetLayer.SetEyeDomeLightingEnabled(true);lasDatasetLayer.SetEyeDomeLightingStrength(65.0);lasDatasetLayer.SetEyeDomeLightingRadius(2.0);
Line of Sight
Get Line of Sight
varlosParams=newLineOfSightParams();losParams.ObserverPoint=observerPoint;losParams.TargetPoint=targetPoint;// add offsets if appropriate// losParams.ObserverHeightOffset = observerOffset;// losParams.TargetHeightOffset = targerOffset;// set output spatial referencelosParams.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();awaitQueuedTask.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();awaitQueuedTask.Run(()=>{if(tinLayer.CanGetZs()){// get z value for a mapPointvarzResult=tinLayer.GetZs(mapPoint);if(zResult.Status==SurfaceZsResultStatus.Ok){// cast to a mapPointvarmapPointZ=zResult.GeometryasMapPoint;varz=mapPointZ.Z;}// get z values for a polylinezResult=tinLayer.GetZs(polyline);if(zResult.Status==SurfaceZsResultStatus.Ok){// cast to a PolylinevarpolylineZ=zResult.GeometryasPolyline;}}});
Interpolate Shape
vartinLayer=MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();awaitQueuedTask.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();awaitQueuedTask.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();awaitQueuedTask.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();awaitQueuedTask.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);});