[OpenLayers-Users] non-zooming overviewmap

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Wed Jan 3 12:22:16 EST 2007


Hi Tim,

thanks for the elaborate answer, very helpful.

I tested your approaches, and I got the best results with always 
returning true in the isSuitableOverview function.

When I used numZoomLevels=1 the overview map does not zoom, but it does 
recenter sometimes, which is also unwanted, at least for my use case.

Another slightly related question, how do I update the overview map? 
When I call a mergeNewParams (to update the SLD_BODY parameter to show a 
selection in the keymap) on the layer which is in the overview map, the 
overview map does not update. It only updates after a zoom or pan in the 
main map. How can I trigger an update/drawing event in the keymap? I was 
unsuccessful so far with everything I tried.

Thanks again.

Best regards,
Bart

Tim Schaub schreef:
> Hey-
>
>   
>> how can I get the overviewmap to not zoom in or out? Is this 
>> possible using certain values for minRatio and maxRatio? I 
>> couldn't figure it out ...
>>     
>
> You can get at this in a number of ways.  Just as you could limit the number
> of zoom levels of a regular map, you can limit the number of zoom levels of
> your overview map's map:
>
>   var options = {mapOptions: {numZoomLevels: 1}};
>   map.addControl(OpenLayers.Control.OverviewMap(options));
>
> Note that in this case you might want to use an image layer for your
> overview map's base layer.  This also requires the latest from SVN (or just
> update OverviewMap.js [1]).
>
> You can also hack the min/max ratios:
>
>   var options = {minRatio: 0, maxRatio: Number.POSITIVE_INFINITY};
>   map.addControl(new OpenLayers.Control.OverviewMap(options));
>
> But this isn't really as safe as making the isSuitableOverview function
> always return true:
>
>   var options = {isSuitableOverview: function() {return true;}};
>   map.addControl(new OpenLayers.Control.OverviewMap(options));
>   
> The first is really the best way.  I've updated the wiki to show this
> example.
>
> Tim
>
>
> [1]
> http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Control/O
> verviewMap.js?format=raw
>
> [2] http://trac.openlayers.org/wiki/Control/OverviewMap
>
>
>   
>> For now I always return true in the isSuitableOverview 
>> function, but that's just a hack.
>>
>> Thanks in advance.
>>
>> Best regards,
>> Bart
>>  
>>     
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
>   


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl




More information about the Users mailing list