Filter 3D scene features out of a given geometry with a polygon filter.

Use case
You can directly control what users see within a specific scene view to give a more focused or cleaner user experience by using a SceneLayerPolygonFilter to selectively show or hide scene features within a given area.
How to use the sample
The sample initializes showing the “Navigation” 3D Basemap. Tap the “Filter” button to set a SceneLayerPolygonFilter and filter out the Esri 3D buildings within the extent of a detailed buildings scene layer. Notice how the Esri 3D buildings within and intersecting the extent of the detailed buildings layer are hidden. Tap the “Show Detailed Buildings” button to load a scene layer that contains more detailed buildings. Tap the “Reset” button to hide the detailed buildings scene layer and clear the 3D buildings filter.
How it works
- Create a
Surfacefor the scene and set the World Elevation 3D as an elevation source. - Create a
Basemapfor the scene using the “Navigation” 3D Basemap, load it, then search for the “Buildings” base layer. - Add the 3D San Francisco Buildings
ArcGISSceneLayerto the scene’s operational layers and set its visibility tofalseso it does not intersect the 3D basemap buildings. - Create a
SceneLayerPolygonFilterwith the extent of the San Francisco Buildings Scene Layer and theSceneLayerPolygonFilter.SpatialRelationship.disjointenum to hide all features within the extent. - Set the
SceneLayerPolygonFilteron the Buildings layer to hide all buildings within the extent of the San Francisco Buildings layer. - Set the visibility of the 3D San Francisco Buildings layer to
trueto show the 3D buildings in the extent.
Relevant API
- ArcGISSceneLayer
- SceneLayerPolygonFilter
- SceneLayerPolygonFilter.SpatialRelationship
About the data
This sample uses the Navigation 3D Basemap, which includes commercial 3D buildings data acquired from TomTom and Vantor, in addition to Esri Community Maps and Overture Maps Foundation data. It also uses the San Francisco 3D Buildings scene layer, which provides detailed 3D models of buildings in San Francisco, California, USA.
Additional information
This sample uses SceneLayerPolygonFilter.SpatialRelationship.disjoint to hide all features within the extent of the given geometry. You can alternatively use SceneLayerPolygonFilter.SpatialRelationship.contains to only show features within the extent of the geometry.
You can also show or hide features in a scene layer using ArcGISSceneLayer.setVisible(_:for:) and pass in a feature or a list of features and a boolean value to set their visibility.
Tags
3D, buildings, disjoint, exclude, extent, filter, hide, polygon