import BuildingComponentSublayerView from "@arcgis/core/views/layers/BuildingComponentSublayerView.js";const BuildingComponentSublayerView = await $arcgis.import("@arcgis/core/views/layers/BuildingComponentSublayerView.js");- Inheritance:
- BuildingComponentSublayerView→
Accessor
- 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 BuildingSceneLayerView.sublayerViews property on BuildingSceneLayerView:
// query all sublayers for features that satisfy the sql expressionlet 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
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
availableFields readonly | string[] | |
declaredClass readonly inherited | ||
| | ||
sublayer readonly | | |
suspended readonly | | |
updating readonly | |
availableFields
- Type
- 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. The availableFields is populated when the layer view is finished updating. Use this list when querying features on the client-side.
filter
- Type
- FeatureFilter | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 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 FeatureFilter.timeExtent property is not supported on a SceneLayerView filter.
Only spatial filters with FeatureFilter.spatialRelationship
set to contains, intersects or disjoint are supported.
suspended
- Type
- boolean
Value is true if the sublayer is suspended (i.e., sublayer will not redraw or update
itself when the extent changes).
updating
- Type
- boolean
Value is true when the sublayer is updating; for example, if
it is in the process of fetching data.
Methods
| Method | Signature | Class |
|---|---|---|
createQuery(): Query | | |
highlight(target: HighlightTarget): ResourceHandle | | |
queryExtent(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<{
count: number;
extent: Extent | null;
}> | | |
queryFeatureCount(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number> | | |
queryFeatures(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<FeatureSet> | | |
queryObjectIds(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number[]> | |
createQuery
- Signature
-
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 Query.outFields
property to ["*"] and Query.returnGeometry to true.
The output spatial reference is set to the spatial reference of the view. The
BuildingComponentSublayer.definitionExpression that currently
applies to the sublayer view is also incorporated in the returned query object.
- Returns
- Query
The query object
highlight
- Signature
-
highlight (target: HighlightTarget): ResourceHandle
Highlights the given feature(s).
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| target | The feature(s) to highlight. When passing a graphic or array of graphics, each feature must
have a valid | |
- Returns
- ResourceHandle
Returns a highlight handler with a
remove()method that can be called to remove the highlight.
queryExtent
- Signature
-
queryExtent (query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<{ count: number; extent: Extent | null; }>
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 BuildingComponentSublayer.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 projectOperator
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| query | 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 | An object with the following properties. | |
- Returns
- Promise<{
count: number;
extent: Extent | null;
}>
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
- Signature
-
queryFeatureCount (query?: QueryProperties | null | undefined, options?: AbortOptions): 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 BuildingComponentSublayer.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 projectOperator
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| query | 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 | | |
| options | An object with the following properties. | |
queryFeatures
- Signature
-
queryFeatures (query?: QueryProperties | null | undefined, options?: AbortOptions): 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 BuildingComponentSublayer.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 projectOperator
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| query | 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 | | |
| options | An object with the following properties. | |
- Returns
- Promise<FeatureSet>
When resolved, a FeatureSet is returned. The set will be empty if zero results are found.
queryObjectIds
- Signature
-
queryObjectIds (query?: QueryProperties | null | undefined, options?: AbortOptions): 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 BuildingComponentSublayer.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 projectOperator
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| query | Specifies the attributes of the query. If query parameters are not provided, all loaded features are returned. | | |
| options | An object with the following properties. | |