Open gampleman opened 5 years ago
Duplicate of https://github.com/mapbox/mapbox-gl-js/issues/6876
Supporting feature-state
performantly on layer filters is not possible with the current architecture. Keeping this open as a feature request, but it is not on our roadmap to address currently.
Just throwing my use-case and how this feature would help in here.
I have a property called is_selected
on my features.
My current solution works as follows
is_selected=false
(done via layer- filter) are rendered on Layer1
is_selected=true
(done via layer-filter) are rendered on Layer4
(top most layer)This of course works like a charm, but since I have to update the whole GeoJsonSource (which in turn seems to do a full serialization of the data) in order to change the state of one feature from is_selected=false
to is_selected=true
it would be really helpful to be able to just update a feature-state
and the layer setup will still work as intended. (bringing the selection to the front)
I've got a use case for this. I'd like to create an editor for a layer that is represented using vector tiles. If someone edits a property of a feature, it may effect the color of the rendered polygon. Rather than fetching a whole new set of tiles on form submission, I could duplicate feature properties as feature-state
for those that have been edited and have my style layers render based on both the feature-state and regular properties.
If you can filter based on properties
then you should be able to filter based on run-time "properties" (feature-state
).
get
and feature-state
should function the same.
Motivation
We use
feature-state
for client side data joins. We would like to do some dynamic filtering of the data based on feature-state.Design Alternatives
We could as a work around set the opacity of these features to 0 conditionally. It does seem a bit hacky though.
Design
I'm not sure about the technicalities, but it seems that feature-state could just be allowed in filter expressions.
Concepts
I don't think there are any new concepts here, just broadening existing features to work together.
Implementation
No idea.