[OpenLayers-Users] non-zooming overviewmap
Tim Schaub
noreply at geocartic.com
Tue Jan 2 13:13:46 EST 2007
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
>
More information about the Users
mailing list