Hi
I am trying to add a feature to my website to allow users to bookmark
the displayed map - since I retrieve all the information to populate
the map using AJAX if a user simply bookmarks the page when they use
the bookmark they will get the original map that I loaded - but not
any changes they made (pan, zoom, changing content etc)
So I have added code to save a bookmark - of course all browsers are
different.
When the user asks to save a bookmark I get eh current map bounds and
the current center point using getCenter and encode these in the URL I
generate.
When I then use the saved bookmark the map is shifted slightly north.
For example, I call setCenter with a point of
'-27.15537814788223','133.59375'.
When I get the map back and do getCenter it returns the same values -
but if I check the map latitudes north is -15.368949896534692 and
south is -37.78808138412046 which means the centre latitude is
actually -26.578515640327577 - so the map has moved slightly. The
longitude is fine!
Seems to happen on all browsers - any clues?
Here is my function
function setCentre(point,zoom)
{
logit("setCentre");
// Must remove event handler whislt we zoom else it will loop!
removeMapListeners();
logit("setCentre ",point.lat(),point.lng(),zoom)
g_map.setCenter(point,zoom);
logit("AFTER SET
CENTRE",g_map.getBounds().getNorthEast().lat(),g_map.getBounds().getSouthWest().lat(),g_map.getBounds().getNorthEast().lng(),g_map.getBounds().getSouthWest().lng());
logit(g_map.getCenter().lat(),g_map.getCenter().lng(),
(g_map.getBounds().getNorthEast().lat()
+g_map.getBounds().getSouthWest().lat())/2);
g_map.checkResize();
logit("AFTER
Resize",g_map.getBounds().getNorthEast().lat(),g_map.getBounds().getSouthWest().lat(),g_map.getBounds().getNorthEast().lng(),g_map.getBounds().getSouthWest().lng());
logit(g_map.getCenter().lat(),g_map.getCenter().lng(),
(g_map.getBounds().getNorthEast().lat()
+g_map.getBounds().getSouthWest().lat())/2);
setMapListeners();
}
And here is the logfile output
'setCentre'
'setCentre ','-27.15537814788223','133.59375','5'
'AFTER SET
CENTRE','-15.368949896534692','-37.78808138412046','147.568359375','119.61914062500001'
'-27.15537814788223','133.59375','-26.578515640327577'
'AFTER
Resize','-15.368949896534692','-37.78808138412046','147.568359375','119.61914062500001'
'-27.15537814788223','133.59375','-26.578515640327577'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---