-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select feature on click is too slow #892
Comments
Thanks for using Mapbox @nininea1! We are tracking performance improvements during To answer your question - one approach that might improve performance is filtering. This requires a bit more work and might not help in your specific case but might still be worth a shot. You can set up a second layer that takes the same source as a parameter but with Example of such filter would be:
To achieve similar effect you can also use Let us know whether filtering helps, closing this one as not actionable. |
p.s. the way I do selection works faster in iOS |
How should I refresh symbol layer? when I will change filter of the layer should I remove and add it again ? I implemented it this way and it is much more fast and pretty :) `
thanks ! |
I'm glad that it helped! Quick follow-up question - you shouldn't need to re-add the layer, setting the filter should be enough to display only requested features, is that not working for you? |
yes, it works without re-add layer. at first I added filter for number field , like this : var selectedExpression = any( but it dons't work. if I change it like this one it works: filter works only for strings? I don't know. |
I'm using mapbox, with GeoJsonSource and symbollayer. When user clicks on feature it should change a color. I handle this logic with following code and it works, but it is too slow and takes several second to change icon color.
Here I configure symbol layer, add icon changelogic for 'PROPERTY_SELECTED':
on map click features objects are update:
and refresh source :
after
refreshSource
is called, it takes several time before icon update. In my case there are 2050 features is source. Is there any better way to implement it ? Or any way to optimise this solution ?The text was updated successfully, but these errors were encountered: