[Users] Can't set center with mappanel
Andrew Stewart
Andrew.Stewart at reddeer.ca
Thu Dec 2 00:03:12 CET 2010
My mistake.. apparently I was not declaring the lonLat variable properly. I just changed it around to be
var lonlat2 = new OpenLayers.LonLat(numbers);
map.setCenter(lonLat2,startupLevel);
and this worked.
________________________________
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf Of Andrew Stewart
Sent: December 01, 2010 3:25 PM
To: users at geoext.org
Subject: [Users] Can't set center with mappanel
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.
________________________________
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
________________________________
[This message has been scanned for security content threats and viruses.]
[The City of Red Deer I.T. Services asks that you please consider the environment before printing this e-mail.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101201/7532607b/attachment.htm
More information about the Users
mailing list