Overview

The BuildingSceneLayer is designed for visualizing buildings with detailed interiors in a SceneView. These building models are usually exported from Building Information Modeling (BIM) projects. The data in a BuildingSceneLayer can represent walls, lighting fixtures, mechanical systems, furniture and so on.

Read more

Structure of a BuildingSceneLayer

BuildingSceneLayers visualize complex digital models of buildings and allow you to interact with all the components of the building. Because of the high complexity, the data in a BuildingSceneLayer is organized in BuildingGroupSublayers which contain BuildingComponentSublayers.

Often, the BuildingSceneLayer contains an overview BuildingComponentSublayer that can be loaded to display the exterior shell of a building.

This helps to get a faster preview of the whole building without loading all interior features:

The BuildingSceneLayer also contains a Full Model BuildingGroupSublayer with all the features in a building grouped by disciplines: Architectural, Structural, Electrical and Mechanical. Each of the disciplines is a BuildingGroupSublayer that contains BuildingComponentSublayers with features such as rooftops, walls, doors, AC units, lighting fixtures, columns or foundations.

Visualization

Being able to visualize detailed building information in its spatial context and landscape is a useful capability. To extract even more information from the visualization, attribute driven renderers and visual variables can be assigned to BuildingComponentSublayer.renderer. For example the Doors sublayer can use a UniqueValueRenderer to render all the interior doors that need replacement with a red color:

Filtering data

Often, the features in a BuildingSceneLayer might occlude one another. Attribute based filtering can be used to display only the features that satisfy a certain SQL expression. The BuildingComponentSublayer.definitionExpression property can be used to filter features based on the attributes.

Property Details

// finds the sublayer containing the doors// use modelName to identify each layer as this is a standard nameconst doorslayer = buildingSceneLayer.allSublayers.find(function(sublayer) {
return sublayer.modelName === "Doors";
});

Defines how features are placed on the vertical axis (z). Currently only absolute-height mode is supported.

Mode

Description

absolute-height

Features are placed at an absolute elevation (z-value) above sea level. This z-value is determined by summing up the offset value and the point's z-value. It doesn't take the elevation of the terrain into account. This is the only supported elevation mode for a BuildingSceneLayer.

The full extent of the layer. By default, this is worldwide. This property may be used to set the extent of the view to match a layer's extent so that its features appear to fill the view. See the sample snippet below.

Example:

// Once the layer loads, set the view's extent to the layer's fullextent
layer.when(function(){
view.extent = layer.fullExtent;
});

The layer ID, or layer index, of a Scene Service layer. This is particularly useful when loading a single layer with the portalItem property from a service containing multiple layers. You can specify this value in one of two scenarios:

If a layerId is not specified in either of the above scenarios, then the first layer in the service (layerId = 0) is selected.

Examples:

// while these examples use a SceneLayer, the same pattern can be// used for other layers that may be loaded from portalItem ids// loads the third layer in the given Portal Itemvar layer = new SceneLayer({
portalItem: {
id: "73df987984b24094b848d580eb83b0fb"
},
layerId: 2
});

// If not specified, the first layer (layerId: 0) will be returnedvar layer = new SceneLayer({
portalItem: {
id: "73df987984b24094b848d580eb83b0fb"
}
});

// Can also be used if URL points to service and not layervar layer = new SceneLayer({
url: "https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer",
layerId: 0// Notice that the url doesn't end with /2
});

// This code returns the same layer as the previous snippetvar layer = new SceneLayer({
url: "https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer/0",
// The layer id is specified in the URL
});

The portal item from which the layer is loaded. If the portal item references a Feature Service or Scene Service, then you can specify a single layer to load with the layerId property.

Examples:

// while this example uses FeatureLayer, this same pattern can be// used for other layers that may be loaded from portalItem idsvar lyr = new FeatureLayer({
portalItem: { // autocasts as new PortalItem()
id: "caa9bd9da1f4487cb4989824053bb847"
} // the first layer in the service is returned
});

// set hostname when using an on-premise portal (default is ArcGIS Online)// esriConfig.portalUrl = "http://myHostName.esri.com/arcgis";// while this example uses FeatureLayer, this same pattern can be// used for SceneLayersvar lyr = new FeatureLayer({
portalItem: { // autocasts as new PortalItem()
id: "8d26f04f31f642b6828b7023b84c2188"
},
// loads the third item in the given feature service
layerId: 2
});

The title of the layer used to identify it in places such as the Legend and LayerList widgets.

When loading a layer by service url, the title is derived from the service name. If the service has several layers, then the title of each layer will be the concatenation of the service name and the layer name. When the layer is loaded from a portal item, the title of the portal item will be used instead. Finally, if a layer is loaded as part of a webmap or a webscene, then the title of the layer as stored in the webmap/webscene will be used.

The URL of the REST endpoint of the layer or scene service. The URL may either point to a resource on ArcGIS Enterprise or ArcGIS Online.

The layer may be specified using the layerId property when the url points directly to a service and not a specific layer. If layerId is not specified, then it will default to the first layer in the service.

// Can also be used if URL points to service and not layervar layer = new SceneLayer({
// Notice that the url doesn't end with /0
url: "https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer",
layerId: 0
});

Method Details

Called by the views, such as MapView and SceneView, when the layer is added to the Map.layers collection and a layer view must be created for it. This method is used internally and there is no use case for invoking it directly.

when() may be leveraged once an instance of the class is created. This method takes two input parameters: a callback function and an errback function. The callback executes when the instance of the class loads. The errback executes if the instance of the class fails to load.

Returns a new promise for the result of callback that may be used to chain additional functions.

Example:

// Although this example uses MapView, any class instance that is a promise may use then() in the same wayvar view = new MapView();
view.when(function(){
// This function will execute once the promise is resolved
}, function(error){
// This function will execute if the promise is rejected due to an error
});

// This function will fire each time a layer view is created for this// particular view.
layer.on("layerview-create", function(event){
// The LayerView for the layer that emitted this event
event.layerView;
});