[OpenLayers-Users] BBOX Strategy not updating on move or zoom

bzrudi bzrudi at tuxpower.de
Thu Dec 22 12:00:13 EST 2011


Hi! 

I have strange problem. For a long time i use the usual
OpenLayers.Layer.WFS() to request features from my geoserver setup. This
works pretty well, but no I have so many "markers" to display in map that I
decided to switch to a cluster strategy. 

As I learned that cluster strategy is not possible with Layer.WFS() but
Layer.Vector() I changed my code accordingly. The good thing so far it works
:-) The bad thing, after some days noticed that now not all features are
loaded in this way. 


My old code for the a sample layer looked like this: 

       var trackWFSLayer = new OpenLayers.Layer.WFS("TESTLAYER WFS", 
        "'.WFS_SERVER_URL.'", 
        { 
          request: "GetFeature", 
          propertyName:
"nid,node_title,node_teaser,node_url,markertype,geom_point", 
          typename: "Wanderatlas:wfs_view_tracks", 
          maxfeatures: 99 
        }, 
        { 
          extractAttributes: "true", 
          projection: new OpenLayers.Projection("EPSG:4326"), 
          styleMap: testStyle 
        }); 

The new clustering one looks like this: 

  var tracksLayer = new OpenLayers.Layer.Vector("Wanderungen", { 
      strategies: [ 
        new OpenLayers.Strategy.BBOX({layer: tracksLayer}), 
        //new OpenLayers.Strategy.Cluster({distance: 35, threshold: 3}) 
      ], 
      protocol: new OpenLayers.Protocol.HTTP({ 
        url: "'.WFS_SERVER_URL.'", 
        params: { 
          format: "WFS", 
          service: "WFS", 
          request: "GetFeature", 
          srs: "EPSG:4326", 
          version: "1.0.0", 
          typename: "Wanderatlas:wfs_view_tracks", 
          featureNS: "wam", 
       maxfeatures: 99 
      }, 
       format: new OpenLayers.Format.GML(), 
      }), 
      projection: new OpenLayers.Projection("EPSG:4326"), 
      styleMap:new OpenLayers.StyleMap({"default": trackStyle}) 
    }); 

This even works but does not show all features on map when moving anz
zooming around. I activate both layers on the same map and the second
approach only shows around 70% of the markers that the "real" WFS request
does. I set maxFeatures for both layers the same, 99 in this case. May it be
that some features are outside the visible map and the second approach
request the features other way of ordering or something. 

I tried to higher maxFeatures in the request (higher than available number
of all markers) and now all markers appear. So it's likely that the
Layer.Vector() approach together with Strategy.BBOX() does not send a new
BBOX request on move or zoom of the map. So far so good, but how to fix
that. 


Thanks and cheers 
bzrudi

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/BBOX-Strategy-not-updating-on-move-or-zoom-tp7119260p7119260.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list