[OpenLayers-Users] Overview Map Question

Robert Buzink post at robertbuzink.nl
Tue Jan 9 15:38:37 EST 2007


hi Tim,

Thanks for the debugging. I know about the adding layers at once. I have
been writing a php class for openlayers. I first added layers to an array
every time a baselayer-var was defined and then outputed the array in an
addlayer-statement at the end of the map, but noticed that openlayers is a
bit picky about the order of statements (adding controls, adding baselayers,
setting center, etc.), so I made it more modular and less
beautiful/efficient.

This shows no overviewmap control at all:

<html>
    <head>
        <title>Test</title>
        <style type="text/css">
            #map {
                width: 512px;
                height: 512px;
                border: 1px solid gray;
            }
        </style>
        <script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js
" type="text/javascript"></script>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    </head>
    <body>
        <div id="map"></div>
        <script defer="defer" type="text/javascript">
            var map = new OpenLayers.Map('map');
        var virtualearth = new OpenLayers.Layer.VirtualEarth(
        "VirtualEarth");
            var metacarta = new OpenLayers.Layer.WMS(
                "Metacarta",
                " http://labs.metacarta.com/wms/vmap0",
                {layers: 'basic'});
            map.addLayers([virtualearth,metacarta]);
            map.addControl (new OpenLayers.Control.OverviewMap());
            map.setCenter(new OpenLayers.LonLat(5.69, 50.85), 15);
        </script>
    </body>
</html>

This creates weird behaviour (1. overviewmap-control, but no overview-map.
2. mouse keeps dragging):

<html>
    <head>
        <title>Test</title>
        <style type="text/css">
            #map {
                width: 512px;
                height: 512px;
                border: 1px solid gray;
            }
        </style>
        <script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js
" type="text/javascript"></script>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAmbYSvchg-WUKZ1VciMUQehT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTM_U0Wb-HnwWqFxi6YDlhfBryn8w
<http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAmbYSvchg-WUKZ1VciMUQehT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTM_U0Wb-HnwWqFxi6YDlhfBryn8w>"
type="text/javascript"></script>
    </head>
    <body>
        <div id="map"></div>
        <script defer="defer" type="text/javascript">
            var map = new OpenLayers.Map('map');
        var google = new OpenLayers.Layer.Google("Google Map");

            var metacarta = new OpenLayers.Layer.WMS(
                "Metacarta",
                "http://labs.metacarta.com/wms/vmap0",
                {layers: 'basic'});
            map.addLayers([google,metacarta]);
            map.addControl(new OpenLayers.Control.OverviewMap());
            map.setCenter(new OpenLayers.LonLat(5.69, 50.85), 15);
        </script>
    </body>
</html>

As you can see, the problem is the baselayer. Whenever it isn't the(/a?) wms
layer, the overviewmap control breaks. Maybe the overviewmapcontrol should
default to the metacarta wms baselayer?

I don't know much about the inside of the ol-api, I am just using the
excellent bricks you provide to build a php/mysql 'application' that
non-technical users can use and configure. Maybe I could do something back
by releasing the php-class when it is finished (if there isn't released one
already)?

Robert,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070109/d10d90bc/attachment.html


More information about the Users mailing list