I have a ol.source.Vector like this:
var geoJSONFormat = new ol.format.GeoJSON();
vectorSource = new ol.source.Vector({
strategy: ol.loadingstrategy.bbox,
loader: function(extent, resolution, projection) {
var url = getUrl( extent );
$.ajax({
url: url,
dataType: 'json'
}).then(function(response) {
var features = geoJSONFormat.readFeatures( response, {featureProjection: 'EPSG:3857'} );
console.log( features );
vectorSource.addFeatures( features );
})
},
format: geoJSONFormat
});
mapillaryLayer = new ol.layer.Vector({
source: vectorSource
});
map.addLayer( mapillaryLayer );
When first load, all its ok. I can see the features on the map. When I pan the map to an undiscovered
area, the features are updated from server.
But when I zoom in and pan to an already seen
area (inside the original wide area before the zoom in) no new loads are made.
I know its a correct behaviour because all data inside this BBOX must be taken when zoomed out, so when zoom in I already have all I need for that area.
But I'm loading a limited amount of points in my query (maxresults):
var url = "getPhotosInBBOX?minlat="+minlat+"&minlon="+minlon+"&maxlat="+maxlat+"&maxlon="+maxlon+"&maxresults="+maxresults;
And now, even already loaded the BBOX content, I need to do a refresh
because when zoom in, I need to have the same amount of data I have before.
Example: I have a bbox to show all Canada territory. So I will ask for 100 features from my server. Now, I'll zoom to Alberta. Alberta is inside Canada bbox and the layer will not load again. But I need to refresh to show 100 features inside this new bbox.
Why? My query is random. It takes 100 arbitrary features inside the view's current extent. May all be in Alberta, may not. When I zoom in, I need to take those I don't take before.
I don't know I'm clear. Ask for further informations.