Use the Felt object to embed a new iframe, or connect to an existing embedded iframe.
Once you have connected to a Felt map (either by embedding or connecting to an existing iframe), you can use the FeltController object to control the map.
To see what you can do with the map, see the documentation for the FeltController interface and its constituent controllers.
const
Felt: {embed
:Promise
<>;connect
:Promise
<>; }
The Felt SDK is a library for embedding Felt maps into your website, allowing you to control and inspect the map programmatically.
Embeds a Felt map into the provided container.
Parameters
Parameter | Type | Description |
---|
Returns
Promise
<>
Binds to an existing Felt map iframe.
Parameters
Parameter | Type | Description |
---|
Returns
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.
.....
readonly
iframe:null
|HTMLIFrameElement
The iframe element containing the Felt map, if it is an embedded map.
getElement(
id
:string
):Promise
<null
| >
Get a single element from the map by its id.
Parameters
Returns
The requested element.
Example
Get the geometry of an element.
Parameters
Returns
Example
Gets elements from the map, according to the constraints supplied. If no constraints are supplied, all elements will be returned.
Parameters
Returns
All elements on the map.
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
Get an element group from the map by its id.
Parameters
Returns
The requested element group.
Example
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.
Parameters
Returns
The requested element groups.
Example
Hide or show element groups with the given ids.
Parameters
Returns
Promise
<void
>
Example
Get a single layer from the map by its id.
Parameters
Returns
The requested layer.
Example
Gets layers from the map, according to the constraints supplied. If no constraints are supplied, all layers will be returned.
Parameters
Returns
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
Hide or show layers with the given ids.
Parameters
Returns
Promise
<void
>
Example
Get a layer group from the map by its id.
Parameters
Returns
The requested layer group.
Example
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
Returns
The requested layer groups.
Example
Hide or show layer groups with the given ids.
Parameters
Returns
Promise
<void
>
Example
Allows you to get the state of a single legend item.
Parameters
Returns
Example
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
Returns
Example
Hide or show legend items with the given identifiers.
Parameters
Returns
Promise
<void
>
Example
Get the filters for a layer.
Parameters
Returns
Remarks
The return type gives you the filters split up into the various sources that make up the overall filters for a layer.
Example
Sets the ephemeral filters for a layer.
Parameters
Returns
Promise
<void
>
Example
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
Returns
Example
Gets the current selection as a list of entity identifiers.
Returns
Example
Updates the UI controls on the embedded map.
Parameters
Returns
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
Returns
void
Gets the current state of the viewport.
Returns
Moves the map to the specified location.
Parameters
Returns
void
Example
Fits the map to the specified bounds.
Parameters
Returns
void
Example
Adds a listener for when an element changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Adds a listener for when an element group changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Allows you to be notified the user clicks on the map.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Allows you to be notified the user moves the mouse over the map.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Adds a listener for when a layer changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Adds a listener for when a layer group changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Adds a listener for when a legend item changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Adds a listener for when the selection changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Adds a listener for when the viewport changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
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.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Promise
<>
Parameter | Type | Description |
---|
Promise
<null
| >
getElementGeometry(id
: string
): Promise
<null
| >
Parameter | Type | Description |
---|
Promise
<null
| >
getElements(constraint
?: ): Promise
<(null
| )[]>
Parameter | Type | Description |
---|
Promise
<(null
| )[]>
getElementGroup(id
: string
): Promise
<null
| >
Parameter | Type |
---|
Promise
<null
| >
getElementGroups(constraint
?: ): Promise
<(null
| )[]>
Parameter | Type | Description |
---|
Promise
<(null
| )[]>
setElementGroupVisibility(visibility
: ): Promise
<void
>
Parameter | Type |
---|
getLayer(id
: string
): Promise
<null
| >
Parameter | Type | Description |
---|
Promise
<null
| >
getLayers(constraint
?: ): Promise
<(null
| )[]>
Parameter | Type | Description |
---|
Promise
<(null
| )[]>
setLayerVisibility(visibility
: ): Promise
<void
>
Parameter | Type |
---|
getLayerGroup(id
: string
): Promise
<null
| >
Parameter | Type |
---|
Promise
<null
| >
getLayerGroups(constraint
?: ): Promise
<(null
| )[]>
Parameter | Type | Description |
---|
Promise
<(null
| )[]>
setLayerGroupVisibility(visibility
: ): Promise
<void
>
Parameter | Type |
---|
getLegendItem(id
: ): Promise
<null
| >
Parameter | Type |
---|
Promise
<null
| >
getLegendItems(constraint
?: ): Promise
<(null
| )[]>
Parameter | Type |
---|
Promise
<(null
| )[]>
setLegendItemVisibility(visibility
: {show
: [];hide
: []; }): Promise
<void
>
Parameter | Type |
---|
getLayerFilters(layerId
: string
): Promise
<null
| >
Parameter | Type |
---|
Promise
<null
| >
setLayerFilters(params
: {layerId
: string
;filters
: ; }): Promise
<void
>
Parameter | Type | Description |
---|
getRenderedFeatures(params
?: ): Promise
<[]>
Parameter | Type | Description |
---|
Promise
<[]>
getSelection(): Promise
<[]>
Promise
<[]>
updateUiControls(controls
: ): void
Parameter | Type | Description |
---|
setOnMapInteractionsUi(options
: ): void
Parameter | Type |
---|
getViewport(): Promise
<>
Promise
<>
setViewport(viewport
: ): void
Parameter | Type |
---|
fitViewportToBounds(bounds
: ): void
Parameter | Type |
---|
onElementChange(args
: {options
: {id
: string
; };handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type | Description |
---|
onElementGroupChange(args
: {options
: {id
: string
; };handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type |
---|
onPointerClick(params
: {handler
: (event
: ) => void
; }): VoidFunction
Parameter | Type |
---|
onPointerMove(params
: {handler
: (event
: ) => void
; }): VoidFunction
Parameter | Type | Description |
---|
onLayerChange(args
: {options
: {id
: string
; };handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type | Description |
---|
onLayerGroupChange(args
: {options
: {id
: string
; };handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type |
---|
onLegendItemChange(args
: {options
: ;handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type |
---|
onSelectionChange(params
: {handler
: (change
: {selection
: []; }) => void
; }): VoidFunction
Parameter | Type |
---|
onViewportMove(args
: {handler
: (viewport
: ) => void
; }): VoidFunction
Parameter | Type | Description |
---|
onViewportMoveEnd(args
: {handler
: (viewport
: ) => void
; }): VoidFunction
Parameter | Type |
---|
|
| The id of the element you want to get. |
|
| The id of the element you want to get the geometry of. |
|
|
|
| The id of the layer you want to get. |
|
|
|
|
|
| The container element to embed the map into. |
|
| The ID of the map to embed. |
| The options to configure the map. |
|
| The iframe element containing the Felt map. |
| The constraints to apply to the elements returned from the map. |
| The constraints to apply to the element groups returned from the map. |
|
| The constraints to apply to the layers returned from the map. |
|
| The constraints to apply to the layer groups returned from the map. |
|
|
|
|
|
|
|
|
| - |
|
| The layer that you want to set the filters for. |
| The filters to set for the layer. This will replace any ephemeral filters that are currently set for the layer. |
| The constraints to apply to the features returned from the map. |
| The controls to update. |
|
|
|
|
| - |
|
| - |
|
| The id of the element to listen for changes to. |
| The handler that is called when the element changes. |
|
|
|
|
|
|
|
|
|
|
|
| Params for the listener |
| The handler function |
|
| - |
|
| - |
|
| The id of the layer to listen for changes to. |
| The handler that is called when the layer changes. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| - |
| This callback is called with the current viewport state whenever the viewport changes. |
|
|
|
[]
[]
(change
: ) => void
(change
: ) => void
(event
: ) => void
(event
: ) => void
(change
: ) => void
(change
: ) => void
(change
: ) => void
(change
: {selection
: []; }) => void
(viewport
: ) => void
(viewport
: ) => void