I'm investigating how we can improve our vector-layer performance of our GIS component (based on openlayers 4).

OpenLayers keeps all the fetched vector features in memory. This becomes a problem when you are panning around a lot, because you start to feel a noticable delay when there are a lot of features loaded. (I reckon this is because OL has to access an ever growing collection). Especially in IE this becomes really bad, really fast..

Do you have some tips/thoughts?

I was thinking to periodically clear the layer source and ideally read repeat requests from the browser cache, but I find it hard to implement this.

Some concerns:

  • VectorTiles sound like a nice solution, but we can't use them because we need to be able to edit/snap/calculate overlap/.. to these layers
  • Since we use the BBOX filter to fetch data, I wonder if we can cache the request, since the BBOX will be slightly different each time
  • Right now we use POST requests for our WFS, because we allow our users to send quite large XML filters in request -> can we still use POST and caching? I've read that e.g. Firefox ignores all caching headers when you use POST..
  • Ideally we'd also like a way to "invalide" certain cached vectors, because they since have been edited

I find it a little strange that I can't find a lot of information about this on the internet, I'd assume that more people would have run into this problem by now.

Perhaps this could be fixed by using a custom loadingStrategy like they advise at WFS Caching / Back button

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.