FeltController


This is the main interface for interacting with a Felt map.

This interface is composed of the various controllers, each having a different area of responsibility.

All the methods are listed here, but each controller is documented on its own to make it easier to find related methods and events.

Extends

Methods

getCurrentBasemap()

getCurrentBasemap(): Promise<Basemap>

Gets the currently active basemap.

Use this method to retrieve information about the current basemap, including its type (Felt, color, or custom tile), name, color scheme, and attribution.

Returns

Promise<Basemap>

A promise that resolves to the current basemap configuration.

Example


getBasemaps()

getBasemaps(): Promise<Basemap[]>

Gets all basemaps available on the map.

Use this method to retrieve a list of all available basemaps that can be applied to the map.

Returns

Promise<Basemap[]>

A promise that resolves to all basemaps available on the map.

Example


chooseBasemap()

chooseBasemap(id: string): void

Chooses the basemap to use for the map.

Use this method to change the current basemap. The basemap ID can be obtained from getBasemaps().

Parameters

Parameter
Type

id

string

Returns

void

A promise that resolves when the basemap has been set.

Example


addCustomBasemap()

addCustomBasemap(args: { basemap: ColorBasemapInput | CustomTileBasemapInput; select: boolean; }): Promise<Basemap>

Adds a custom basemap to the map. This can be either a solid color or a basemap from a custom tile URL.

Parameters

Parameter
Type
Description

args

{ basemap: ColorBasemapInput | CustomTileBasemapInput; select: boolean; }

-

args.basemap

The basemap to add.

args.select?

boolean

Whether to select the basemap after adding it.

Returns

Promise<Basemap>

A promise for the added basemap.

Example


removeBasemap()

removeBasemap(id: string): Promise<void>

Removes a basemap from the list of available basemaps.

Parameters

Parameter
Type

id

string

Returns

Promise<void>

A promise that resolves when the basemap has been removed.


getElement()

getElement(id: string): Promise<null | Element>

Get a single element from the map by its id.

Use this method when you know the specific ID of an element and want to retrieve its current state. This is more efficient than getting all elements and filtering.

Parameters

Parameter
Type
Description

id

string

The id of the element you want to get.

Returns

Promise<null | Element>

A promise that resolves to the requested element, or null if not found.

Example


getElementGeometry()

getElementGeometry(id: string): Promise<null | GeoJsonGeometry>

Get the geometry of an element in GeoJSON geometry format.

For most element types, the geometry returned is based on the coordinates property of the element, with some differences:

  • For Circle elements, the geometry is a Polygon drawn from the center and radius properties.

  • Path elements become MultiLineString geometries.

  • Marker elements return a MultiLineString of the path traced by the user as they drew the marker. Note that this is not the polygon formed by filled-in "pen" stroke, which doesn't exactly follow the path traced by the user as it is smoothed and interpolated to create a continuous line.

  • Text, Note and Image elements do not return geometry, so will return null.

Use this method when you need the geometric representation of an element for spatial analysis or visualization purposes.

Parameters

Parameter
Type
Description

id

string

The id of the element you want to get the geometry of.

Returns

Promise<null | GeoJsonGeometry>

A promise that resolves to the element's geometry in GeoJSON format, or null if the element has no geometry.

Example


getElements()

getElements(constraint?: GetElementsConstraint): Promise<(null | Element)[]>

Gets elements from the map, according to the constraints supplied. If no constraints are supplied, all elements will be returned.

Use this method to retrieve multiple elements, optionally filtered by constraints. This is useful for bulk operations or when you need to analyze all elements on the map.

Parameters

Parameter
Type
Description

constraint?

Optional constraints to apply to the elements returned from the map.

Returns

Promise<(null | Element)[]>

A promise that resolves to an array of elements, ordered by the order specified in Felt.

Remarks

The elements in the map, ordered by the order specified in Felt. This is not necessarily the order that they are drawn in, as Felt draws points above lines and lines above polygons, for instance.

Example


getElementGroup()

getElementGroup(id: string): Promise<null | ElementGroup>

Get an element group from the map by its id.

Element groups allow you to organize related elements together and control their visibility as a unit.

Parameters

Parameter
Type
Description

id

string

The id of the element group you want to get.

Returns

Promise<null | ElementGroup>

A promise that resolves to the requested element group, or null if not found.

Example


getElementGroups()

getElementGroups(constraint?: GetElementGroupsConstraint): Promise<(null | ElementGroup)[]>

Gets element groups from the map, according to the filters supplied. If no constraints are supplied, all element groups will be returned in rendering order.

Use this method to retrieve multiple element groups, optionally filtered by constraints. This is useful for bulk operations on element groups.

Parameters

Parameter
Type
Description

constraint?

Optional constraints to apply to the element groups returned from the map.

Returns

Promise<(null | ElementGroup)[]>

A promise that resolves to an array of element groups in rendering order.

Example


setElementGroupVisibility()

setElementGroupVisibility(visibility: SetVisibilityRequest): Promise<void>

Hide or show element groups with the given ids.

Use this method to control the visibility of multiple element groups at once. This is more efficient than hiding/showing individual elements.

Parameters

Parameter
Type
Description

visibility

The visibility configuration for element groups.

Returns

Promise<void>

A promise that resolves when the visibility changes are applied.

Example


createElement()

createElement(element: ElementCreate): Promise<Element>

Create a new element on the map.

Use this method to programmatically create elements on the map. Elements created via the SDK are only available to the current session and are not persisted.

Parameters

Parameter
Type
Description

element

The element configuration to create.

Returns

Promise<Element>

A promise that resolves to the created element.

Example


updateElement()

updateElement(element: ElementUpdate): Promise<Element>

Update an element on the map. The element type must be specified.

Use this method to modify existing elements. You can update properties like coordinates, styling, and metadata.

Parameters

Parameter
Type
Description

element

The element update configuration.

Returns

Promise<Element>

A promise that resolves to the updated element.

Example


deleteElement()

deleteElement(id: string): Promise<void>

Delete an element from the map.

Use this method to remove elements from the map. This operation cannot be undone.

Parameters

Parameter
Type
Description

id

string

The id of the element to delete.

Returns

Promise<void>

A promise that resolves when the element is deleted.

Example


getLayer()

getLayer(id: string): Promise<null | Layer>

Get a single layer from the map by its id.

Parameters

Parameter
Type
Description

id

string

The id of the layer you want to get.

Returns

Promise<null | Layer>

The requested layer.

Example


getLayers()

getLayers(constraint?: GetLayersConstraint): Promise<(null | Layer)[]>

Gets layers from the map, according to the constraints supplied. If no constraints are supplied, all layers will be returned.

Parameters

Parameter
Type
Description

constraint?

The constraints to apply to the layers returned from the map.

Returns

Promise<(null | Layer)[]>

All layers on the map.

Remarks

The layers in the map, ordered by the order specified in Felt. This is not necessarily the order that they are drawn in, as Felt draws points above lines and lines above polygons, for instance.

Example


setLayerVisibility()

setLayerVisibility(visibility: SetVisibilityRequest): Promise<void>

Hide or show layers with the given ids.

Parameters

Parameter
Type

Returns

Promise<void>

Example


setLayerStyle()

setLayerStyle(params: { id: string; style: object; }): Promise<void>

Set the style for a layer using FSL, the Felt Style Language.

Changes are only for this session, and not persisted. This is useful to make temporary changes to a layer's style, such as to highlight a particular layer or feature.

See the FSL documentation for details on how to read and write styles.

If the style you set is invalid, you will receive an error explaining the problem in the rejected promise value.

Parameters

Parameter
Type
Description

params

{ id: string; style: object; }

-

params.id

string

The id of the layer to set the style for.

params.style

object

The style to set for the layer.

Returns

Promise<void>

Example


setLayerLegendVisibility()

setLayerLegendVisibility(params: SetVisibilityRequest): Promise<void>

Hide or show layers with the given ids from the legend.

Parameters

Parameter
Type

Returns

Promise<void>

Example


createLayersFromGeoJson()

createLayersFromGeoJson(params: CreateLayersFromGeoJsonParams): Promise<null | { layerGroup: LayerGroup; layers: Layer[]; }>

Adds layers to the map from file or URL sources.

Parameters

Returns

Promise<null | { layerGroup: LayerGroup; layers: Layer[]; }>

The layer groups that were created.

Remarks

This allows you to add temporary layers to the map that don't depend on any processing by Felt. This is useful for viewing data from external sources or remote files.

Example


updateLayer()

updateLayer(params: UpdateLayerParams): Promise<Layer>

Update a layer by passing a subset of the layer's properties.

Note that not all properties can be updated, so check the UpdateLayerParams type to see which properties can be updated.

Parameters

Parameter
Type

Returns

Promise<Layer>

Example


deleteLayer()

deleteLayer(id: string): Promise<void>

Delete a layer from the map by its id.

Parameters

Parameter
Type

id

string

Returns

Promise<void>

Remarks

This only works for layers created via the SDK createLayersFromGeoJson method, not layers added via the Felt UI.

Example


duplicateLayer()

duplicateLayer(id: string): Promise<Layer>

Duplicate a layer from the map by its id.

Parameters

Parameter
Type

id

string

Returns

Promise<Layer>

The duplicated layer.

Remarks

This will create an ephemeral copy of the layer, just for the duration of the session. The duplicated layer will not be persisted to the map.

Example


getLayerGroup()

getLayerGroup(id: string): Promise<null | LayerGroup>

Get a layer group from the map by its id.

Parameters

Parameter
Type

id

string

Returns

Promise<null | LayerGroup>

The requested layer group.

Example


getLayerGroups()

getLayerGroups(constraint?: GetLayerGroupsConstraint): Promise<(null | LayerGroup)[]>

Gets layer groups from the map, according to the constraints supplied. If no constraints are supplied, all layer groups will be returned in rendering order.

Parameters

Parameter
Type
Description

constraint?

The constraints to apply to the layer groups returned from the map.

Returns

Promise<(null | LayerGroup)[]>

The requested layer groups.

Example


setLayerGroupVisibility()

setLayerGroupVisibility(visibility: SetVisibilityRequest): Promise<void>

Hide or show layer groups with the given ids.

Parameters

Parameter
Type

Returns

Promise<void>

Example


setLayerGroupLegendVisibility()

setLayerGroupLegendVisibility(params: SetVisibilityRequest): Promise<void>

Hide or show layer groups with the given ids from the legend.

Parameters

Parameter
Type

Returns

Promise<void>

Example


getLegendItem()

getLegendItem(id: LegendItemIdentifier): Promise<null | LegendItem>

Allows you to get the state of a single legend item.

Parameters

Parameter
Type

Returns

Promise<null | LegendItem>

Example


getLegendItems()

getLegendItems(constraint?: LegendItemsConstraint): Promise<(null | LegendItem)[]>

Allows you to obtain the state of several legend items, by passing in constraints describing which legend items you want.

If you do not pass any constraints, you will receive all legend items.

Parameters

Parameter
Type

Returns

Promise<(null | LegendItem)[]>

Example


setLegendItemVisibility()

setLegendItemVisibility(visibility: { show: LegendItemIdentifier[]; hide: LegendItemIdentifier[]; }): Promise<void>

Hide or show legend items with the given identifiers.

Parameters

Parameter
Type

visibility

visibility.show?

visibility.hide?

Returns

Promise<void>

Example


getLayerFilters()

getLayerFilters(layerId: string): Promise<null | LayerFilters>

Get the filters for a layer.

Parameters

Parameter
Type

layerId

string

Returns

Promise<null | LayerFilters>

Remarks

The return type gives you the filters split up into the various sources that make up the overall filters for a layer.

Example


setLayerFilters()

setLayerFilters(params: { layerId: string; filters: Filters; note: string; }): Promise<void>

Sets the ephemeral filters for a layer.

Parameters

Parameter
Type
Description

params

{ layerId: string; filters: Filters; note: string; }

-

params.layerId

string

The layer that you want to set the filters for.

params.filters

The filters to set for the layer. This will replace any ephemeral filters that are currently set for the layer.

params.note?

string

A note to display on the layer legend when this filter is applied. When the note is shown, a reset button will also be shown, allowing the user to clear the filter.

Returns

Promise<void>

Example


getLayerBoundaries()

getLayerBoundaries(layerId: string): Promise<null | LayerBoundaries>

Get the spatial boundaries that are filtering a layer.

Parameters

Parameter
Type

layerId

string

Returns

Promise<null | LayerBoundaries>

Remarks

The return type gives you the boundaries split up into the various sources that make up the overall boundary for a layer.

The combined boundary is the intersection of the other sources of boundaries.

Example


setLayerBoundary()

setLayerBoundary(params: { layerIds: string[]; boundary: null | GeometryFilter; }): Promise<void>

Set the `ephemeral` boundary for one or more layers.

Parameters

Parameter
Type
Description

params

{ layerIds: string[]; boundary: null | GeometryFilter; }

-

params.layerIds

string[]

The ids of the layers to set the boundary for.

params.boundary

The boundary to set for the layer. Passing null clears the ephemeral boundary for the layer.

Returns

Promise<void>

Example


getRenderedFeatures()

getRenderedFeatures(params?: GetRenderedFeaturesConstraint): Promise<LayerFeature[]>

Get the features that are currently rendered on the map in the viewport.

Note that this is explicitly about the features that are rendered, which isn't necessarily a complete list of all the features in the viewport. This is because of the way features are tiled: at low zoom levels or high feature densities, many features are omitted from what is rendered on the screen.

Parameters

Parameter
Type
Description

params?

The constraints to apply to the features returned from the map.

Returns

Promise<LayerFeature[]>

Example


getFeature()

getFeature(params: { id: string | number; layerId: string; }): Promise<null | LayerFeature>

Get a feature from the map by its ID and layer ID.

The response is a LayerFeature object, which does not include the geometry of the feature.

You may want to use this when you don't need the geometry of a feature, but you know the ID of the feature you need.

Parameters

Parameter
Type

params

{ id: string | number; layerId: string; }

params.id

string | number

params.layerId

string

Returns

Promise<null | LayerFeature>

Example


getFeatures()

getFeatures(params: { layerId: string; filters: Filters; sorting: SortConfig; boundary: GeometryFilter; search: string; pagination: null | string; pageSize: number; select: string[]; }): Promise<{ features: LayerFeature[]; count: number; previousPage: null | string; nextPage: null | string; }>

Get a list of layer features.

Parameters

Parameter
Type
Description

params

{ layerId: string; filters: Filters; sorting: SortConfig; boundary: GeometryFilter; search: string; pagination: null | string; pageSize: number; select: string[]; }

-

params.layerId

string

The ID of the layer to get features from.

params.filters?

Filters to be applied. These filters will merge with layer's own filters.

params.sorting?

Attribute to sort by.

params.boundary?

The spatial boundary to be applied.

params.search?

string

Search term to search by. Search is case-insensitive and looks for matches across all feature properties.

params.pagination?

null | string

Pagination token. It comes from either the previousPage or nextPage properties of the previous response.

params.pageSize?

number

The number of features to return per page. Defaults to 20. Note: The larger the page size, the longer this is likely to take to respond.

params.select?

string[]

The attributes to select from the features. If not provided, all attributes will be returned. If you set this to an empty array, no attributes will be returned.

Returns

Promise<{ features: LayerFeature[]; count: number; previousPage: null | string; nextPage: null | string; }>

The response is an object which contains:

  • features: list of LayerFeature objects, which does not include the geometry of the feature but it does include its bounding box.

  • count: the total number of features that match the query.

  • previousPage & nextPage: The tokens to pass in the pagination param to navigate between pages.

Remarks

This list is paginated in sets of 20 features for each page. In order to paginate between pages, the response includes previousPage and nextPage that are tokens that should be sent in the pagination params for requesting sibling pages.

Text search is case-insensitive and looks for matches across all feature properties.

Example


getGeoJsonFeature()

getGeoJsonFeature(params: { id: string | number; layerId: string; }): Promise<null | GeoJsonFeature>

Get a feature in GeoJSON format from the map by its ID and layer ID.

The response is a GeoJSON Feature object with the complete geometry of the feature. Note that for some very large geometries, the response may take a long time to return, and may return a very large object.

Parameters

Parameter
Type

params

{ id: string | number; layerId: string; }

params.id

string | number

params.layerId

string

Returns

Promise<null | GeoJsonFeature>

Example


getCategoryData()

getCategoryData(params: GetLayerCategoriesParams): Promise<GetLayerCategoriesGroup[]>

Gets values from a layer grouped by a given attribute.

Parameters

Parameter
Type

Returns

Promise<GetLayerCategoriesGroup[]>

Remarks

Groups features in your layer by unique values in the specified attribute and calculates a value for each group. By default, this value is the count of features in each group.

You can apply filters in two ways:

  1. At the top level (using boundary and filters), which affects both what categories are included and how values are calculated

  2. In the values configuration, which only affects the values but keeps all categories

This two-level filtering is particularly useful when you want to compare subsets of data while maintaining consistent categories. For example, you might want to show the distribution of all building types in a city, but only count buildings built after 2000 in each category.

Example


getHistogramData()

getHistogramData(params: GetLayerHistogramParams): Promise<GetLayerHistogramBin[]>

Gets a histogram of values from a layer for a given attribute.

Parameters

Parameter
Type

Returns

Promise<GetLayerHistogramBin[]>

Remarks

Creates bins (ranges) for numeric data and counts how many features fall into each bin, or returns aggregated values for each bin.

You can control how the bins are created using the steps parameter, choosing from several methods like equal intervals, quantiles, or natural breaks (Jenks), or passing in the step values directly if you know how you want to bin the data.

Like getCategoryData, you can apply filters in two ways:

  1. At the top level (using boundary and filters), which affects both how the bins are calculated and what features are counted in each bin

  2. In the values configuration, which only affects what gets counted but keeps the bin ranges the same

This is particularly useful when you want to compare distributions while keeping consistent bin ranges. For example, you might want to compare the distribution of building heights in different years while using the same height ranges.

Example


getAggregates()

getAggregates<T>(params: GetLayerCalculationParams<T>): Promise<Record<T, null | number>>

Calculates a single aggregate value for a layer based on the provided configuration.

Type Parameters

Type Parameter

T extends "min" | "max" | "avg" | "sum" | "median" | "count"

Parameters

Parameter
Type

Returns

Promise<Record<T, null | number>>

Remarks

Performs statistical calculations on your data, like counting features or computing averages, sums, etc. You can focus your calculation on specific areas or subsets of your data using boundaries and filters.

When you request an aggregation other than count, you must specify an attribute to aggregate on.

Example


getPrecomputedAggregates()

getPrecomputedAggregates(params: GetLayerPrecomputedCalculationParams): Promise<{ avg: null | number; max: null | number; min: null | number; sum: null | number; count: null | number; }>

Calculates aggregates for spatial cells of a layer.

Parameters

Returns

Promise<{ avg: null | number; max: null | number; min: null | number; sum: null | number; count: null | number; }>

Remarks

Performs statistical calculations on spatial cells of a layer, returning min, max, avg, sum, and count. You can focus your calculation on specific areas or subsets of your data using boundaries and filters. When using the count method, an attribute is not required.

Example


getLayerSchema()

getLayerSchema(layerId: string): Promise<LayerSchema>

Get the schema for a layer.

Parameters

Parameter
Type

layerId

string

Returns

Promise<LayerSchema>

Remarks

The schema describes the structure of the data in a layer, including the attributes that are available on the features in the layer.

This can be useful to build generic UIs that need to know the structure of the data in a layer, such as a dropdown to choose an attribute.

Example


getMapDetails()

getMapDetails(): Promise<MapDetails>

Gets the details of the map.

Use this method to retrieve metadata about the current map, such as its title, description, and other map-level information.

Returns

Promise<MapDetails>

A promise that resolves to the map details.

Example


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.

Returns

Promise<EntityNode[]>

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

Example


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.

Parameters

Parameter
Type

Returns

Promise<void>

A promise that resolves when the feature is selected.

Example


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.

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>

A promise that resolves when the selection is cleared.

Example

Default


setTool()

setTool(tool: null | ToolType): void

Sets the tool to use for drawing elements on the map.

Use this method to programmatically activate drawing tools for users. When a tool is set, users can draw elements on the map using that tool. Set to null to deactivate all drawing tools.

Parameters

Parameter
Type
Description

tool

null | ToolType

The tool to set, or null to deactivate all tools.

Returns

void

Example


getTool()

getTool(): Promise<null | ToolType>

Gets the current tool, if any is in use.

Use this method to check which drawing tool is currently active, if any.

Returns

Promise<null | ToolType>

A promise that resolves to the current tool, or null if no tool is in use.

Example


onToolChange()

onToolChange(args: { handler: (tool: null | ToolType) => void; }): VoidFunction

Listens for changes to the current tool.

Use this to react to tool changes, such as updating your UI to reflect the currently active drawing tool.

Parameters

Parameter
Type
Description

args

{ handler: (tool: null | ToolType) => void; }

-

args.handler

(tool: null | ToolType) => void

This callback is called with the current tool whenever the tool changes.

Returns

VoidFunction

Example


setToolSettings()

setToolSettings(settings: InputToolSettings): void

Sets the settings for the current tool.

Use this method to configure how drawing tools behave, such as setting colors, stroke widths, or other tool-specific properties.

Parameters

Parameter
Type
Description

settings

The settings to set for the specified tool.

Returns

void

Example


getToolSettings()

getToolSettings<T>(tool: T): Promise<ToolSettingsMap[T]>

Gets the settings for the chosen tool.

Use this method to retrieve the current configuration of a drawing tool.

Type Parameters

Type Parameter

Parameters

Parameter
Type
Description

tool

T

The tool to get settings for.

Returns

Promise<ToolSettingsMap[T]>

A promise that resolves to the settings for the chosen tool.

Example


onToolSettingsChange()

onToolSettingsChange(args: { handler: (settings: ToolSettingsChangeEvent) => void; }): VoidFunction

Listens for changes to the settings on all tools.

Use this to react to tool setting changes, such as updating your UI to reflect the current tool configuration.

Parameters

Parameter
Type

args

{ handler: (settings: ToolSettingsChangeEvent) => void; }

args.handler

(settings: ToolSettingsChangeEvent) => void

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


createActionTrigger()

createActionTrigger(args: CreateActionTriggerParams): Promise<UIActionTriggerCreate>

Creates an action trigger. Action triggers are rendered on map's left sidebar as a button, similar to other map extensions like measure and spatial filter.

The goal of action triggers is to allow users to perform actions on the map by clicking on a button.

Parameters

Parameter
Type
Description

args

The arguments for the method.

Returns

Promise<UIActionTriggerCreate>

Example


updateActionTrigger()

updateActionTrigger(args: UpdateActionTriggerParams): Promise<UIActionTriggerCreate>

Updates an action trigger.

Action trigger to update is identified by the id property.

Parameters

Parameter
Type
Description

args

The action trigger to update.

Returns

Promise<UIActionTriggerCreate>

Remarks

Properties provided will override the existing properties.

Example


deleteActionTrigger()

deleteActionTrigger(id: string): void

Deletes an action trigger.

Parameters

Parameter
Type
Description

id

string

The id of the action trigger to delete.

Returns

void

Example


createFeatureAction()

createFeatureAction(args: CreateFeatureActionParams): Promise<UIFeatureAction>

Creates a feature contextual action.

Parameters

Parameter
Type
Description

args

The arguments for the method.

Returns

Promise<UIFeatureAction>

Example


updateFeatureAction()

updateFeatureAction(args: UpdateFeatureActionParams): Promise<UIFeatureAction>

Updates a feature contextual action.

Feature contextual action to update is identified by the id property.

Parameters

Parameter
Type
Description

args

The feature contextual action to update.

Returns

Promise<UIFeatureAction>

Remarks

Properties provided will override the existing properties.

Example


deleteFeatureAction()

deleteFeatureAction(id: string): void

Deletes a feature contextual action.

Parameters

Parameter
Type
Description

id

string

The id of the feature contextual action to delete.

Returns

void

Example


createPanelId()

createPanelId(): Promise<string>

Creates a panel ID.

In order to create a panel using createOrUpdatePanel, you need to create a panel ID first. Panel IDs are automatically generated to prevent conflicts with other panels.

Returns

Promise<string>

Example


createOrUpdatePanel()

createOrUpdatePanel(args: CreateOrUpdatePanelParams): Promise<UIPanel>

Creates or updates a panel.

Panels are rendered on the map's right sidebar and allow you to extend Felt UI for your own use cases using Felt UI elements (e.g., Text, Button, etc.).

A panel is identified by its ID, which must be created using createPanelId. Custom IDs are not supported to prevent conflicts with other panels.

Panels have two main sections:

  • body - The main content area of the panel, which is scrollable.

  • footer - A section that sticks to the bottom of the panel, useful for action buttons like "Submit" or "Cancel".

Panel placement is controlled by the initialPlacement parameter. By default, panels are added to the end of the panel stack, but you can specify a different placement. Note that this placement cannot be changed after the panel is created.

Element IDs are required for targeted updates and deletions using the other panel management methods. For complete panel refreshes with this method, element IDs are optional but recommended for consistency.

For dynamic content management, consider these approaches:

Parameters

Parameter
Type
Description

args

The arguments for creating or updating the panel.

Returns

Promise<UIPanel>

Example


deletePanel()

deletePanel(id: string): void

Deletes a panel.

Parameters

Parameter
Type
Description

id

string

The id of the panel to delete.

Returns

void

Example


createPanelElements()

createPanelElements(args: CreatePanelElementsParams): Promise<UIPanel>

Creates elements in a panel.

Use this method to add new elements to an existing panel without replacing the entire panel content. This is useful for dynamic UI updates.

Parameters

Parameter
Type
Description

args

The arguments for the method.

Returns

Promise<UIPanel>

Example


updatePanelElements()

updatePanelElements(args: UpdatePanelElementsParams): Promise<UIPanel>

Updates an existing element in a panel. This method can only update elements that already exist in the panel and have an ID.

Use this method to modify specific elements without replacing the entire panel. This is more efficient than using createOrUpdatePanel for small changes.

Parameters

Parameter
Type
Description

args

The arguments for the method.

Returns

Promise<UIPanel>

Example


deletePanelElements()

deletePanelElements(args: DeletePanelElementsParams): void

Deletes elements from a panel.

Use this method to remove specific elements from a panel without replacing the entire panel content.

Parameters

Parameter
Type
Description

args

The arguments for the method.

Returns

void

Example


updateUiControls()

updateUiControls(controls: UiControlsOptions): void

Updates the UI controls on the embedded map.

Use this method to show or hide various UI controls like the legend, full screen button, and other map interface elements.

Parameters

Parameter
Type
Description

controls

The controls to update.

Returns

void

Example


setOnMapInteractionsUi()

setOnMapInteractionsUi(options: OnMapInteractionsOptions): void

Control the on-map UI shown when interacting with features and elements.

If you add your own click, selection or hover handlers you may want to disable various parts of the Felt UI. This method allows you to control the visibility of various parts of the UI that might otherwise be shown when people click or hover on things.

This does not affect selection. That means that selectable features and elements will still be selected when clicked.

Parameters

Parameter
Type

Returns

void

Example


showLayerDataTable()

showLayerDataTable(params?: { layerId: string; sorting: SortConfig; }): Promise<void>

Shows a data table view for the specified layer, optionally sorted by a given attribute.

The data table displays feature data in a tabular format, making it easy to browse and analyze layer data. You can control the initial sorting of the table.

Parameters

Parameter
Type
Description

params?

{ layerId: string; sorting: SortConfig; }

Optional parameters for showing the data table.

params.layerId?

string

The ID of the layer to show data for.

params.sorting?

Optional sorting configuration for the table.

Returns

Promise<void>

Example


hideLayerDataTable()

hideLayerDataTable(): Promise<void>

Hides the data table.

Returns

Promise<void>

Example


getViewport()

getViewport(): Promise<ViewportState>

Gets the current state of the viewport.

Use this method to retrieve the current center coordinates and zoom level of the map viewport.

Returns

Promise<ViewportState>

A promise that resolves to the current viewport state.

Example


setViewport()

setViewport(viewport: SetViewportCenterZoomParams): void

Moves the map to the specified location.

Use this method to programmatically change the map's viewport to a specific location and zoom level. The map will animate to the new position.

Parameters

Parameter
Type

Returns

void

Example


getViewportConstraints()

getViewportConstraints(): Promise<null | ViewportConstraints>

Gets the current state of the viewport constraints.

Use this method to retrieve the current viewport constraints, which limit where users can pan and zoom on the map.

Returns

Promise<null | ViewportConstraints>

A promise that resolves to the current viewport constraints, or null if no constraints are set.

Example


setViewportConstraints()

setViewportConstraints(constraints: null | Partial<ViewportConstraints>): void

Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.

Use this method to limit where users can navigate on the map. This is useful for keeping users focused on a specific area or preventing them from zooming too far in or out.

Parameters

Parameter
Type

constraints

null | Partial<ViewportConstraints>

Returns

void

Examples

every constraint is optional

if a constraint is null, it will be removed but keeping the others

if method receives null, it will remove the constraints


fitViewportToBounds()

fitViewportToBounds(bounds: ViewportFitBoundsParams): void

Fits the map to the specified bounds.

Use this method to automatically adjust the viewport to show a specific geographic area. The map will calculate the appropriate center and zoom level to fit the bounds within the current map size.

Parameters

Parameter
Type

Returns

void

Example

Events

onBasemapChange()

onBasemapChange(args: { handler: (basemap: Basemap) => void; }): VoidFunction

Adds a listener for when the basemap changes.

Use this to react to basemap changes, such as updating your UI or adjusting other map elements to match the new basemap's color scheme.

Parameters

Parameter
Type

args

{ handler: (basemap: Basemap) => void; }

args.handler

(basemap: Basemap) => void

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onElementCreate()

onElementCreate(args: { handler: (change: ElementChangeCallbackParams) => void; }): VoidFunction

Adds a listener for when an element is created.

This will fire when elements are created programmatically, or when the user starts creating an element with a drawing tool.

When the user creates an element with a drawing tool, it can begin in an invalid state, such as if you've just placed a single point in a polygon.

You can use the isBeingCreated property to determine if the element is still being created by a drawing tool.

If you want to know when the element is finished being created, you can use the `onElementCreateEnd` listener.

Parameters

Parameter
Type
Description

args

{ handler: (change: ElementChangeCallbackParams) => void; }

-

args.handler

(change: ElementChangeCallbackParams) => void

The handler that is called when an element is created. This will fire when elements are created programmatically, or when the user starts creating an element with a drawing tool. When the user creates an element with a drawing tool, it can begin in an invalid state, such as if you've just placed a single point in a polygon. You can use the isBeingCreated property to determine if the element is still being created by a drawing tool. If you want to know when the element is finished being created, you can use the `onElementCreateEnd` listener.

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onElementCreateEnd()

onElementCreateEnd(args: { handler: (params: { element: Element; }) => void; }): VoidFunction

Listens for when a new element is finished being created by a drawing tool.

This differs from the `onElementCreate` listener, which fires whenever an element is first created. This fires when the user finishes creating an element which could be after a series of interactions.

For example, when creating a polygon, the user places a series of points then finishes by pressing Enter or Escape. Or when creating a Place element, they add the marker, type a label, then finally deselect the element.

Parameters

Parameter
Type
Description

args

{ handler: (params: { element: Element; }) => void; }

-

args.handler

(params: { element: Element; }) => void

The handler to call whenever this event fires.

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onElementChange()

onElementChange(args: { options: { id: string; }; handler: (change: ElementChangeCallbackParams) => void; }): VoidFunction

Adds a listener for when an element changes.

This will fire when an element is being edited, either on the map by the user or programmatically.

Like the `onElementCreate` listener, this will fire when an element is still being created by a drawing tool.

You can check the `isBeingCreated` property to determine if the element is still being created by a drawing tool.

Parameters

Parameter
Type
Description

args

{ options: { id: string; }; handler: (change: ElementChangeCallbackParams) => void; }

-

args.options

{ id: string; }

-

args.options.id

string

The id of the element to listen for changes to.

args.handler

(change: ElementChangeCallbackParams) => void

The handler that is called when the element changes.

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onElementDelete()

onElementDelete(args: { options: { id: string; }; handler: () => void; }): VoidFunction

Adds a listener for when an element is deleted.

Use this to react to element deletions, such as cleaning up related data or updating your application state.

Parameters

Parameter
Type
Description

args

{ options: { id: string; }; handler: () => void; }

-

args.options

{ id: string; }

-

args.options.id

string

The id of the element to listen for deletions of.

args.handler

() => void

The handler that is called when the element is deleted.

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onElementGroupChange()

onElementGroupChange(args: { options: { id: string; }; handler: (change: ElementGroupChangeCallbackParams) => void; }): VoidFunction

Adds a listener for when an element group changes.

Use this to react to changes in element groups, such as when elements are added to or removed from groups.

Parameters

Parameter
Type

args

{ options: { id: string; }; handler: (change: ElementGroupChangeCallbackParams) => void; }

args.options

{ id: string; }

args.options.id

string

args.handler

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onPointerClick()

onPointerClick(params: { handler: (event: MapInteractionEvent) => void; }): VoidFunction

Allows you to be notified when the user clicks on the map.

Use this to react to user clicks on the map, such as triggering custom actions or collecting interaction data.

Parameters

Parameter
Type

params

{ handler: (event: MapInteractionEvent) => void; }

params.handler

(event: MapInteractionEvent) => void

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onPointerMove()

onPointerMove(params: { handler: (event: MapInteractionEvent) => void; }): VoidFunction

Allows you to be notified when the user moves the mouse over the map.

Use this to track mouse movement and detect features under the cursor, such as for hover effects or real-time data display.

Parameters

Parameter
Type
Description

params

{ handler: (event: MapInteractionEvent) => void; }

Params for the listener

params.handler

(event: MapInteractionEvent) => void

The handler function

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onLayerChange()

onLayerChange(args: { options: { id: string; }; handler: (change: LayerChangeCallbackParams) => void; }): VoidFunction

Adds a listener for when a layer changes.

Parameters

Parameter
Type
Description

args

{ options: { id: string; }; handler: (change: LayerChangeCallbackParams) => void; }

-

args.options

{ id: string; }

-

args.options.id

string

The id of the layer to listen for changes to.

args.handler

(change: LayerChangeCallbackParams) => void

The handler that is called when the layer changes.

Returns

VoidFunction

A function to unsubscribe from the listener

Example


onLayerGroupChange()

onLayerGroupChange(args: { options: { id: string; }; handler: (change: LayerGroupChangeCallbackParams) => void; }): VoidFunction

Adds a listener for when a layer group changes.

Parameters

Parameter
Type

args

{ options: { id: string; }; handler: (change: LayerGroupChangeCallbackParams) => void; }

args.options

{ id: string; }

args.options.id

string

args.handler

Returns

VoidFunction

A function to unsubscribe from the listener

Example


onLegendItemChange()

onLegendItemChange(args: { options: LegendItemIdentifier; handler: (change: LegendItemChangeCallbackParams) => void; }): VoidFunction

Adds a listener for when a legend item changes.

Parameters

Parameter
Type

args

{ options: LegendItemIdentifier; handler: (change: LegendItemChangeCallbackParams) => void; }

args.handler

Returns

VoidFunction

A function to unsubscribe from the listener

Example


onLayerFiltersChange()

onLayerFiltersChange(params: { options: { layerId: string; }; handler: (change: LayerFilters) => void; }): VoidFunction

Adds a listener for when a layer's filters change.

Parameters

Parameter
Type

params

{ options: { layerId: string; }; handler: (change: LayerFilters) => void; }

params.options

{ layerId: string; }

params.options.layerId

string

params.handler

(change: LayerFilters) => void

Returns

VoidFunction

A function to unsubscribe from the listener

Remarks

This event fires whenever any type of filter changes on the layer, including ephemeral filters set via the SDK, style-based filters, or filters set through the Felt UI via Components.

Example


onLayerBoundariesChange()

onLayerBoundariesChange(params: { options: { layerId: string; }; handler: (boundaries: null | LayerBoundaries) => void; }): VoidFunction

Adds a listener for when a layer's spatial boundaries change.

Parameters

Parameter
Type
Description

params

{ options: { layerId: string; }; handler: (boundaries: null | LayerBoundaries) => void; }

-

params.options

{ layerId: string; }

-

params.options.layerId

string

The id of the layer to listen for boundary changes on.

params.handler

(boundaries: null | LayerBoundaries) => void

A function that is called when the boundaries change.

Returns

VoidFunction

A function to unsubscribe from the listener

Remarks

This event fires whenever any type of spatial boundary changes on the layer, including ephemeral boundaries set via the SDK or boundaries set through the Felt UI via Spatial filter components.

Example


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.

Parameters

Parameter
Type

params

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

params.handler

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

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onViewportMove()

onViewportMove(args: { handler: (viewport: ViewportState) => void; }): VoidFunction

Adds a listener for when the viewport changes.

Use this to react to viewport changes, such as updating your UI or triggering other actions when users navigate the map.

Parameters

Parameter
Type
Description

args

{ handler: (viewport: ViewportState) => void; }

-

args.handler

(viewport: ViewportState) => void

This callback is called with the current viewport state whenever the viewport changes.

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onViewportMoveEnd()

onViewportMoveEnd(args: { handler: (viewport: ViewportState) => void; }): VoidFunction

Adds a listener for when the viewport move ends, which is when the user stops dragging or zooming the map, animations have finished, or inertial dragging ends.

Use this to react to the end of viewport changes, such as triggering data loading or analysis when users finish navigating.

Parameters

Parameter
Type

args

{ handler: (viewport: ViewportState) => void; }

args.handler

(viewport: ViewportState) => void

Returns

VoidFunction

A function to unsubscribe from the listener.

Example


onMapIdle()

onMapIdle(args: { handler: () => void; }): VoidFunction

Adds a listener for when the map is idle, which is defined as:

  • No transitions are in progress

  • The user is not interacting with the map, e.g. by panning or zooming

  • All tiles for the current viewport have been loaded

  • Any fade transitions (e.g. for labels) have completed

Use this to perform actions when the map is completely stable and ready for user interaction, such as enabling certain features or triggering data analysis.

Parameters

Parameter
Type

args

{ handler: () => void; }

args.handler

() => void

Returns

VoidFunction

A function to unsubscribe from the listener.

Example

Properties

iframe

readonly iframe: null | HTMLIFrameElement

The iframe element containing the Felt map, if it is an embedded map.

Last updated

Was this helpful?