In my OpenLayers 3 (v3.15.1) application, I use to load a larger amount of GeoJSON features on my map via an
ol.Vector source and a custom loading fuction. This function receives the GeoJSON data from a webserver via Ajax and consequently adds it to the vector layer's source via
However, for about 30000 features and some custom styling rules applied, this makes the browser freeze for quite a while. While I do not mind that loading the data takes some time, the freeze makes the user feel as if the browser just crashed which is a bad feeling as we all know. Once the data is loaded, however, speed is not a concern since I wrap the vector features in an
ImageVector layer which is pretty fast.
I think that the freeze comes from some OpenLayers 3 internals which add the features to the layer synchronously in the main thread.
Is there any possibility how the freeze can be avoided? I saw some other threads on similar topics where people talked about web workers. However, none of them had a solution yet, so maybe there are different ways as well.