[OpenLayers-Users] IE strategies
Andreas Hocevar
ahocevar at opengeo.org
Thu Jan 8 18:14:06 EST 2009
Yves Moisan wrote:
> Here's my vector layer :
>
> pts_gps = new OpenLayers.Layer.Vector("GeoJSON", {
> strategies: [new OpenLayers.Strategy.BBOX(),new
> OpenLayers.Strategy.Cluster()],
> protocol: new OpenLayers.Protocol.HTTP({
> url: "http://myserver:8080/PGTEST4326/all.json",
> format: new OpenLayers.Format.GeoJSON(),
> params:{maxfeatures: 100}
> }),
> format: new OpenLayers.Format.GeoJSON(),
> styleMap: new OpenLayers.StyleMap({
> "default": style,
> "select": {
> fillColor: "#8aeeef",
> strokeColor: "#32a8a9"
> }
> })
> });
>
This looks perfectly sane.
> To illustrate what I was saying in the previous email, here's a bunch of
> screenshots :
>
> maxFeatures= 1000 :
> http://www.flickr.com/photos/30818159@N05/3180683492/
>
> maxFeatures= 1000, zoomed in :
> http://www.flickr.com/photos/30818159@N05/3179845579/
>
> maxFeatures= 5 : http://www.flickr.com/photos/30818159@N05/3180683598/
>
> maxFeatures= 5, zoomed in :
> http://www.flickr.com/photos/30818159@N05/3179845687/
>
> The first level of zoom is the same for both maxFeature values. Zooming
> in mean I hit the + sign on the OL control once. You can see (well
> almost) that when I zoom in with maxFeature = 5, i get *3* clusters each
> worth 1 feature. It is clear from the zoomed in example with
> maxFeatures = 1000 that there *are* more than 3 features at that zoom
> level so I was expecting to see 5 features spread into N <= 5 clusters
> so something is wrong there. If I zoom into the top right portion of my
> zoomed out window, I see no feature. The same rubberband zoom with
> maxFeatures = 1000 gives me some features ??
>
> I saw a thread explaining the issue but I don't remember where. I will
> investigate further and report if I find an explanation.
>
You are probably referring to
http://n2.nabble.com/bbox-strategy-and-zooming-td1836240.html#a20489423
New features will only be fetched if you zoom out, not if you zoom in. I
had forgotten about this thread in my previous reply, sorry for the
confusion.
You can make the BBOX strategy aggressive by instantiating your BBOX
strategy like this:
new OpenLayers.Strategy.BBOX(invalidBounds: function(){return true;});
This will cause features to be fetched also if you zoom in.
Regards,
Andreas.
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list