Function setFeatureState

  • Sets or removes a feature state. The feature state is taken into account for styling, just like the feature's properties, and can be used e.g. to conditionally render selected features differently.

    The feature state will be stored on the OpenLayers layer matching the feature identifier, in the mapbox-featurestate property.

    Parameters

    • mapOrLayer: Map | VectorLayer<any> | VectorTileLayer<any>

      OpenLayers Map or layer to set the feature state on.

    • feature: FeatureIdentifier

      Feature identifier.

    • state: any

      Feature state. Set to null to remove the feature state.

    Returns void