BuildingFilter

AMD: require(["esri/layers/support/BuildingFilter"], (BuildingFilter) => { /* code goes here */ });
ESM: import BuildingFilter from "@arcgis/core/layers/support/BuildingFilter.js";
Class: esri/layers/support/BuildingFilter
Inheritance: BuildingFilterAccessor
Since: ArcGIS Maps SDK for JavaScript 4.12

The BuildingFilter class defines a set of conditions that can be used to show or hide specific features of a BuildingSceneLayer in the SceneView. For example, if you want to see parts of a building that are on the second floor, you can set a filter to only show the second floor. The filter can be activated on a layer by adding it to the BuildingSceneLayer.filters collection and assigning id to BuildingSceneLayer.activeFilterId. Once the filter is activated, only the features that satisfy the conditions defined by filterBlocks are displayed in the SceneView.

See also
Example
// define a floor filter
const buildingFilter = new BuildingFilter({
  filterBlocks: [{
    // an SQL expression that filters using the BldgLevel field
    filterExpression: "BldgLevel = 3",
    filterMode: {
      type: "wire-frame",
      edges: {
         type: "solid",
         color: [0, 0, 0, 0.8]
      }
    }
  }]
});
// set the filter in the filters array on the layer
buildingLayer.filters = [buildingFilter];
// specify which filter is the one that should be applied
buildingLayer.activeFilterId = buildingFilter.id;

Constructors

BuildingFilter

Constructor
new BuildingFilter(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The name of the class.

Accessor

Description of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro.

BuildingFilter

Filter blocks define which features should be visible in the affected BuildingSceneLayer and how the filtered features are drawn.

BuildingFilter

Unique filter id.

BuildingFilter

Name of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro.

BuildingFilter

Property Details

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

description

Property
description String

Description of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro.

filterBlocks

Property
filterBlocks Collection<BuildingFilterBlock>

Filter blocks define which features should be visible in the affected BuildingSceneLayer and how the filtered features are drawn. A filter should contain at least one filter block.

The order of filter blocks influences the order in which the filter blocks are applied. For example, if a filter block using a wire-frame mode precedes a solid filter block in the collection, elements that match either filter block will be drawn as wireframe.

id

Property
id Stringreadonly

Unique filter id. Assign this id to BuildingSceneLayer.activeFilterId to activate the filter.

name

Property
name String

Name of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor
*

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

BuildingFilter

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Converts an instance of this class to its ArcGIS portal JSON representation.

BuildingFilter

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

fromJSON

Method
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
Type Description
* Returns a new instance of this class.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

toJSON

Method
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

Type Definitions

BuildingFilterBlock

Type Definition
BuildingFilterBlock Object

Object contained in the filterBlocks collection:

Properties
filterExpression String|null

The SQL where clause used to match features to this filter block. Only the features that satisfy the filter expression are displayed in the SceneView. This property is evaluated on the client using the cached attributes and it only supports standardized SQL.

filterMode Object
optional

This object contains information about the filter mode of the filter block.

Specification
type String
optional
Default Value:solid

Defines how features are drawn while the filter is active. solid mode renders the features with the original texture. With wire-frame mode, only the edges of the features are shown. x-ray renders elements semi-transparent with white color. To ensure performance on client applications, it is not recommended to declare multiple filter blocks with the same filter mode.

Possible Values:"solid"|"wire-frame"|"x-ray"

optional

Defines the type of edges used to display a BuildingSceneLayer filtered in wire-frame mode. This property can only be used with filterMode of type wire-frame.

title String
optional

Title of the filter for display in UIs, for example when the filter block is edited in ArcGIS Pro.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.