View on GitHub Sample viewer app

Explore details of a building scene by using filters and sublayer visibility.

Image of a building scene layer

Use case

Buildings and their component parts (in this example, structural, electrical, or architectural) can be difficult to explain and visualize. An architectural firm might share a 3D building model visualization with clients and contractors to let them explore these components by floor and component type.

How to use the sample

In the filter controls, select floor and category options to filter what parts of the Building Scene Layer are displayed in the scene. Click on any of the building features to identify them.

How it works

  1. Create an ArcGISScene with the URL to a Building Scene Layer service.
  2. Create a LocalSceneView and add the scene.
  3. Retrieve the BuildingSceneLayer from the scene’s operational layers.
  4. Click the floating action button to view the filtering options.
  5. Select a floor from the “Floor” dropdown to view the internal details of each floor or “All” to view the entire model.
  6. Expand the categories to show or hide individual items in the building model. The entire category may be shown or hidden as well.
  7. Click on any of the building features to view the attributes of the feature.

Relevant API

  • ArcGISScene
  • BuildingComponentSublayer
  • BuildingFilter
  • BuildingFilterBlock
  • BuildingSceneLayer
  • LocalSceneView
  • Popup

About the data

This sample uses the Esri Building E Local Scene web scene, which contains a Building Scene Layer representing Building E on the Esri Campus in Redlands, CA. The Revit BIM model was brought into ArcGIS using the BIM capabilities in ArcGIS Pro and published to the web as a Building Scene Layer.

Additional information

Buildings in a Building Scene Layer can be very complex models composed of sublayers containing internal and external features of the structure. Sublayers may include structural components like columns, architectural components like floors and windows, and electrical components.

Applying filters to the Building Scene Layer can highlight features of interest in the model. Filters are made up of filter blocks, which contain several properties that allow control over the filter’s function. Setting the filter mode to X-Ray, for instance, will render features with a semi-transparent white color so other interior features can be seen. In addition, toggling the visibility of sublayers can show or hide all the features of a sublayer.

This sample uses the Popup toolkit component. For information about setting up the toolkit, as well as code for the underlying component, visit the toolkit docs.

Tags

3D, building scene layer, layers, popup, toolkit

Sample Code

MainActivity.kt MainActivity.kt FilterBuildingSceneLayerScreen.kt FilterBuildingSceneLayerViewModel.kt
/* Copyright 2025 Esri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.esri.arcgismaps.sample.filterbuildingscenelayer
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import com.arcgismaps.ApiKey
import com.arcgismaps.ArcGISEnvironment
import com.esri.arcgismaps.sample.filterbuildingscenelayer.screens.FilterBuildingSceneLayerScreen
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// authentication with an API key or named user is
// required to access basemaps and other location services
ArcGISEnvironment.apiKey = ApiKey.create(BuildConfig.ACCESS_TOKEN)
ArcGISEnvironment.applicationContext = this
setContent {
SampleAppTheme {
FilterBuildingSceneLayerApp()
}
}
}
@Composable
private fun FilterBuildingSceneLayerApp() {
Surface(color = MaterialTheme.colorScheme.background) {
FilterBuildingSceneLayerScreen(
sampleName = getString(R.string.filter_building_scene_layer_app_name)
)
}
}
}