[Users] Can't set center with mappanel

Andrew Stewart Andrew.Stewart at reddeer.ca
Wed Dec 1 23:25:27 CET 2010


I have a map created within a map panel.. My map is defined like so -

//Create Map
    map = new OpenLayers.Map('map',{controls: [],
    maxExtent: new OpenLayers.Bounds(-3508.86612616335,5778517.56154675,33162.5587151875,5808814.49155551),
    maxResolution: 'auto',
    numZoomLevels: 20,
    units: 'm',
    projection: new OpenLayers.Projection("EPSG:3776"),
    displayProjection: new OpenLayers.Projection("EPSG:4326")
    });


        //Define Map Longitude/Latitude and Start zoom levels
        startupLat = 52.27210;
        startupLon = -113.80288;
        startupLevel = 12;
        lonLat = new OpenLayers.LonLat(startupLon,startupLat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());



  //Define MapPanel
                mapPanel = new GeoExt.MapPanel({
                collapsed: false,
                height: 900,
                map: map,
                center: lonLat,
                zoom: startupLevel,
                tbar: toolbarItems
                });

Except no matter what I do the center of the map is not the coordinates I put in but just remains the same at every zoom level. Even if I put the statement
map.setCenter(new OpenLayers.LonLat(17.99,59.3),11);

At the very end of my code only the zoom level of the map is modified but the variables for lon/lat under my map are the same.. How can I actually change this so I can modify the center to be actually the center? (for some reason it is to the left of the center). Appreciate any assistance.






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101201/555ca044/attachment.htm 


More information about the Users mailing list