[OpenLayers-Users] overviewmap outside of map viewport

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


> But I can't get the overviewmap to be outside of the map 
> viewport though.
> 
> I tried to make a div in my HTML page with the id of 
> 'overviewmap', and then use this in the constructor:

You can add the overview map somewhere outside the viewport by sending a DOM
element as the div property of the constructor's options.  So:

  // assuming you have an element with an id of 'overviewmap'
  var options = {div: $('overviewmap')};
  map.addControl(new OpenLayers.Control.OverviewMap(options));

I've added this example to the wiki page for the overview map [1].

Also, once you've added the control to an element outside the map viewport,
you'll be responsible for styling it.  You can do this by editing the
theme/default/style.css file.  If you'd like a bit more flexibility in
adding CSS declarations (like adding them to your HTML markup or linking
them from another file) add a comment to ticket #460 [2].

Hope that helps,
Tim

[1] http://trac.openlayers.org/wiki/Control/OverviewMap
[2] http://trac.openlayers.org/ticket/460




More information about the Users mailing list