ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / LasDatasetLayer Class / SearchPoints Method
Filter by parameters. See ArcGIS.Core.Data.Analyst3D.LasPointFilter. A null value will retrieve all points in the LAS layer.
Example

In This Topic
    SearchPoints Method (LasDatasetLayer)
    In This Topic
    Retrieves the points in the LAS dataset layer that satisfy the criteria set in the filter. If no filter is set, all points will be retrieved. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public LasPointCursor SearchPoints( 
       LasPointFilter filter
    )
    Public Function SearchPoints( _
       ByVal filter As LasPointFilter _
    ) As LasPointCursor

    Parameters

    filter
    Filter by parameters. See ArcGIS.Core.Data.Analyst3D.LasPointFilter. A null value will retrieve all points in the LAS layer.

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run
    Remarks

    If there is an existing display filter set on the layer, the Search() method will work on the subset of points in the layer that meet the display filter definition criteria. The search filter will be applied after the LAS dataset layer's display filter.

    To ensure maximum robustness, callers should explicitly dispose of the returned ArcGIS.Core.Data.Analyst3D.LasPointCursor in either a using statement or a finally block.

    Example
    Search for LAS Points
    // searching on the LasDatasetLayer will honor any LasPointDisplayFilter
    
    // search all points
    using (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 codes
    pointFilter = new ArcGIS.Core.Data.Analyst3D.LasPointFilter();
    pointFilter.FilterGeometry = envelope;
    pointFilter.ClassCodes = new List<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 coordinates
    using (ArcGIS.Core.Data.Analyst3D.LasPointCursor ptCursor = lasDatasetLayer.SearchPoints(null))
    {
      int count;
      Coordinate3D[] lasPointsRetrieved = new Coordinate3D[10000];
      while (ptCursor.MoveNextArray(lasPointsRetrieved, null, null, null, out count))
      {
        var points = 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))
    {
      int count;
      Coordinate3D[] lasPointsRetrieved = new Coordinate3D[50000];
      int[] fileIndexes = new int[50000];
      double[] pointIds = new double[50000];
      while (ptCursor.MoveNextArray(lasPointsRetrieved, null, fileIndexes, pointIds, out count))
      {
        var points = lasPointsRetrieved.ToList();
    
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also