Hi group, thanks for reading my post.
I am having trouble centering the map on the world - this sounds like
a really silly question, but I am not a complete noob, just that in
this instance the map refuses to center properly on the whole world:
http://360cities.net:4000/search
(under advanced search)
Here is how I am building the map:
function initMap() {
if( ! GBrowserIsCompatible() )
return;
$map = $('#map_canvas');
map = new GMap2( $map[0], {
mapTypes: [
G_NORMAL_MAP,
G_SATELLITE_MAP,
G_HYBRID_MAP
]
});
geocoder = new GClientGeocoder();
map.addControl( new GMapTypeControl() );
map.addControl( new GLargeMapControl() );
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.enableScrollWheelZoom();
//var point = new GLatLng(45, 19);
//map.setCenter(point, 1);
GEvent.addListener( map, 'moveend', function() {
log( map.getCenter(), map.getZoom() );
});
GEvent.addListener( map, 'zoomend', function() {
});
resetMap();
var bounds = map.getBounds();
resetBounds = bounds;
var ne = bounds.getNorthEast(), sw =
bounds.getSouthWest();
var n = ne.lat(), s = sw.lat(), e = ne.lng(), w
= sw.lng();
var ns = Math.abs( n - s ), ew = Math.abs( e -
w );
defaultBounds = new Object();
defaultBounds.n - n;
defaultBounds.s = s;
defaultBounds.e = e;
defaultBounds.w = w;
createIcons();
}
My reset map function:
function resetMap()
{
var lLat = 45;
var lLon = 19;
var lastMapPos = new GLatLng(lLat, lLon);
map.setCenter(lastMapPos, 1, G_NORMAL_MAP);
}
And when I show the advanced search panel, I am calling map.checkResize
() though the panel does not change size, only it's grandparent is
shown.
I am using jquery to show/hide the panel, and the full js file is
here:
http://360cities.net:4000/javascripts/search.js
If someone could take a look and suggest why the map is not centering
I would really appreciate it - I tried centering the map on
google.com and using those lat/lng co-ords, but it is always below
where it should be - perhaps it is something in my CSS?
Any help appreciated...
Thanks
J
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---