Types
import type { SelectableParentLayerUnion, SelectableLayerSourceUnion, SelectionSource, SelectableViewUnion, SelectorGeometry } from "@arcgis/core/views/selection/types.js";
Since
ArcGIS Maps SDK for JavaScript 5.0

Types and interfaces for feature selection in layers and views.

Type definitions

SelectableParentLayerUnion

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types of parent layers that include potential sources from which selections may be determined. Sublayers are typically included in SelectableLayer or SelectionSource.

SelectableLayerSourceUnion

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Layer source types from which selections can be determined.

SelectionSource

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types of sources from which selections can be determined.

SelectableViewUnion

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types of views supported by a selection operation.

SelectorGeometry

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types of geometries that can be used to determine selections.

SelectionToolName

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types used to identify a specific selection tool by name.

Type
"lasso" | "rectangle" | "point" | string

SelectionIdentifier

Type definition

An identifier used to represent a selected feature in a layer. This can either be a Graphic (for layers with graphics) or an object ID (for layers with object IDs).

Type
Graphic | ObjectId

SelectionOperationType

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types of selection operations.

Type
"add" | "remove" | "replace"

LayerSelection

Type definition

A simple object representing the selected features in a layer.

layer

Property
Type
SelectableLayer

The layer associated with the selection.

selection

Property
Type
SelectionIdentifier[]

The selected features in the layer. The selection identifiers can either be Graphics or object IDs depending on the capabilities of the layer.

LayerSelectionChange

Type definition

An object storing the changes in selection for a given layer.

Supertypes
LayerSelection

added

Property
Type
SelectionIdentifier[] | undefined

The features that were added to the selection for the layer.

removed

Property
Type
SelectionIdentifier[] | undefined

The features that were removed from the selection for the layer.

LayerFeatureSet

Type definition

An object representing the selected features in a layer, including the layer and the feature set containing the selected features.

layer

Property
Type
SelectableLayerWithObjectIds

The layer for which the feature set is stored.

data

Property
Type
FeatureSet

The feature set containing the selected features.

SelectableLayerType

Type definition

The types of layers that can be selected.

Type
"csv" | "feature" | "geojson" | "parquet" | "graphics" | "knowledge-graph" | "knowledge-graph-sublayer" | "map-image" | "ogc-feature" | "stream" | "wfs" | "sublayer" | "subtype-sublayer" | "subtype-group"

SelectableLayerBase

Type definition

The underlying base type for selectable layers which contains common properties and methods for both layers with graphics and layers with object IDs.

Supertypes
default ‚  LoadableMixin

id

Property
Type
string

The unique identifier of the layer.

type

Property
Type
SelectableLayerType

The type of the layer.

displayField

Property
Type
string | null | undefined

Optional: The name of the field used to display features in the layer.

featureTitleFields

Property
Type
string[] | undefined

Optional: The fields used to create feature titles. It can be a single field name or an array of field names.

globalIdField

Property
Type
string | null | undefined

Optional: The name of the global ID field in the layer.

isTable

Property
Type
boolean | null | undefined

Optional: Indicates whether the layer is a table.

layerId

Property
Type
number | null | undefined

Optional: The numeric ID of the layer in a service.

renderer

Property
Type
RendererUnion | null | undefined

Optional: The renderer assigned to the layer.

subtypeField

Property
Type
string | null | undefined

Optional: The name of the subtype field in the layer.

title

Property
Type
string | null | undefined

Optional: The title of the layer.

visible

Property
Type
boolean | null | undefined

Optional: Indicates whether the layer is visible.

getFeatureTitle

Method
Signature
getFeatureTitle (graphic: Graphic, options?: FeatureTitleOptions): Promise<string>

Optional: Gets the title for a specific feature represented by a graphic.

Parameters

ParameterTypeDescriptionRequired
graphic

The graphic for which to get the title.

options

The options for getting the feature title.

Returns
Promise<string>

A promise that resolves to the feature title.

getFeatureTitles

Method
Signature
getFeatureTitles (graphics: Graphic[], options?: FeatureTitleOptions): Promise<Map<ObjectId, string>>

Gets the titles for multiple features represented by an array of graphics.

Parameters

ParameterTypeDescriptionRequired
graphics

An array of graphics for which to get the titles.

options

The options for getting the feature titles.

Returns
Promise<Map<ObjectId, string>>

A promise that resolves to a map of object IDs to feature titles.

SelectableLayerWithObjectIds

Type definition

This applies only to layer types that support object IDs.

Supertypes
SelectableLayerBase

fields

Property
Type
Field[]

An array of fields in the layer.

fieldsIndex

Property
Type
FieldsIndex<Field>

A fields index for a specific field in the layer. This helps to quickly look up field information by field name.

objectIdField

Property
Type
string

The name of the Object ID field in the layer.

createQuery

Method
Signature
createQuery (): Query

Creates a new query object for the layer.

Returns
Query

A new query object for the layer.

queryFeatures

Method
Signature
queryFeatures (query?: Query, requestOptions?: RequestOptions): Promise<FeatureSet>

Queries features from the layer based on the provided query parameters.

Parameters

ParameterTypeDescriptionRequired
query

The query parameters.

requestOptions

Additional options for the request.

Returns
Promise<FeatureSet>

A promise that resolves to the feature set containing the queried features.

SelectableLayer

Type definition

A selectable layer which can either be layers containing object IDs or layers with graphics.

SelectableLayerViewBase

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

The underlying base type for selectable layer views which contains common properties and methods for both layer views with graphics and layer views with object IDs.

Supertypes
default

layer

Property
Type
SelectableLayer
Since
ArcGIS Maps SDK for JavaScript 5.1

A reference to the layer associated with the layer view.

suspended

Property
Type
boolean | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.1

Indicates the layer view is currently suspended.

updating

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.1

Indicates the layer view is currently updating.

view

Property
Type
View
Since
ArcGIS Maps SDK for JavaScript 5.1

A reference to the view associated with the layer view.

SelectableLayerViewWithGraphics

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Layer view type narrowed to those that contain graphics.

layer

Property
Type
GraphicsLayer
Since
ArcGIS Maps SDK for JavaScript 5.1

A reference to the graphics layer associated with the layer view.

queryGraphics

Property
Type
() => Promise<Collection<Graphic>>
Since
ArcGIS Maps SDK for JavaScript 5.1

Queries for graphics from the layer view.

SelectableLayerViewWithObjectIds

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Layer view type narrowed to those that support Object IDs.

layer

Property
Type
SelectableLayerWithObjectIds
Since
ArcGIS Maps SDK for JavaScript 5.1

A reference to the layer associated with the layer view. The layer also supports object IDs.

createQuery

Method
Signature
createQuery (): Query
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a new query object for the layer view.

Returns
Query

A new query object for the layer view.

queryFeatures

Method
Signature
queryFeatures (query?: Query, requestOptions?: RequestOptions): Promise<FeatureSet>
Since
ArcGIS Maps SDK for JavaScript 5.1

Queries features from the layer view based on the provided query parameters.

Parameters

ParameterTypeDescriptionRequired
query

The query parameters.

requestOptions

Additional options for the request.

Returns
Promise<FeatureSet>

A promise that resolves to the feature set containing the queried features.

SelectableLayerView

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

A selectable layer view which can either be layer views containing object IDs or layer views with graphics.

SelectionOperationEvents

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Types of events emitted by a selection operation.

complete

Property
Type
SelectionCompleteEventInfo
Since
ArcGIS Maps SDK for JavaScript 5.1

Fires when a selection operation is completed or cancelled.

selection-change

Property
Type
SelectionChangeEventInfo
Since
ArcGIS Maps SDK for JavaScript 5.1

Fires when a selection change is determined by the selection operation.

SelectionCompleteEventInfo

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

aborted

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.1

Indicates the selection operation was cancelled.

operationType

Property
Type
SelectionOperationType
Since
ArcGIS Maps SDK for JavaScript 5.1

Indicates the current type of selection operation.

selection

Property
Type
Graphic[]
Since
ArcGIS Maps SDK for JavaScript 5.1

Reference to the current working selection set.

toolName

Property
Type
SelectionToolName
Since
ArcGIS Maps SDK for JavaScript 5.1

Indicates the selection tool used by the selection operation.

SelectionChangeEventInfo

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Information shared by selection operation events.

added

Property
Type
Graphic[]
Since
ArcGIS Maps SDK for JavaScript 5.1

Reference to graphics which were added to the current selection set.

removed

Property
Type
Graphic[]
Since
ArcGIS Maps SDK for JavaScript 5.1

Reference to graphics which were removed from the current selection set.

operationType

Property
Type
SelectionOperationType
Since
ArcGIS Maps SDK for JavaScript 5.1

Indicates the current type of selection operation.

SelectionOperationCreateTool

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

Reference to the type of sketch creation tool used by the selection operation.

Supertypes
Extract<CreateTool‚ "point" | "polygon" | "circle" | "rectangle">