setFeatureState

fun setFeatureState(sourceLayerId: String, featureId: String, state: JsonObject): Boolean(source)

Sets the state of a feature in this source.

Feature state can be read in style expressions through ["feature-state", key]. The target feature must already have an id in the underlying source data.

Return

true if the source is attached to a map and the update was dispatched

Parameters

sourceLayerId

the source layer id

featureId

the id of the feature whose state to set

state

a JSON object with the state key-value pairs to merge