Select to view content in your preferred language

Map zooms to full extent after selecting basemap from basemap gallery

2012
2
03-20-2014 09:42 AM
MorganDavison
Deactivated User
Does anyone else have the issue, when you change the basemap using the basemap gallery, the map zooms out to the full extent. 
Testing using the ESRI basemap gallery, if you zoom to Auckland New Zealand and change the basemap you will be pushed to the full extent. 

If you get close to the equator or move into the northern hemisphere it works.  I have noticed it is sporadic and sometimes works
(stays at the correct extent), but most of the time not.  Is there a work around for this issue?  I have tested in IE11 and Chrome.
0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor
I tried it also and experienced the same issue also. It seems to happen more frequently when the map's initial extent is set east of the international data line, then moved to the west side of the line. Again, it doesn't always happen though. I set this up as an example. Pan over to New Zealand and change the basemap/
0 Kudos
JohnGravois
Deactivated User
i had a hunch this has something to do with a failure normalizing geometries and sure enough saw errors when panning ken's sample application across the dateline after adding the code below...

var gs = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
...
map.on("extent-change", function () {
    normalizeUtils.normalizeCentralMeridian([map.extent], gs, normalizeCallback);                
});

function normalizeCallback(result) {
    map.extent = result[0];
}

>>>Uncaught TypeError: Object [object Object] has no method 'getWidth'

ill dig in deeper and let you know what i find.
0 Kudos