Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
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 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. |
The parameters for the onElementChange
listener.
element:
null
|Element
The new data for the element or null if the element was removed.
| 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. |
|
|
|
|
|
|
|
(change
: ) => void
(change
: ) => void