BuildingComponentSublayerView

Class: esri/views/layers/BuildingComponentSublayerView
Inheritance: BuildingComponentSublayerViewAccessor
Since: ArcGIS Maps SDK for JavaScript 4.17

Represents the sublayer view of a BuildingComponentSublayer. The sublayer view can be used for queries of features that are loaded in the view. Sublayer views can be accessed via the sublayerViews property on BuildingSceneLayerView:

// query all sublayers for features that satisfy the sql expression
let query = new Query();
query.where = "FamilyType = 'Landscape'";
view.whenLayerView(buildingSceneLayer).then(function(bslv) {
   bslv.sublayerViews.forEach(function(componentSublayerView) {
     componentSublayerView.queryFeatures(query).then(function(result) {
       console.log(result.features);
     });
   });
});

Queries on the BuildingComponentSublayerView is executed against features that have been loaded for the current view. This means that only visible features are guaranteed to be available once the layer has finished updating. The query methods on the BuildingComponentSublayerView should not be used when the intention is to query or search within the whole dataset, instead the query methods on the BuildingComponentSublayer should be used.

The highlight method can be called on a specific sublayer view:

view.whenLayerView(buildingSceneLayer).then(function(bslv) {
  // get the sublayer view of the component sublayer with id 1
  const sublayerView = bslv.sublayerViews.find(function(sublayerView) {
    return sublayerView.sublayer.id === 1;
  });
  const query = sublayerView.createQuery();
  query.spatialRelationship = "contains";
  query.geometry = polygonGeometry;
  // query sublayer view
  sublayerView.queryObjectIds(query).then(function(result) {
    sublayerView.highlight(result);
  });
});
See also

Property Overview

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

A list of attribute fields fetched for each feature including fields required for layer rendering and additional fields defined on the BuildingComponentSublayer.outFields or BuildingSceneLayer.outFields.

BuildingComponentSublayerView

The name of the class.

Accessor

Applies a client-side FeatureFilter to the displayed data.

BuildingComponentSublayerView

The sublayer being viewed.

BuildingComponentSublayerView

Value is true if the sublayer is suspended (i.e., sublayer will not redraw or update itself when the extent changes).

BuildingComponentSublayerView

Value is true when the sublayer is updating; for example, if it is in the process of fetching data.

BuildingComponentSublayerView

Property Details

availableFields

Property
availableFields String[]readonly

A list of attribute fields fetched for each feature including fields required for layer rendering and additional fields defined on the BuildingComponentSublayer.outFields or BuildingSceneLayer.outFields. The availableFields is populated when the layer view is finished updating. Use this list when querying features on the client-side.

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

filter

Property
filter FeatureFilterautocast
Since: ArcGIS Maps SDK for JavaScript 4.18 BuildingComponentSublayerView since 4.17, filter added at 4.18.

Applies a client-side FeatureFilter to the displayed data. Only the features that satisfy the filter are displayed. The fields to be used for the filter must be present in the layer view's availableFields list.

Known Limitations

  • The timeExtent property is not supported on a SceneLayerView filter.
  • Only spatial filters with spatialRelationship set to contains, intersects or disjoint are supported.

sublayer

Property
sublayer BuildingComponentSublayerreadonly

The sublayer being viewed.

suspended

Property
suspended Booleanreadonly

Value is true if the sublayer is suspended (i.e., sublayer will not redraw or update itself when the extent changes).

updating

Property
updating Booleanreadonly

Value is true when the sublayer is updating; for example, if it is in the process of fetching data.

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 query parameter object that can be used to fetch features as they are being displayed.

BuildingComponentSublayerView

Returns true if a named group of handles exist.

Accessor

Highlights the given feature(s).

BuildingComponentSublayerView
Promise<Object>

Executes a Query against features in the layer view and returns the 3D Extent of features that satisfy the query.

BuildingComponentSublayerView
Promise<Number>

Executes a Query against features in the layer view and returns the number of features that satisfy the query.

BuildingComponentSublayerView
Promise<FeatureSet>

Executes a Query against features in the layer view and returns a FeatureSet.

BuildingComponentSublayerView
Promise<Number[]>

Executes a Query against features in the layer view and returns an array of the ObjectIDs of features that satisfy the input query.

BuildingComponentSublayerView

Removes a group of handles owned by the object.

Accessor

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.

createQuery

Method
createQuery(){Query}

Creates a query parameter object that can be used to fetch features as they are being displayed. It sets the query parameter's outFields property to ["*"] and returnGeometry to true. The output spatial reference is set to the spatial reference of the view. The esri/layers/buildingSublayers/BuildingComponentSublayer.html#definitionExpression that currently applies to the sublayer view is also incorporated in the returned query object.

Returns
Type Description
Query The query object

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");
}

highlight

Method
highlight(target){Handle}

Highlights the given feature(s).

Parameter
optional

The feature(s) to highlight. When passing a graphic or array of graphics, each feature must have a valid objectID. You may alternatively pass one or more objectIDs as a single number or an array.

Returns
Type Description
Handle Returns a highlight handler with a remove() method that can be called to remove the highlight.

queryExtent

Method
queryExtent(query, options){Promise<Object>}

Executes a Query against features in the layer view and returns the 3D Extent of features that satisfy the query. If query parameters are not provided, the extent and count of all loaded features are returned.

Read more about queries in the Query section of the BuildingSceneLayer class description.

To query for the extent of features directly from a Scene Service rather than those loaded for the current view, you must use the BuildingComponentSublayer.queryExtent() method.

For making attribute based queries on a BuildingComponentSublayerView you need to specify the required fields in the outFields property of the BuildingComponentSublayer to ensure that attribute values are available on the client for querying. You can use availableFields to inspect which fields are available on the client.

Known Limitations

  • Spatial queries have the same limitations as those listed in the projection engine documentation.
  • Spatial queries on BuildingComponentSublayerView use the Extent of the feature and not the footprint when calculating the spatial relationship with the query geometry. This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry.
  • Currently only intersects, contains, and disjoint spatialRelationships are supported on spatial queries.
  • Spatial queries are not currently supported if the BuildingComponentSublayerView has any of the following SpatialReferences:
    • GDM 2000 (4742) - Malaysia
    • Gsterberg (Ferro) (8042) - Austria/Czech Republic
    • ISN2016 (8086) - Iceland
    • SVY21 (4757) - Singapore
Parameters
query Query autocast
optional
Autocasts from Object

Specifies the attributes and spatial filter of the query. When no parameters are passed to this method, all features in the client are returned.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Object> When resolved, returns the extent and count of the features that satisfy the input query. See the object specification table below for details.
Property Type Description
count Number The number of features that satisfy the input query.
extent Extent The extent of the features that satisfy the query.

queryFeatureCount

Method
queryFeatureCount(query, options){Promise<Number>}

Executes a Query against features in the layer view and returns the number of features that satisfy the query. If query parameters are not provided, the count of all loaded features is returned.

To query for the count of features directly from a Scene Service rather than those loaded for the current view, you must use the BuildingComponentSublayer.queryFeatureCount() method.

For making attribute based queries on a BuildingSceneLayerView you need to specify the required fields in the outFields property of the BuildingComponentSublayer to ensure that attribute values are available on the client for querying. You can use availableFields to inspect which fields are available on the client. Read more about queries in the Query section of the BuildingSceneLayer class description.

Known Limitations

  • Spatial queries have the same limitations as those listed in the projection engine documentation.
  • Spatial queries on BuildingComponentSublayerView use the Extent of the feature and not the footprint when calculating the spatial relationship with the query geometry. This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry.
  • Currently only intersects, contains, and disjoint spatialRelationships are supported on spatial queries.
  • Spatial queries are not currently supported if the BuildingSceneLayerView has any of the following SpatialReferences:
    • GDM 2000 (4742) - Malaysia
    • Gsterberg (Ferro) (8042) - Austria/Czech Republic
    • ISN2016 (8086) - Iceland
    • SVY21 (4757) - Singapore
Parameters
query Query autocast
optional
Autocasts from Object

Specifies the attributes and spatial filter of the query. When no parameters are passed to this method, all features in the client are returned. To only return features visible in the view, set the geometry parameter in the query object to the view's extent.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Number> When resolved, returns the number of features satisfying the query.

queryFeatures

Method
queryFeatures(query, options){Promise<FeatureSet>}

Executes a Query against features in the layer view and returns a FeatureSet. If query parameters are not provided, all loaded features are returned.

To execute a query against all the features in a Scene Service rather than only those loaded for the current view, you must use the BuildingComponentSublayer.queryFeatures() method.

For making attribute based queries on a BuildingComponentSublayerView you need to specify the required fields in the outFields property of the BuildingComponentSublayer to ensure that attribute values are available on the client for querying. You can use availableFields to inspect which fields are available on the client.

Known Limitations

  • Spatial queries have the same limitations as those listed in the projection engine documentation.
  • Spatial queries on BuildingComponentSublayerView use the Extent of the feature and not the footprint when calculating the spatial relationship with the query geometry. This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry.
  • Currently only intersects, contains, and disjoint spatialRelationships are supported on spatial queries.
  • Spatial queries are not currently supported if the BuildingSceneLayerView has any of the following SpatialReferences:
    • GDM 2000 (4742) - Malaysia
    • Gsterberg (Ferro) (8042) - Austria/Czech Republic
    • ISN2016 (8086) - Iceland
    • SVY21 (4757) - Singapore
Parameters
query Query autocast
optional
Autocasts from Object

Specifies the attributes and spatial filter of the query. When no parameters are passed to this method, all features in the client are returned along with their attributes specified in availableFields. To only return features visible in the view, set the geometry parameter in the query object to the view's extent.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<FeatureSet> When resolved, a FeatureSet is returned. The set will be empty if zero results are found.

queryObjectIds

Method
queryObjectIds(query, options){Promise<Number[]>}

Executes a Query against features in the layer view and returns an array of the ObjectIDs of features that satisfy the input query. If query parameters are not provided, the ObjectIDs of all loaded features are returned.

To query for ObjectIDs of features directly from a Scene Service rather than those loaded for the current view, you must use the BuildingComponentSublayer.queryObjectIds() method.

For making attribute based queries on a BuildingSceneLayerView you need to specify the required fields in the outFields property of the BuildingComponentSublayer to ensure that attribute values are available on the client for querying. You can use availableFields to inspect which fields are available on the client.

Known Limitations

  • Spatial queries have the limitations listed in the projection engine documentation.
  • Spatial queries on BuildingSceneLayerView use the Extent of the feature and not the footprint when calculating the spatial relationship with the query geometry. This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry.
  • Currently only intersects, contains, and disjoint spatialRelationships are supported on spatial queries.
  • Spatial queries are not currently supported if the BuildingSceneLayerView has any of the following SpatialReferences:
    • GDM 2000 (4742) - Malaysia
    • Gsterberg (Ferro) (8042) - Austria/Czech Republic
    • ISN2016 (8086) - Iceland
    • SVY21 (4757) - Singapore
Parameters
query Query autocast
optional
Autocasts from Object

Specifies the attributes of the query. If query parameters are not provided, all loaded features are returned.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Number[]> When resolved, returns an array of numbers representing the ObjectIDs of the features satisfying the query.

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");

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