LogoLogo
Sign upHelp CenterContactSocial
JS SDK API Reference
JS SDK API Reference
  • API Reference
  • @feltmaps/js-sdk
  • Elements
    • CircleElementCreate
    • CircleElementRead
    • CircleElementUpdate
    • Element
    • ElementChangeCallbackParams
    • ElementCreate
    • ElementGroup
    • ElementGroupChangeCallbackParams
    • ElementUpdate
    • ElementsController
    • GetElementGroupsConstraint
    • GetElementsConstraint
    • HighlighterElementCreate
    • HighlighterElementRead
    • HighlighterElementUpdate
    • ImageElementCreate
    • ImageElementRead
    • ImageElementUpdate
    • LinkElementRead
    • MarkerElementCreate
    • MarkerElementRead
    • MarkerElementUpdate
    • NoteElementCreate
    • NoteElementRead
    • NoteElementUpdate
    • PathElementCreate
    • PathElementRead
    • PathElementUpdate
    • PlaceElementCreate
    • PlaceElementRead
    • PlaceElementUpdate
    • PolygonElementCreate
    • PolygonElementRead
    • PolygonElementUpdate
    • TextElementCreate
    • TextElementRead
    • TextElementUpdate
  • Interactions
    • InteractionsController
    • MapInteractionEvent
  • Layers
    • AggregationConfig
    • AggregationMethod
    • CreateLayersFromGeoJsonParams
    • DataOnlyLayer
    • FeltTiledVectorSource
    • FilterExpression
    • FilterLogicGate
    • FilterTernary
    • Filters
    • GeoJsonDataVectorSource
    • GeoJsonFileVectorSource
    • GeoJsonUrlVectorSource
    • GeometryFilter
    • GetLayerCalculationParams
    • GetLayerCategoriesGroup
    • GetLayerCategoriesParams
    • GetLayerGroupsConstraint
    • GetLayerHistogramBin
    • GetLayerHistogramParams
    • GetLayersConstraint
    • GetRenderedFeaturesConstraint
    • Layer
    • LayerBoundaries
    • LayerChangeCallbackParams
    • LayerCommon
    • LayerFeature
    • LayerFilters
    • LayerGroup
    • LayerGroupChangeCallbackParams
    • LayerProcessingStatus
    • LayerSchema
    • LayerSchemaAttribute
    • LayerSchemaBooleanAttribute
    • LayerSchemaCommonAttribute
    • LayerSchemaDateAttribute
    • LayerSchemaDateTimeAttribute
    • LayerSchemaNumericAttribute
    • LayerSchemaTextAttribute
    • LayersController
    • LegendItem
    • LegendItemChangeCallbackParams
    • LegendItemIdentifier
    • LegendItemsConstraint
    • MultiAggregationConfig
    • RasterBand
    • RasterLayer
    • RasterLayerSource
    • RasterValue
    • UpdateLayerParams
    • ValueConfiguration
    • VectorLayer
  • Main
    • Felt
    • FeltController
    • FeltEmbedOptions
  • Misc
    • MapDetails
    • MiscController
  • Selection
    • ElementGroupNode
    • ElementNode
    • EntityNode
    • FeatureNode
    • FeatureSelection
    • LayerGroupNode
    • LayerNode
    • SelectionController
  • Shared
    • FeltBoundary
    • FeltZoom
    • GeoJsonFeature
    • GeoJsonGeometry
    • GeoJsonProperties
    • LatLng
    • LineStringGeometry
    • LngLatTuple
    • MultiLineStringGeometry
    • MultiPointGeometry
    • MultiPolygonGeometry
    • PointGeometry
    • PolygonGeometry
    • SetVisibilityRequest
    • SortConfig
    • SortDirection
  • Tools
    • CircleToolSettings
    • ConfigurableToolType
    • HighlighterToolSettings
    • InputToolSettings
    • LineToolSettings
    • MarkerToolSettings
    • NoteToolSettings
    • PinToolSettings
    • PlaceFrame
    • PlaceSymbol
    • PolygonToolSettings
    • RouteToolSettings
    • TextToolSettings
    • ToolSettingsChangeEvent
    • ToolSettingsMap
    • ToolType
    • ToolsController
  • UI
    • OnMapInteractionsOptions
    • UiController
    • UiControlsOptions
  • Viewport
    • SetViewportCenterZoomParams
    • ViewportCenterZoom
    • ViewportConstraints
    • ViewportController
    • ViewportFitBoundsParams
    • ViewportState
Powered by GitBook
On this page
  • Extended by
  • Methods
  • getSelection()
  • selectFeature()
  • clearSelection()
  • Events
  • onSelectionChange()

Was this helpful?

Export as PDF
  1. Selection

SelectionController

PreviousLayerNodeNextShared

Last updated 27 days ago

Was this helpful?


The Selection controller allows you to listen for changes to the selection on the map.

Extended by

Methods

getSelection()

getSelection(): Promise<[]>

Gets the current selection as a list of entity identifiers.

Returns

Promise<[]>

Example

const selection = await felt.getSelection();

selectFeature()

Selects a feature on a layer. This will show the feature's popup, modal or sidebar (if configured) and highlight the feature.

Parameters

Parameter
Type

params

Returns

Promise<void>

Example

felt.selectFeature({
  id: 123,
  layerId: "my-layer",
  showPopup: true,
  fitViewport: { maxZoom: 15 },
});

clearSelection()

clearSelection(params?: { features: boolean; elements: boolean; }): Promise<void>

Clears the current selection. This clears the selection of

Parameters

Parameter
Type
Description

params?

{ features: boolean; elements: boolean; }

The parameters to clear the selection. If this is not provided, both features and elements will be cleared.

params.features?

boolean

Whether to clear the features from the selection.

params.elements?

boolean

Whether to clear the elements from the selection.

Returns

Promise<void>

Example


// Removes all features and elements from the selection
felt.clearSelection();

// Removes only features from the selection
felt.clearSelection({ features: true });

// Removes only elements from the selection
felt.clearSelection({ elements: true });

Default

{ features: true, elements: true }

Events

onSelectionChange()

Adds a listener for when the selection changes.

Parameters

Parameter
Type

params

params.handler

Returns

VoidFunction

A function to unsubscribe from the listener

Example

const unsubscribe = felt.onSelectionChange({
  handler: ({selection}) => console.log(selection),
});

// later on...
unsubscribe();

selectFeature(params: ): Promise<void>

onSelectionChange(params: { handler: (change: { selection: []; }) => void; }): VoidFunction

{ handler: (change: { selection: []; }) => void; }

(change: { selection: []; }) => void

FeltController
EntityNode
EntityNode
FeatureSelection
EntityNode
FeatureSelection
EntityNode
EntityNode