1

I try to improve my current OL-3 webmap to load less payload using the bbox strategy. So I altered my code similar to the bbox examples out there:

overlayGroup.getLayers().extend([
    new ol.layer.Vector({
    title: 'Nodes',
    source : new ol.source.Vector({
      format: new ol.format.GeoJSON(),
      loader: function(extent, resolution, projection) {
          alert("lol:"+extend);
        var url = '/api/nodes?bbox=' + extent.join(',');
        $.ajax({
          url: url,
          success: function(data) {
            source.addFeatures(source.readFeatures(data));
          }
        }); 
      },
      projection: 'EPSG:3857',
      strategy: ol.loadingstrategy.bbox()
      }),
    style: createNodeStyle(),
    }),
    new ol.layer.Vector({
    ....

Unfortunatly nothing get's displayed, but also no warnings appear. I'cant't debug as no breakpoint triggers and Firebug doesn't list any transfer :-( (If I remove the bbox specific stuff and witch back to a geoJSON source everything works fine)

2
  • Can you set a jsfiddle, it will be easy to debug. Which version of openlayers do you use ?
    – oterral
    Jun 1, 2015 at 11:29
  • I tried to isolate the pices of code and get them running on jsfiddle, but failed. I'm ok if somebody can just say if this is the usual way to config an bbox strategy.
    – Mapper
    Jun 2, 2015 at 20:08

1 Answer 1

1

I think you may have a problem with your strategy definition. Try dropping the '()' from 'strategy: ol.loadingstrategy.bbox()'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.