[OpenLayers-Users] non-zooming overviewmap

Tim Schaub noreply at geocartic.com
Wed Jan 3 14:19:19 EST 2007


> 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.

If you assign the overview map control to a variable when you construct it
(overview), then you can get at the overview's map with:

  overview.ovmap

To merge new parameters to the base layer of the overview map, I would do:

  overview.ovmap.baseLayer.mergeNewParams()

It sounds like you're doing something like this, but it's not working.  It
should - so write back if it actually isn't.  If you don't send your
overview map control any layers when you construct it, then it will clone
the main map's base layer - so it is not enough to merge new params on the
main map's base layer.

Also, to force a redraw of a layer, you can always try something like:

  overview.ovmap.baseLayer.moveTo(null, true)

There may be another way to force a redraw, but this one works.

Also, regarding the overview map recentering itself - if it bugs you that it
recenters itself in a way that shows more than what you specified in
maxExtent, add a comment to ticket #340
(http://trac.openlayers.org/ticket/340).  The overview's map is just like
any other map.  Currently, all maps can be panned beyond the max extent.
This ticket is supposed to be a place for discussion on the issue.

Tim


> 
> 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/Con
> > trol/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
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 




More information about the Users mailing list