[OpenLayers-Users] google overviewmap southeast shift problem

Max Weidemann max.weidemann at freenet.de
Fri Feb 5 06:44:22 EST 2010


Hello List,

I think i have found a bug in the OverviewMap Control.
I have a map with an GoogleLayer and an overviewmap which also should
display an Google Layer.
When i open the overview Control the center in the overwiew is not on the
correct position. It is shifted in southeast direction depending on the
zoomlevel.
I wrote a little test case and found out that when i call the
maximizeControl function before i set the center of the map the center on
the overviewmap is on the correct Position.
I will keep on investigating this problem, but if this is an known bug and
there is an solution for this problem i would be happy to hear it!!!

cheers 
Max

---->here is my test case:
<html>
    <head>
        <title>Overview Map Example</title>
        <link rel="stylesheet"
href="./gmf/js/ol_lib/theme/default/style.css" type="text/css" />
        <link rel="stylesheet" href="style.css" type="text/css" />
        <script
src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAdbUrZn-zg6d_GCxwRb2KbRTwM0brOpm-All5BF6PoaKBxRWWERT5gA91J_-6aaItaVZ1CcjRBPI32w'></script>
        <script src="./gmf/js/ol_lib/lib/OpenLayers.js"
type="text/javascript"></script>
        <style>
        #map1 {
            width: 500px;
            height: 300px;
            border: 1px solid gray;
        }
        #map2 {
            width: 500px;
            height: 300px;
            border: 1px solid gray;
        }
        </style>
    </head>

    <body>
        <h1 id="title">Overview Map</h1>

        <div id="map2"></div>


        <script defer="defer" type="text/javascript"><!--


        var gphy = new OpenLayers.Layer.Google(
                "Google Physical",
                {type: G_PHYSICAL_MAP,
                 'sphericalMercator': true
              });

        var overviewLayer = new OpenLayers.Layer.Google("Google Physical",{
                type:G_PHYSICAL_MAP,
                'sphericalMercator': true,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                    20037508, 20037508.34)
              });

        var mapOptions = {
                projection: "EPSG:900913",
                displayProjection: "EPSG:4326",
                units: "m",
                numZoomLevels: 18,
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                                 20037508, 20037508.34)
              };
        var overviewOptions = {
                layers: [overviewLayer],
                projection: "EPSG:900913",
                units: "m"
              };

;

        var overview = new OpenLayers.Control.OverviewMap(overviewOptions);
        var map2 = new OpenLayers.Map('map2', mapOptions);

        map2.addLayers([gphy]);
        map2.addControl(overview);
        overview.maximizeControl();
        map2.setCenter(new OpenLayers.LonLat(100,0), 4);
        overview.minimizeControl();

        --></script>
    </body>
</html>
-- 
View this message in context: http://n2.nabble.com/google-overviewmap-southeast-shift-problem-tp4519468p4519468.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list