Hi.
I've run into problems on a map that i'm developing - wherever the map
uses the getBounds() method it's behaving with unpredictable
results...
Here's the map:
http://tinyurl.com/6xwq8lr
I'm using getBounds() to:
Pan the map to keep my custom overlay (infowindow) in view.
Remove markers not within the map bounds (plus a bit of padding).
Pan the map to display search for results if not already visible.
Display the number of markers within the map bounds.
Occasionally the map functions as expected but more often than not it
doesn't and i've traced the error to the coordinates returned by
getBounds().
I searched the group and found mention that getBounds() will not
return a value until the map has completely initialised, if the map is
not initialised then getBounds() will return null or undefined.
getBounds() is not returning null or undefined on my map - it's
returning completely inaccurate values for both south-west and north-
east coordinates.
(The debug messages will appear in Firefox console if available
otherwise a div will appear under the map containing the debug
messages).
If you load the map then click on any marker and wait 30 seconds for
the map to update now look at the debug message, for example:
debug #1: ((50.818888445280834, -179.1225677030487),
(85.10135175789982, 0.5780744218750122)) | (51.4782, -0.19447)
That's generated on line 352 in this file:
http://tinyurl.com/6f7m9p4
Lines 331 to 337 of that same file also add a marker to the map at the
south-west and north-east coords returned by getBounds().
If you now zoom the map right out you'll be able to see those markers.
The debug message is the mapBounds() south-west and north-east
coordinates followed by the marker latLng that i need to test is
within the map bounds.
The other places in the map code where getBounds() is used also return
unpredictable coordinates - but i haven't added any debug messages
there (yet).
What's going wrong?
Martin.