[OpenLayers-Users] zoomToExtent() and zoomToMaxExtent() not working
in polar stereographic projection
Jon Blower
jdb at mail.nerc-essc.ac.uk
Tue May 13 09:06:52 EDT 2008
Dear all,
(This is essentially a re-posting of an earlier post, to which I had
no response. This is now posted under a more relevant subject line.)
I have an application in which the user can change the base layer.
Base layers might have different map projections and so I am trying to
set the projection and maxExtent of the Map object based on the new
base layer. I have registered an event handler for
map.changebaselayer that looks like this:
function baseLayerChanged(event)
{
// Change the parameters of the map based on the new base layer
map.setOptions({
projection: projCode,
maxExtent: map.baseLayer.maxExtent
});
map.zoomToMaxExtent();
}
The base layers are set up with different projections (one in
EPSG:4326, the other in EPSG:32661, which is north polar
stereographic). Logging reveals that, when switching to EPSG:32661,
the maxExtent of the map is being set correctly *but* the true extent
of the map after the call to zoomToMaxExtent() is not correct:
max extent of map: -10700000, -10700000, 14700000, 14700000
actual extent of map after call to zoomToMaxExtent: 1999640,
1999718.75, 2000360, 2000281.25
hence the map is only covering a very small portion of the true
maximum extent. Are there other parameters that I should be setting
on the base map? I am not setting resolution, minExtent or zoom
levels explicitly anywhere in my code.
The same thing happens if I call zoomToExtent() and pass in the
bounding box explicitly.
Thanks in advance,
Jon
--
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: jdb at mail.nerc-essc.ac.uk
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
More information about the Users
mailing list