We have a web application that displays a map with lots of point and polygon features. The features are loaded as WKT from our web API along with other data.
Currently we just fetch all the features when the web first loads, but naturally this leads to a lot of unnecessary data being transferred. The polygon geometries in particular take a lot of bandwidth, and most of them will never be displayed to the user since the polygon layer is only visible when zoomed in.
Is there a way to have OL automatically make API queries for only the necessary extent?
Ideally we'd like OL to make an API query for the current extent and visible layers and merge the resulting data to the already loaded features.
We use OL 5.