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
|Element
>
Get a single element from the map by its id.
Parameters
Returns
Promise
<null
| Element
>
The requested element.
Example
getElementGeometry(
id
:string
):Promise
<null
|Geometry
>
Get the geometry of an element.
Parameters
Returns
Promise
<null
| Geometry
>
Example
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.
Parameters
Returns
Promise
<(null
| Element
)[]>
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
getElementGroup(
id
:string
):Promise
<null
|ElementGroup
>
Get an element group from the map by its id.
Parameters
Returns
Promise
<null
| ElementGroup
>
The requested element group.
Example
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.
Parameters
Returns
Promise
<(null
| ElementGroup
)[]>
The requested element groups.
Example
setElementGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show element groups with the given ids.
Parameters
Returns
Promise
<void
>
Example
getLayer(
id
:string
):Promise
<null
|Layer
>
Get a single layer from the map by its id.
Parameters
Returns
Promise
<null
| Layer
>
The requested layer.
Example
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
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(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show layers with the given ids.
Parameters
Returns
Promise
<void
>
Example
getLayerGroup(
id
:string
):Promise
<null
|LayerGroup
>
Get a layer group from the map by its id.
Parameters
Returns
Promise
<null
| LayerGroup
>
The requested layer group.
Example
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
Returns
Promise
<(null
| LayerGroup
)[]>
The requested layer groups.
Example
setLayerGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show layer groups with the given ids.
Parameters
Returns
Promise
<void
>
Example
getLegendItem(
id
:LegendItemIdentifier
):Promise
<null
|LegendItem
>
Allows you to get the state of a single legend item.
Parameters
Returns
Promise
<null
| LegendItem
>
Example
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
Returns
Promise
<(null
| LegendItem
)[]>
Example
setLegendItemVisibility(
visibility
: {show
:LegendItemIdentifier
[];hide
:LegendItemIdentifier
[]; }):Promise
<void
>
Hide or show legend items with the given identifiers.
Parameters
Returns
Promise
<void
>
Example
getLayerFilters(
layerId
:string
):Promise
<null
|LayerFilters
>
Get the filters for a layer.
Parameters
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(
params
: {layerId
:string
;filters
:Filters
; }):Promise
<void
>
Sets the ephemeral filters for a layer.
Parameters
Returns
Promise
<void
>
Example
getRenderedFeatures(
params
?:GetRenderedFeaturesConstraint
):Promise
<Feature
[]>
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
Promise
<Feature
[]>
Example
getSelection():
Promise
<EntityNode
[]>
Gets the current selection as a list of entity identifiers.
Returns
Promise
<EntityNode
[]>
Example
updateUiControls(
controls
:UiControlsOptions
):void
Updates the UI controls on the embedded map.
Parameters
Returns
void
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
Returns
void
getViewport():
Promise
<ViewportState
>
Gets the current state of the viewport.
Returns
Promise
<ViewportState
>
setViewport(
viewport
:SetViewportCenterZoomParams
):void
Moves the map to the specified location.
Parameters
Returns
void
Example
fitViewportToBounds(
bounds
:ViewportFitBoundsParams
):void
Fits the map to the specified bounds.
Parameters
Returns
void
Example
onElementChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onElementGroupChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementGroupChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element group changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onPointerClick(
params
: {handler
: (event
:MapInteractionEvent
) =>void
; }):VoidFunction
Allows you to be notified the user clicks on the map.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onPointerMove(
params
: {handler
: (event
:MapInteractionEvent
) =>void
; }):VoidFunction
Allows you to be notified the user moves the mouse over the map.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onLayerChange(
args
: {options
: {id
:string
; };handler
: (change
:LayerChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when a layer changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onLayerGroupChange(
args
: {options
: {id
:string
; };handler
: (change
:LayerGroupChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when a layer group changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onLegendItemChange(
args
: {options
:LegendItemIdentifier
;handler
: (change
:LegendItemChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when a legend item changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onSelectionChange(
params
: {handler
: (change
: {selection
:EntityNode
[]; }) =>void
; }):VoidFunction
Adds a listener for when the selection changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onViewportMove(
args
: {handler
: (viewport
:ViewportState
) =>void
; }):VoidFunction
Adds a listener for when the viewport changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
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.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
id
string
The id of the element you want to get.
id
string
The id of the element you want to get the geometry of.
constraint
?
The constraints to apply to the elements returned from the map.
id
string
constraint
?
The constraints to apply to the element groups returned from the map.
visibility
id
string
The id of the layer you want to get.
constraint
?
The constraints to apply to the layers returned from the map.
visibility
id
string
constraint
?
The constraints to apply to the layer groups returned from the map.
visibility
id
constraint
?
visibility
object
visibility.show
?
visibility.hide
?
layerId
string
params
object
-
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
?
The constraints to apply to the features returned from the map.
controls
The controls to update.
options
viewport
bounds
args
object
-
args.options
object
-
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.
args
object
args.options
object
args.options.id
string
args.handler
(change
: ElementGroupChangeCallbackParams
) => void
params
object
params.handler
(event
: MapInteractionEvent
) => void
params
object
Params for the listener
params.handler
(event
: MapInteractionEvent
) => void
The handler function
args
object
-
args.options
object
-
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.
args
object
args.options
object
args.options.id
string
args.handler
(change
: LayerGroupChangeCallbackParams
) => void
args
object
args.options
args.handler
(change
: LegendItemChangeCallbackParams
) => void
params
object
params.handler
(change
: {selection
: EntityNode
[]; }) => void
args
object
-
args.handler
(viewport
: ViewportState
) => void
This callback is called with the current viewport state whenever the viewport changes.
args
object
args.handler
(viewport
: ViewportState
) => void