Skip to content
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

high call rate style function on RLayerVectorTile, hits performance badly #12

Closed
vgrafe opened this issue Sep 13, 2021 · 4 comments
Closed

Comments

@vgrafe
Copy link

vgrafe commented Sep 13, 2021

Hi!

I set up a RLayerVectorTile in my RMap that uses MVT format, and pull pbf files from my server. That layer has a lot of features... this leads the function passed to the style prop to be called thousands of times, over 10-20 seconds. This causes the render to freeze at times.
Is there a way to manage the performance on client side to address this scenario? or should my team look into providing more tilesets with less features each?

Thanks!

@vgrafe vgrafe changed the title trying to have control on style function on RLayerVectorTile call rate high call rate style function on RLayerVectorTile, hits performance badly Sep 13, 2021
@mmomtchev
Copy link
Owner

If your function returns a different style for every feature used, you have no way to improve the performance - whether you use rlayers or you use directly OpenLayers. In this case you have 2 choices: either reduce the number of features or use clustering.
If some features share the same styles - you can use the cache parameters - in this case rlayers wil call only your hashing function to check if a new style has to be computed and constructed.

@vgrafe
Copy link
Author

vgrafe commented Sep 13, 2021

You got it - the function returns 3 different styles depending on the feature type. One of those types makes for 99% of the features rendered... what cache parameters are you making mention of, Do you mean I should build a cache layer depending on the 'feature' and 'resolution' parameters sent to the function, or is there a mechanism offered by rlayers/openlayers?

Unfortunately clustering does not seem to be an option for our use case (but I'll look into it more).

Thanks for such a fast response btw 🚀

edit: I just noticed cacheSize and cacheId on the clustering example... I'll see what I can do with it.

@mmomtchev
Copy link
Owner

@vgrafe if one feature type represents 99% of the features, your best option, performance-wise, would be to move these features to a separate vector layer with a single fixed style

@vgrafe
Copy link
Author

vgrafe commented Sep 14, 2021

Makes sense. Thank you for the help!

@vgrafe vgrafe closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants