Skip to content

How to modify features in place? #997

@jbeuckm

Description

@jbeuckm

I need to modify the properties data of in-place features from a vector tileset. We currently set style expressions but they can be quite large and affect performance (eg. a match expression on a list of 1000 ids). Better to have a static style and modify properties in the data.

Feature data can be modified directly: https://docs.mapbox.com/ios/maps/examples/runtime-animate-line/

A nice to have would be a function that replaces or merges the properties of a set of features by feature id.

const featureUpdates = {
   <featureId1>:{name:"New Name 1", data:"new data 1"},
   <featureId2>:{name:"New Name 2", data:"new data 2"}
}

this._map.modifyRenderedFeaturesProperties(featureUpdates, ['layerId'])

and/or

this._map.setPropertyOnFeatures("propertyName", propertyValue, [<featureId1>,<featureId2>], ['layerId'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions