Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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
]
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.
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.
FilterTernary: [
FilterTernary
|FilterExpression
|null
|boolean
,FilterLogicGate
,FilterTernary
|FilterExpression
|null
|boolean
]
FilterLogicGate:
"and"
|"or"
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
Filters: | | null
| 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.
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
.
The parameters for the onLayerGroupChange
listener.
layerGroup:
null
|LayerGroup
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.
The parameters for the onLayerChange
listener.
layer:
null
|Layer
The new data for the layer or null if the layer was removed.
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.
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.
The parameters for the onLegendItemChange
listener.
legendItem:
null
|LegendItem
The new data for the legend item or null if the legend item was removed.
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
[]
[]
(change
: ) => void
(change
: ) => void
(change
: ) => void