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.
The Felt SDK lets you get information about the elements in the map, and the groups that they belong to.
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.
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
| >
Get a single element from the map by its id.
Parameters
Parameter | Type | Description |
---|
Returns
Promise
<null
| >
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
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
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 |
---|
onElementChange(args
: {options
: {id
: string
; };handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type | Description |
---|
onElementGroupChange(args
: {options
: {id
: string
; };handler
: (change
: ) => void
; }): VoidFunction
Parameter | Type |
---|
|
| The id of the element you want to get the geometry of. |
|
|
|
| The id of the element you want to get. |
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.
The Interactions module allows you to be notified when the user interacts with the map.
Interactions include clicking and hovering on points and features.
The event object passed to the interaction listeners.
coordinate:
LatLng
The cursor position in world coordinates.
features:
Feature
[]
The vector features that are under the cursor.
rasterValues:
RasterValue
[]
The raster pixel values that are under the cursor.
FilterLogicGate:
"and"
|"or"
| The constraints to apply to the elements returned from the map. |
| The constraints to apply to the element groups returned from the map. |
|
|
| - |
|
| - |
|
| The id of the element to listen for changes to. |
| The handler that is called when the element changes. |
|
|
|
|
|
|
|
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
Parameter | Type |
---|---|
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
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
]
(change
: ) => void
(change
: ) => void
Parameter | Type | Description |
---|---|---|
params
object
params.handler
(event
: MapInteractionEvent
) => void
params
object
Params for the listener
params.handler
(event
: MapInteractionEvent
) => void
The handler function
The parameters for the onLayerChange
listener.
layer:
null
|Layer
The new data for the layer or null if the layer was removed.
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
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
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
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.
combined:
Filters
The combined result of all the filters set on the layer.
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.
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
.
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
]
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.
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.
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
| >
Get a single layer from the map by its id.
Parameters
Parameter | Type | Description |
---|
Returns
Promise
<null
| >
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
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
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
<[]>
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 |
---|
|
|
|
|
|
| The id of the layer you want to get. |
EntityNode:
ElementNode
|ElementGroupNode
|LayerNode
|LayerGroupNode
|FeatureNode
A reference to any kind of entity in the map.
EntityNodes are used when you have some collection of entities and you need to
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 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 id of the layer to listen for changes to. |
| The handler that is called when the layer changes. |
|
|
|
|
|
|
|
|
|
|
|
const
Felt: {embed
:Promise
<FeltController
>;connect
:Promise
<FeltController
>; }
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
<FeltController
>
Binds to an existing Felt map iframe.
Parameters
Parameter | Type | Description |
---|---|---|
Returns
Promise
<FeltController
>
The Selection controller allows you to listen for changes to the selection on the map.
getSelection():
Promise
<[]>
Gets the current selection as a list of entity identifiers.
Returns
Promise
<[]>
Example
onSelectionChange(
params
: {handler
: (change
: {selection
: []; }) =>void
; }):VoidFunction
Adds a listener for when the selection changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
[]
[]
(change
: ) => void
(change
: ) => void
(change
: ) => void
Parameter | Type |
---|
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.
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.
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]
.
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.
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.
|
|
|
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
Geometry: | | | |
A GeoJSON-like geometry of any type
(change
: {selection
: []; }) => void
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
MultiLineStringGeometry: {
type
:"MultiLineString"
;coordinates
:LineStringGeometry
["coordinates"
][]; }
A GeoJSON-like multi-line string geometry.
type:
"MultiLineString"
coordinates:
LineStringGeometry
["coordinates"
][]
PointGeometry: {
type
:"Point"
;coordinates
:LngLatTuple
; }
A GeoJSON-like point geometry.
type:
"Point"
coordinates:
LngLatTuple
PolygonGeometry: {
type
:"Polygon"
;coordinates
:LngLatTuple
[][]; }
A GeoJSON-like polygon geometry.
type:
"Polygon"
coordinates:
LngLatTuple
[][]
MultiPolygonGeometry: {
type
:"MultiPolygon"
;coordinates
:PolygonGeometry
["coordinates"
][]; }
A GeoJSON-like multi-polygon geometry.
type:
"MultiPolygon"
coordinates:
PolygonGeometry
["coordinates"
][]
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.
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 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
Returns
void
Example
fitViewportToBounds(
bounds
:ViewportFitBoundsParams
):void
Fits the map to the specified bounds.
Parameters
Returns
void
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
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type |
---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type |
---|---|
controls
The controls to update.
options
latitude
number
Latitude
longitude
number
Longitude
viewport
bounds
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