arrow-left

All pages
gitbookPowered by GitBook
1 of 9

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

ElementGroupNode


References an element group.

hashtag
Properties

hashtag
type

type: "elementGroup"


hashtag
entity

entity: ElementGroup

FeatureNode


References a feature on the map.

hashtag
Properties

hashtag
type

type: "feature"


hashtag
entity

entity: LayerFeature

FeatureSelection


The options for selecting a feature in a layer.

hashtag
Properties

hashtag
id

id: string | number

The id of the feature to select.


hashtag
layerId

layerId: string

The id of the layer that the feature belongs to.


hashtag
showPopup?

optional showPopup: boolean

Whether to show the feature's popup, if it is configured in the layer's style.

hashtag
Default


hashtag
fitViewport?

optional fitViewport: boolean | { maxZoom: number; }

Whether to center the view on the feature after selecting it.

When true, the viewport will be centered on the feature and zoomed to fit the feature in the viewport. If you need to control the zoom level to prevent it zooming in too far, you can pass an object with a maxZoom property.

This is useful for avoiding zooming in too far on point features, or if you want to maintain the current zoom level.

hashtag
Default

LayerGroupNode


References a layer group on the map.

hashtag
Properties

hashtag
type

type: "layerGroup"


hashtag
entity

entity: LayerGroup

true
true

Selection


hashtag
Controller

  • SelectionController

hashtag
Interfaces

  • FeatureSelection

hashtag
Entity Node

  • EntityNode

hashtag
Entity Nodes

  • ElementNode

  • ElementGroupNode

  • LayerNode

  • LayerGroupNode

SelectionController


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

hashtag
Extended by

  • FeltController

hashtag
Methods

hashtag
getSelection()

getSelection(): Promise<EntityNode[]>

Gets the current selection as a list of entity identifiers.

Use this method to retrieve the current selection state, which can include features, elements, or both types of entities.

hashtag
Returns

Promise<EntityNode[]>

A promise that resolves to an array of selected entity nodes.

hashtag
Example

const selection = await felt.getSelection();

hashtag
selectFeature()

selectFeature(params: FeatureSelection): Promise<void>

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

Use this method to programmatically select features, which can be useful for highlighting specific data points or triggering feature-specific UI.

hashtag
Parameters

Parameter
Type

params

hashtag
Returns

Promise<void>

A promise that resolves when the feature is selected.

hashtag
Example

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

hashtag
clearSelection()

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

Clears the current selection (elements, features or both).

Use this method to programmatically clear the current selection, which can be useful for resetting the map state or preparing for new selections.

hashtag
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.

hashtag
Returns

Promise<void>

A promise that resolves when the selection is cleared.

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

hashtag
Default

{ features: true, elements: true }

hashtag
Events

hashtag
onSelectionChange()

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

Adds a listener for when the selection changes.

Use this to react to selection changes, such as updating your UI to reflect what is currently selected on the map.

hashtag
Parameters

Parameter
Type

params

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

params.handler

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

hashtag
Returns

VoidFunction

A function to unsubscribe from the listener.

hashtag
Example

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

// later on...
unsubscribe();
FeatureNode

params.elements?

boolean

Whether to clear the elements from the selection.

FeatureSelection
EntityNode
EntityNode

EntityNode


EntityNode: ElementNode | ElementGroupNode | LayerNode | LayerGroupNode | FeatureNode

A reference to any kind of entity in the map.

hashtag
Remarks

EntityNodes are used when you have some collection of entities and you need to

LayerNode


References a layer on the map.

hashtag
Properties

hashtag
type

type: "layer"


hashtag
entity

entity:

Layer

ElementNode


References an element on the map.

hashtag
Properties

hashtag
type

type: "element"


hashtag
entity

entity:

Element