Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
id:
string
A string identifying the element group.
name:
string
The name of the element group. This is shown in the legend.
caption:
null
|string
The caption of the element group. This is shown in the legend.
elementIds:
string
[]
The ids of the elements in the element group.
Remarks
You can use these ids to get the full element objects via the getElements
method.
visible:
boolean
Whether the element group is visible or not.
shownInLegend:
boolean
Whether the element group is shown in the legend or not.
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.
id:
string
The string identifying the element
type:
string
The type of element, such as a Place, Polygon, Line, Route, etc.
groupId:
null
|string
The ID of the element group that the element belongs to, or null if the element is not inside an element group.
name:
null
|string
The name of the element can be displayed in the Legend, depending on how the element's legend is configured in its style.
description:
null
|string
The element description forms part of the element's metadata. This is visible to users via the element info button in the legend.
attributes:
Record
<string
,unknown
>
The attributes of the element, which can be added via the Element Inspector under the Detail tab.
FeltZoom:
number
The zoom level of the map.
It is a floating-point number between 1 and 23, where 1 is the most zoomed out and 23 is the most zoomed in.
FeltBoundary: [
number
,number
,number
,number
]
The edges of the map in the form of a bounding box.
The boundary is a tuple of the form [west, south, east, north]
.
The Interactions module allows you to be notified when the user interacts with the map.
Interactions include clicking and hovering on points and features.
LngLatTuple: [
number
,number
]
A tuple representing a longitude and latitude coordinate.
This is used hen serializing geometry because that's the standard used in GeoJSON.
LineStringGeometry: {
type
:"LineString"
;coordinates
:LngLatTuple
[]; }
A GeoJSON-like line string geometry.
type:
"LineString"
coordinates:
LngLatTuple
[]
PointGeometry: {
type
:"Point"
;coordinates
:LngLatTuple
; }
A GeoJSON-like point geometry.
type:
"Point"
coordinates:
LngLatTuple
MultiLineStringGeometry: {
type
:"MultiLineString"
;coordinates
:LineStringGeometry
["coordinates"
][]; }
A GeoJSON-like multi-line string geometry.
type:
"MultiLineString"
coordinates:
LineStringGeometry
["coordinates"
][]
MultiPolygonGeometry: {
type
:"MultiPolygon"
;coordinates
:PolygonGeometry
["coordinates"
][]; }
A GeoJSON-like multi-polygon geometry.
type:
"MultiPolygon"
coordinates:
PolygonGeometry
["coordinates"
][]
FilterExpression: [
null
|string
,"in"
|"ni"
,null
| (null
|string
|number
|boolean
)[]] | [null
|string
,"lt"
|"gt"
|"le"
|"ge"
|"eq"
|"ne"
|"cn"
|"nc"
|"is"
|"isnt"
,null
|string
|number
|boolean
]
The Elements controller allows you to get information about the elements on the map, and make changes to their visibility.
getElement(
id
:string
):Promise
<null
|Element
>
Get a single element from the map by its id.
Parameters
id
string
The id of the element you want to get.
Returns
Promise
<null
| Element
>
The requested element.
Example
getElementGeometry(
id
:string
):Promise
<null
|Geometry
>
Get the geometry of an element.
Parameters
id
string
The id of the element you want to get the geometry of.
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
constraint
?
The constraints to apply to the elements returned from the map.
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
id
string
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
constraint
?
The constraints to apply to the element groups returned from the map.
Returns
Promise
<(null
| ElementGroup
)[]>
The requested element groups.
Example
setElementGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show element groups with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
onElementChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element changes.
Parameters
args
object
-
args.options
object
-
args.options.id
string
The id of the element to listen for changes to.
args.handler
The handler that is called when the element changes.
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
args
object
args.options
object
args.options.id
string
args.handler
Returns
VoidFunction
A function to unsubscribe from the listener
Example
(change
: ) => void
(change
: ) => void
latitude
number
Latitude
longitude
number
Longitude
The parameters for the fitViewportToBounds
method.
bounds: [
number
,number
,number
,number
]
The bounds to fit the viewport to.
center:
LatLng
The center of the viewport in latitude and longitude.
zoom:
number
The zoom level of the viewport.
bounds: [
number
,number
,number
,number
]
The bounding box of the viewport.
This is derived, and depends on the center and zoom of the viewport, as well as its size.
A feature is a single geographical item in a layer. The unique ID for a feature is a compound key made up of the layer ID and the feature ID.
id:
string
|number
The identifier of the feature, unique within the layer.
layerId:
string
The identifier of the layer that the feature belongs to.
geometryType:
"Point"
|"Polygon"
|"MultiPolygon"
|"LineString"
|string
& {}
The type of geometry of the feature.
properties:
Record
<string
,unknown
>
The properties of the feature, as a bag of attributes.
Layers in a Felt map hold geospatial data, but also configure how the data is rendered both on the map and in the legend. The data can be vector data such as Points, Lines, or Polygons, or raster data such as satellite images.
Each Layer can be grouped under a LayerGroup, and has associated LegendItems that represent how the layer is rendered in the legend.
You can control the visibility of layers, layer groups, and legend items using the setLayerVisibility
, setLayerGroupVisibility
, and setLegendItemVisibility
methods.
When a Layer is styled to as categorical data or "classed" numeric data, there will be a LegendItem for each category or class. Each LegendItem can be controlled for visibility independently of the Layer, so you can turn on and off each category or class individually.
FilterLogicGate:
"and"
|"or"
The Interactions controller allows you to observe interactions with the map
onPointerClick(
params
: {handler
: (event
:MapInteractionEvent
) =>void
; }):VoidFunction
Allows you to be notified the user clicks on the map.
Parameters
params
object
params.handler
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
params
object
Params for the listener
params.handler
The handler function
Returns
VoidFunction
A function to unsubscribe from the listener
Example
(event
: ) => void
(event
: ) => void
Filters: | |
null
|boolean
Filters can be used to change which features in a layer are rendered. Filters can be applied to a layer by the setLayerFilters
method on the Felt controller.
The possible operators are:
lt
: Less than
gt
: Greater than
le
: Less than or equal to
ge
: Greater than or equal to
eq
: Equal to
ne
: Not equal to
cn
: Contains
nc
: Does not contain
The allowed boolean operators are:
and
: Logical AND
or
: Logical OR
FilterTernary: [ | |
null
|boolean
, , | |null
|boolean
]
Constraints for the getRenderedFeatures
method. This can include layer constriants, spatial constraints, or both. If no constraints are provided, all rendered features will be returned.
optional
areaQuery: {coordinates
:LatLng
; } | {boundary
: [number
,number
,number
,number
]; }
The area to query for rendered features. This can be specific coordinates or a FeltBoundary. If omitted, the entire viewport will be queried.
optional
layerIds:string
[]
The ids of the layers to get rendered features for.
id:
string
The string identifying the layer
groupId:
null
|string
The ID of the layer group that the layer belongs to.
Layers that appear at the root level in Felt will not have a group ID.
name:
string
The name of the layer can be displayed in the Legend, depending on how the layer's legend is configured in its style.
caption:
null
|string
The layer's caption is shown in the legend.
description:
null
|string
The layer description forms part of the layer's metadata. This is visible to users via the layer info button in the legend.
visible:
boolean
Whether the layer is visible or not.
shownInLegend:
boolean
Whether the layer is shown in the legend or not.
style:
object
The FSL style for the layer.
See the FSL documentation for details on how to read and write styles.
As the types of the styles are very complex, we return object
here and advise that you program defensively while reading the styles.
status:
"processing"
|"completed"
|"failed"
|"incomplete"
The current processing status of the layer.
geometryType:
null
|string
The geometry type of the layer.
Remarks
This will generally be one of:
"Point"
"Line"
"Polygon"
"Raster"
null
When the layer is processing, or it is a data-only layer, it will be null. You should expect this to be able to be any string, however, as more geometry types can be added in the future.
bounds:
null
| [number
,number
,number
,number
]
The bounding box of the layer. If the layer is processing, or the bounds have otherwise not been calculated or are not available, this will be null
.
LayerProcessingStatus:
"processing"
|"completed"
|"failed"
|"incomplete"
This describes the processing status of a layer.
The various values are:
processing
: The layer has been uploaded or updated and is still processing.
completed
: The layer has been processed and can be viewed on the map.
failed
: The layer failed to process and cannot be viewed on the map.
incomplete
: The layer has not been processed.
id:
string
A string identifying the layer group.
name:
string
The name of the layer group. This is shown in the legend.
caption:
null
|string
The caption of the layer group. This is shown in the legend.
layerIds:
string
[]
The ids of the layers in the layer group.
Remarks
You can use these ids to get the full layer objects via the getLayers
method.
visible:
boolean
Whether the layer group is visible or not.
shownInLegend:
boolean
Whether the layer group is shown in the legend or not.
bounds:
null
| [number
,number
,number
,number
]
The bounding box of the layer group.
The filters that are currently set on a layer.
A layer's filters are the combination of various different places in which filters can be applied.
style:
Filters that are set in the layer's style. These are the lowest level of filters, and can only be set by editing the map.
components:
Filters that are set in the layer's components, which are interactive elements in the legend. These can be set by viewers for their own session, but their default value can be set by the map creator.
ephemeral:
Filters that are set ephemerally by viewers in their own session.
These are the filters that are set when the setLayerFilters
method is called. There is no way to set these in the Felt UI - they can only be set using the SDK.
The combined result of all the filters set on the layer.
combined:
The parameters for the onLayerChange
listener.
layer:
null
|Layer
The new data for the layer or null if the layer was removed.
A legend item, which often represents a sub-class of features in a layer in the case of categorical or classed layers.
title:
string
|string
[]
The title of the legend item.
titleDependsOnZoom:
boolean
Whether the title depends on the zoom level or not. If it does, you need to call getLegendItem
when the zoom level changes.
Note that as the zoom level changes, the onLegendItemChange
handler will not be called, so you need to call getLegendItem
yourself.
visible:
boolean
Whether the legend item is visible or not.
id:
string
The id of the legend item.
layerId:
string
The id of the layer the legend item belongs to.
A raster pixel value for a specific layer.
value:
number
The value of the pixel.
layerId:
string
The ID of the layer that the pixel belongs to.
categoryName:
null
|string
The name of the category that the pixel belongs to.
color:
null
| {r
:number
;g
:number
;b
:number
;a
:number
; }
The color of the pixel. Each value is between 0 and 255.
The Layers controller allows you to get information about the layers on the map, and make changes to their visibility.
Layers can be organised into groups, and their groups can also have their visibility toggled.
getLayer(
id
:string
):Promise
<null
|Layer
>
Get a single layer from the map by its id.
Parameters
id
string
The id of the layer you want to get.
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
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(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show layers with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
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
params
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
getLayerGroup(
id
:string
):Promise
<null
|LayerGroup
>
Get a layer group from the map by its id.
Parameters
id
string
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
constraint
?
The constraints to apply to the layer groups returned from the map.
Returns
Promise
<(null
| LayerGroup
)[]>
The requested layer groups.
Example
setLayerGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show layer groups with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
getLegendItem(
id
:LegendItemIdentifier
):Promise
<null
|LegendItem
>
Allows you to get the state of a single legend item.
Parameters
id
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
constraint
?
Returns
Promise
<(null
| LegendItem
)[]>
Example
setLegendItemVisibility(
visibility
: {show
:LegendItemIdentifier
[];hide
:LegendItemIdentifier
[]; }):Promise
<void
>
Hide or show legend items with the given identifiers.
Parameters
visibility
object
visibility.show
?
visibility.hide
?
Returns
Promise
<void
>
Example
getLayerFilters(
layerId
:string
):Promise
<null
|LayerFilters
>
Get the filters for a layer.
Parameters
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(
params
: {layerId
:string
;filters
:Filters
;note
:string
; }):Promise
<void
>
Sets the ephemeral filters for a layer.
Parameters
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.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
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
params
?
The constraints to apply to the features returned from the map.
Returns
Promise
<Feature
[]>
Example
onLayerChange(
args
: {options
: {id
:string
; };handler
: (change
:LayerChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when a layer changes.
Parameters
args
object
-
args.options
object
-
args.options.id
string
The id of the layer to listen for changes to.
args.handler
The handler that is called when the layer changes.
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
args
object
args.options
object
args.options.id
string
args.handler
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
args
object
args.options
args.handler
Returns
VoidFunction
A function to unsubscribe from the listener
Example
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
Returns
Promise
<>
Binds to an existing Felt map iframe.
Parameters
Returns
[]
[]
(change
: ) => void
(change
: ) => void
(change
: ) => void
Promise
<>
container
HTMLElement
The container element to embed the map into.
mapId
string
The ID of the map to embed.
options
?
The options to configure the map.
feltWindow
Window
The iframe element containing the Felt map.
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
id
string
The id of the element you want to get.
Returns
Promise
<null
| Element
>
The requested element.
Example
getElementGeometry(
id
:string
):Promise
<null
|Geometry
>
Get the geometry of an element.
Parameters
id
string
The id of the element you want to get the geometry of.
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
constraint
?
The constraints to apply to the elements returned from the map.
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
id
string
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
constraint
?
The constraints to apply to the element groups returned from the map.
Returns
Promise
<(null
| ElementGroup
)[]>
The requested element groups.
Example
setElementGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show element groups with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
getLayer(
id
:string
):Promise
<null
|Layer
>
Get a single layer from the map by its id.
Parameters
id
string
The id of the layer you want to get.
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
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(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show layers with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
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
params
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
getLayerGroup(
id
:string
):Promise
<null
|LayerGroup
>
Get a layer group from the map by its id.
Parameters
id
string
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
constraint
?
The constraints to apply to the layer groups returned from the map.
Returns
Promise
<(null
| LayerGroup
)[]>
The requested layer groups.
Example
setLayerGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show layer groups with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
getLegendItem(
id
:LegendItemIdentifier
):Promise
<null
|LegendItem
>
Allows you to get the state of a single legend item.
Parameters
id
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
constraint
?
Returns
Promise
<(null
| LegendItem
)[]>
Example
setLegendItemVisibility(
visibility
: {show
:LegendItemIdentifier
[];hide
:LegendItemIdentifier
[]; }):Promise
<void
>
Hide or show legend items with the given identifiers.
Parameters
visibility
object
visibility.show
?
visibility.hide
?
Returns
Promise
<void
>
Example
getLayerFilters(
layerId
:string
):Promise
<null
|LayerFilters
>
Get the filters for a layer.
Parameters
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(
params
: {layerId
:string
;filters
:Filters
;note
:string
; }):Promise
<void
>
Sets the ephemeral filters for a layer.
Parameters
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.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
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
params
?
The constraints to apply to the features returned from the map.
Returns
Promise
<Feature
[]>
Example
getSelection():
Promise
<EntityNode
[]>
Gets the current selection as a list of entity identifiers.
Returns
Promise
<EntityNode
[]>
Example
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.
Parameters
params
Returns
Promise
<void
>
Example
clearSelection(
params
?: {features
:boolean
;elements
:boolean
; }):Promise
<void
>
Clears the current selection. This clears the selection of
Parameters
params
?
object
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
>
Example
Default
updateUiControls(
controls
:UiControlsOptions
):void
Updates the UI controls on the embedded map.
Parameters
controls
The controls to update.
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
options
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
viewport
Returns
void
Example
fitViewportToBounds(
bounds
:ViewportFitBoundsParams
):void
Fits the map to the specified bounds.
Parameters
bounds
Returns
void
Example
onElementChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element changes.
Parameters
args
object
-
args.options
object
-
args.options.id
string
The id of the element to listen for changes to.
args.handler
The handler that is called when the element changes.
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
args
object
args.options
object
args.options.id
string
args.handler
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
params
object
params.handler
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
params
object
Params for the listener
params.handler
The handler function
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
args
object
-
args.options
object
-
args.options.id
string
The id of the layer to listen for changes to.
args.handler
The handler that is called when the layer changes.
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
args
object
args.options
object
args.options.id
string
args.handler
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
args
object
args.options
args.handler
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
params
object
params.handler
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
args
object
-
args.handler
This callback is called with the current viewport state whenever the viewport changes.
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
args
object
args.handler
Returns
VoidFunction
A function to unsubscribe from the listener
Example
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
Parameters
args
object
args.handler
() => void
Returns
VoidFunction
A function to unsubscribe from the listener
Example
[]
[]
(change
: ) => void
(change
: ) => void
(event
: ) => void
(event
: ) => void
(change
: ) => void
(change
: ) => void
(change
: ) => void
(change
: {selection
: []; }) => void
(viewport
: ) => void
(viewport
: ) => void
The options for selecting a feature in a layer.
id:
string
|number
The id of the feature to select.
layerId:
string
The id of the layer that the feature belongs to.
optional
showPopup:boolean
Whether to show the feature's popup, if it is configured in the layer's style.
Default
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.
Default
Geometry:
PointGeometry
|PolygonGeometry
|LineStringGeometry
|MultiLineStringGeometry
|MultiPolygonGeometry
A GeoJSON-like geometry of any type
optional
showLegend:boolean
Whether or not the legend is shown.
Default Value
optional
cooperativeGestures:boolean
When co-operative gestures are enabled, the pan and zoom gestures are adjusted to work better when the map is embedded in another page.
Remarks
On mobile devices, enabling co-operative gestures will allow the user to pan past the embedded map with a single finger drag. To pan the map, they must use two fingers.
On desktop devices, enabling co-operative gestures allows the user to scroll past the embedded map using their scroll wheel or trackpad. To zoom the map, they must hold the Ctrl (Windows) or Command key (Mac) while scrolling.
Default Value
optional
fullScreenButton:boolean
Whether or not the full screen button is shown in an embedded map.
Remarks
When clicked, this will open the map in a new tab or window.
Default Value
optional
geolocation:boolean
Whether or not the geolocation button is shown in an embedded map.
Remarks
The geolocation feature will plot your position on the map. If you click the button again, it will start tracking your position.
Default Value
optional
zoomControls:boolean
Whether or not the zoom controls are shown in an embedded map.
Remarks
This does not affect whether or not the map can be zoomed, just the display of the zoom controls in the bottom right corner of the map.
Default Value
optional
scaleBar:boolean
Whether or not the scale bar is shown in an embedded map.
Default Value
The Selection controller allows you to listen for changes to the selection on the map.
getSelection():
Promise
<EntityNode
[]>
Gets the current selection as a list of entity identifiers.
Returns
Promise
<EntityNode
[]>
Example
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.
Parameters
params
Returns
Promise
<void
>
Example
clearSelection(
params
?: {features
:boolean
;elements
:boolean
; }):Promise
<void
>
Clears the current selection. This clears the selection of
Parameters
params
?
object
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
>
Example
Default
onSelectionChange(
params
: {handler
: (change
: {selection
:EntityNode
[]; }) =>void
; }):VoidFunction
Adds a listener for when the selection changes.
Parameters
params
object
params.handler
Returns
VoidFunction
A function to unsubscribe from the listener
Example
(change
: {selection
: []; }) => void
The UI part of the Felt SDK allows you to enable and disable certain UI features such as the legend and the full screen button.
The UI controller allows you to enable and disable UI controls on the embedded map.
updateUiControls(
controls
:UiControlsOptions
):void
Updates the UI controls on the embedded map.
Parameters
controls
The controls to update.
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
options
Returns
void
The options for which parts of the Felt UI can be shown when interacting with features and elements on the map.
Switching these off can be useful if you add your own click, selection or hover handlers for features and elements.
optional
featureSelectPanel:boolean
Set this to false
to prevent the panel that shows information about a selected feature from being shown.
optional
featureHoverPanel:boolean
Set this to false
to prevent the panel that shows information about a hovered feature from being shown.
optional
elementSelectPanel:boolean
Set this to false
to prevent the panel that shows information about a selected element from being shown.
optional
linkClickOpen:boolean
Set this to false
to prevent clicking on a map link element from opening that link in a new tab or window.
optional
imageLightboxOpen:boolean
Set this to false
to prevent clicking on an image element from opening the image in a lightbox.
The viewport controller allows you to control the viewport of the map.
You can get the current viewport, move the viewport, and be notified when the viewport changes.
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
viewport
Returns
void
Example
fitViewportToBounds(
bounds
:ViewportFitBoundsParams
):void
Fits the map to the specified bounds.
Parameters
bounds
Returns
void
Example
onViewportMove(
args
: {handler
: (viewport
:ViewportState
) =>void
; }):VoidFunction
Adds a listener for when the viewport changes.
Parameters
args
object
-
args.handler
This callback is called with the current viewport state whenever the viewport changes.
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
args
object
args.handler
Returns
VoidFunction
A function to unsubscribe from the listener
Example
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
Parameters
args
object
args.handler
() => void
Returns
VoidFunction
A function to unsubscribe from the listener
Example
(viewport
: ) => void
(viewport
: ) => void