I forgot to say, that i use a GeoExt mappanel, in which i put the map. I assume the mappanel config overrides the openlayers-map-config. And since there is no center and zoom set in the panel config, it just shows the whole world. Right?
So is there a way to keep the map-config? Because i want to dynamically change the map-zoom and center, when the user selects a special layer. But the mappanel shouldn't change.

The code for the mappanel (it's part of an ext viewport):


{
                id: 'mapContainer',
                title: 'Karte',
                xtype: 'gx_mappanel',
                map: map,
                border: false,
                region: 'center'
           
}


Cheers
Dirk.



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




_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to