[OpenLayers-Users] IE strategies

Ivan Grcic igrcic at gmail.com
Sat Jan 10 04:48:51 EST 2009


Hi, setting dynamical ratio has proven quite usefull to me...something like:

var strategyBBOX = new OpenLayers.Strategy.BBOX({ratio:1.4});

map.events.register('zoomend', map, function(e){
            zoom = map.getZoom();
//calculating ratio depending on zoomlevel, based on what u need
            var ratio = zoom/4.0+0.75;
            if(ratio<1.4)ratio = 1.4;

           //im not sure which one has to be set excatly
            strategyBBOX.options.ratio=ratio;
            strategyBBOX.ratio=ratio;
....
....
hope it helps,
ivan

On Fri, Jan 9, 2009 at 11:52 PM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> Yves Moisan wrote:
>>> My bad. It should read
>>> new OpenLayers.Strategy.BBOX({invalidBounds: function(){return true;}})
>>
>> Well, I was dumb enough to stick it in the Cluster() strategy of my
>> 2-strategy layer on my side of the story :-(.  At any rate, I can
>> confirm that an XHR is done on zoom in now.
>>
>> I still have issues though.  One peculiar thing is that for some reason
>> the BBOX issued by OL to the server is consistenly larger than the one
>> specified in map.zoomToExtent.  Here are numbers (HTML =
>> map.zoomToExtent(new OpenLayers.Bounds()); and "Output BBOX" is sent out
>> to the server) :
>
> See the ratio property of the BBOX strategy. You may want to set it to 1
> (the default is 2, which means it will request a bbox twice as large as
> the viewport).
>
>> There are also issues with the masfeatures parameter : a small number of
>> maxfeatures might bring in less features than maxfeatures even though
>> the number of features definitely is more than maxfeatures.  To
>> illustrate results comparing BBOX alone and Cluster, see :
>>
>> http://www.flickr.com/photos/30818159@N05/3182451399/ shows BBOX +
>> Cluster (maxFeatures = 200) on the left and BBOX alone on the right.
>> Both return 101 features.  Good
>>
>> http://www.flickr.com/photos/30818159@N05/3182451587/ shows BBOX +
>> Cluster maxFeatures = 200 on the left (results in 101 features) and
>> maxFeatures = 10 on the right (results in 9 features ???).  There
>> clearly should be 10 features returned.
>
> This obviously has to do with the ratio property mentioned above:
> maxFeatures applies to the bbox requested from the server, which is
> twice as large as the visible viewport (if using the default ratio of 2).
>
> Regards,
> Andreas.
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list