[OpenLayers-Dev] Control outside map (re #445)

Tim Schaub noreply at geocartic.com
Wed Jan 17 15:16:06 EST 2007


In case anybody else is searching for the syntax to add the Overview Map
control outside of the viewport, see
http://trac.openlayers.org/wiki/Control/OverviewMap#Customlayout
 
Tim
 



  _____  

From: dev-bounces at openlayers.org [mailto:dev-bounces at openlayers.org] On
Behalf Of Ludwig Max Brinckmann
Sent: Wednesday, January 17, 2007 3:05 AM
To: dev at openlayers.org
Subject: [OpenLayers-Dev] Control outside map (re #445)


Ticket #445 promises a way of easily putting controls outside the main map
-- a great help if there is more than just very simple mouse interaction
since that seems to confuse many browsers.

The way I understand it, to utilise this one, I have to pass in the id of
the div where the control is supposed to be located when creating the
control, such as 

        overview = new OpenLayers.Control.OverviewMap({div : 'controls'});
        map.addControl(overview);

However, when running this it gives me the following exception:


Error: this.div.appendChild is not a function
Source File:
http://localhost/javascripts/openlayers/lib/OpenLayers/Control/OverviewMap.j
s
<http://localhost/javascripts/openlayers/lib/OpenLayers/Control/OverviewMap.
js> 
Line: 117


Is there a working example (with current svn head) someone could point me
to? I am actually not that keen on this particular control, I am looking for
a working starting point for my own control, so any control would do. 

Ludwig

The full script:
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
        #map { 
            width: 80%;
            height: 100%;
        top: 0;
            left: 0;
            position: absolute;
        }
        #controls {
            width: 20%;
            position: absolute; 
            top: 0;
            right: 0;
            height: 100%;
        }
    </style>

    <script src="/javascripts/openlayers/lib/OpenLayers.js"></script>

    <script type="text/javascript"> 
        <!--
        function init(){
            var map = new OpenLayers.Map('map');
        boundary = new OpenLayers.Layer.WMS.Untiled('Boundary', 
        "  <http://localhost/cgi-bin/yunnanserver?>
http://localhost/cgi-bin/yunnanserver?", {layers: "Watersheds",
            transparent: "false", format:"image/png" } );
        boundary.setVisibility(true);
            map.addLayers ([boundary]);
        overview = new OpenLayers.Control.OverviewMap({div : 'controls'});
        map.addControl(overview);
        bounds = new OpenLayers.Bounds(-180,-90,180,90);
        map.zoomToExtent (bounds);
        }
    </script>
  </head>
  <body onload="init()">
    <div id="controls"></div>
    <div id="map"></div>
  </body> 
</html>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20070117/4db8eee9/attachment.html


More information about the Dev mailing list