Skip To ContentArcGIS for DevelopersSign In Dashboard

BuildingComponentSublayerView

Class: esri/views/layers/BuildingComponentSublayerView
Inheritance: BuildingComponentSublayerView Accessor
Since: ArcGIS API 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 Working with Properties topic.
NameTypeSummaryClass
String[]

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.

more details
more detailsBuildingComponentSublayerView
String

The name of the class.

more details
more detailsAccessor
BuildingComponentSublayer

The sublayer being viewed.

more details
more detailsBuildingComponentSublayerView
Boolean

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

more details
more detailsBuildingComponentSublayerView
Boolean

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

more details
more detailsBuildingComponentSublayerView

Property Details

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.

See also:
declaredClass Stringreadonly inherited

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

sublayer BuildingComponentSublayerreadonly

The sublayer being viewed.

suspended Booleanreadonly

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

updating Booleanreadonly

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

Method Overview

NameReturn TypeSummaryClass
Query

Creates a query parameter object that can be used to fetch features as they are being displayed.

more details
more detailsBuildingComponentSublayerView
Handle

Highlights the given feature(s).

more details
more detailsBuildingComponentSublayerView
Promise<Object>

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

more details
more detailsBuildingComponentSublayerView
Promise<Number>

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

more details
more detailsBuildingComponentSublayerView
Promise<FeatureSet>

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

more details
more detailsBuildingComponentSublayerView
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.

more details
more detailsBuildingComponentSublayerView

Method Details

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:
TypeDescription
QueryThe query object
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:
TypeDescription
HandleReturns a highlight handler with a remove() method that can be called to remove the highlight.
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:
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:
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:
TypeDescription
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.
PropertyTypeDescription
countNumberThe number of features that satisfy the input query.
extentExtentThe extent of the features that satisfy the query.
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:
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:
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:
TypeDescription
Promise<Number>When resolved, returns the number of features satisfying the query.
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:
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:
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:
TypeDescription
Promise<FeatureSet>When resolved, a FeatureSet is returned. The set will be empty if zero results are found.
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:
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:
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:
TypeDescription
Promise<Number[]>When resolved, returns an array of numbers representing the ObjectIDs of the features satisfying the query.

API Reference search results

NameTypeModule
Loading...