arrow-left

All pages
gitbookPowered by GitBook
1 of 9

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

ElementNode


References an element on the map.

hashtag
Properties

hashtag
type

type: "element"


hashtag
entity

entity:

ElementGroupNode


References an element group.

hashtag
Properties

hashtag

Selection


hashtag
Controller

type

type: "elementGroup"


hashtag
entity

entity: ElementGroup

Element
hashtag
Interfaces
  • FeatureSelection

hashtag
Entity Node

  • EntityNode

hashtag
Entity Nodes

  • ElementNode

  • ElementGroupNode

  • LayerNode

SelectionController

LayerGroupNode


References a layer group on the map.

hashtag
Properties

hashtag
type

type: "layerGroup"


hashtag
entity

entity:

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

FeatureNode


References a feature on the map.

hashtag
Properties

hashtag

type

type: "feature"


hashtag
entity

entity: LayerFeature

LayerGroupNode
FeatureNode
LayerGroup
true
true

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

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<[]>

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<[]>

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

hashtag
Example


hashtag
selectFeature()

selectFeature(params: ): 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

hashtag
Returns

Promise<void>

A promise that resolves when the feature is selected.

hashtag
Example


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

hashtag
Returns

Promise<void>

A promise that resolves when the selection is cleared.

hashtag
Example

hashtag
Default

hashtag
Events

hashtag
onSelectionChange()

onSelectionChange(params: { handler: (change: { selection: []; }) => 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

hashtag
Returns

VoidFunction

A function to unsubscribe from the listener.

hashtag
Example

boolean

Whether to clear the elements from the selection.

params

FeatureSelection

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

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

params.handler

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

EntityNode
EntityNode
FeatureSelection
EntityNode

params.elements?

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

// 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 });
{ features: true, elements: true }
const unsubscribe = felt.onSelectionChange({
  handler: ({selection}) => console.log(selection),
});

// later on...
unsubscribe();

LayerNode


References a layer on the map.

hashtag
Properties

hashtag
type

type: "layer"


hashtag
entity

entity:

Layer