I added a ol.source.Vector to my map which receives data from a wfs. Currently I am using ol.loadingstrategy.bbox because there is a lot of vector data and it would take too much time to load it all at once. The problem is that whenever I change the maps extent all the data which is in old and new extent is loaded and added to the source again. For example, If I just zoom out 3 times the data near to the map's center is added to the source 4 times. Obviously, after a while the performance is pretty bad because there is just too much data loaded.
Here is my code:
var wfsSource = new ol.source.Vector({ strategy: ol.loadingstrategy.bbox, format: new ol.format.GeoJSON(), url: getWFSURL }); function getWFSURL(extent){ var url = 'http://serveraddress/geoserver/ola/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ola:V_GIS_VERLEGEBER_LN_PROD&outputFormat=application/json&srsname=EPSG:31467&bbox=' + extent.join(','); return url; } Is there a way to prevent OL3 from adding data multiple times?