Hi,

when i'm trying to set the center and zoom-level via the setCenter-method, i get back an image of the whole world. I have no idea, why it doesn't apply the setting.
The strange thing is, i can see the right extent for a short time, but before rendering is finished, it changes to the whole world and stays like this.
What am i missing?

Here is my code for the map-creation:

var createMap = function(overlay, opacity){
    
    var center = new OpenLayers.LonLat(844774, 6033921);
    
    var options = {
            projection: new OpenLayers.Projection("EPSG:900913"),
            displayProjection: new OpenLayers.Projection("EPSG:900913"),
            units: "m",
            numZoomLevels: 25,
            maxResolution: 156543.0339,
            maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                             20037508, 20037508.34),
            controls: [new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.MousePosition()]
    };

    var map = new OpenLayers.Map(options);
    
    var google = new OpenLayers.Layer.Google(
            "Google",
            {'sphericalMercator': true}
    );
    
    var OSM = new OpenLayers.Layer.OSM("OSM");
    
    var google_t = new OpenLayers.Layer.Google(
                "Google_Terrain",
                {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
    );
    
    map.addLayers([OSM, google_t, google]);
    
    google.setOpacity(opacity);
    google_t.setOpacity(opacity);
    OSM.setOpacity(opacity);
    
    map.setCenter(center, 15);
    
    if (overlay){
        map.addLayer(overlay);
    }
    
   
    return map;
    
};


Thanks for any help
Dirk.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to