visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

Source feature properties are not updated when updating source clusterProperties [Bug] #2095

Closed matsomo closed 1 year ago

matsomo commented 1 year ago

Description

I have a map where the user can select different scenarios. Selecting a new scenario will fire off a query and new data is passed to the map. The points are clustered with donut charts where the colors in the chart is tied to which scenario is currently selected. I'm achieving this by updating the clusterProperties passed to a Source component every time a new scenario is selected, and then querying the source features with querySourceFeatures to read each aggregated value that will make up a donut chart. See this example

The problem: The source feature properties are not being updated between scenarios when querying with querySourceFeatures. The result always contains properties from the initial clusterProperties that was passed to the Source component.

Expected Behavior

Source feature properties should be updated when clusterProperties is updated for a given source.

Steps to Reproduce

Environment

Logs

No response

Pessimistress commented 1 year ago

As far as I can tell GeoJSONSource does not support changing cluster properties after it's created. You should either do some light aggregation in your own code or make a feature request to mapbox-gl.