You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

Filter (masking) features is useful in urban planning. In this sample users can hide buildings and trees by drawing a masking polygon, polyline or points with buffers.

The polygon, polyline or point used for filtering is drawn using the SketchViewModel. We define it by passing in the view and a GraphicsLayer where the polygon, polyline or point is drawn. Optionally we can set a symbol for the polygon, polyline or point:

// use SketchViewModel to draw polygons that are used as a filter
const sketchViewModel = new SketchViewModel({
  layer: graphicsLayer,
  view: view,
  polygonSymbol: {
    type: "polygon-3d",
    symbolLayers: [
        type: "fill",
        material: {
          color: [255, 255, 255, 0.8]
        outline: {
          color: [211, 132, 80, 0.7],
          size: "10px"

Spatial filtering can be easily achieved by setting a filter on a SceneLayerView:

buildingLayerView.filter = new FeatureFilter({
  geometry: polygon,
  spatialRelationship: "disjoint"

Currently for 3D object SceneLayerViews spatial FeatureFilter only works when spatialRelationship is one of contains, intersects, disjoint.

Other helpful resources

Sample search results