ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / PointCloudSceneLayer Class / SetFilters Method
The enumeration of filters to set
Example

In This Topic
    SetFilters Method
    In This Topic
    Sets a collection of filters. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    filters
    The enumeration of filters to set
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Set a Filter for PointCloudSceneLayer
    {
      // Note: call within QueuedTask.Run()
      {
        //Retrieve the available classification codes
        var dict = pointCloudSceneLayer.GetAvailableClassCodesAndLabels();
    
        //Filter out low noise and unclassified (7 and 1 respectively)
        //consult https://pro.arcgis.com/en/pro-app/help/data/las-dataset/storing-lidar-data.htm
        var filterDef = new PointCloudFilterDefinition()
        {
          ClassCodes = dict.Keys.Where(c => c != 7 && c != 1).ToList(),
          ReturnValues = new List<PointCloudReturnType> {
                            PointCloudReturnType.FirstOfMany }
        };
        //apply the filter
        pointCloudSceneLayer.SetFilters(filterDef.ToCIM());
      }
    }
    Update the ClassFlags for PointCloudSceneLayer
    {
      // Note: call within QueuedTask.Run()
      {
        var filters = pointCloudSceneLayer.GetFilters();
        PointCloudFilterDefinition fdef = null;
        if (filters.Count() == 0)
        {
          fdef = new PointCloudFilterDefinition()
          {
            //7 is "edge of flight line" - exclude
            ClassFlags = new List<ClassFlag> {
             new ClassFlag(7, ClassFlagOption.Exclude) }
          };
        }
        else
        {
          fdef = PointCloudFilterDefinition.FromCIM(filters);
          //keep any include or ignore class flags
          var keep = fdef.ClassFlags.Where(
                 cf => cf.ClassFlagOption != ClassFlagOption.Exclude).ToList();
          //7 is "edge of flight line" - exclude
          keep.Add(new ClassFlag(7, ClassFlagOption.Exclude));
          fdef.ClassFlags = keep;
        }
        //apply
        pointCloudSceneLayer.SetFilters(fdef.ToCIM());
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also