Paul -
I figured out how to do this by browsing/asking the Google Maps forums...
But essentially you need to extend the bounds of the map to include all your
markers. A rough sketch would be: (My markers have tabs... but you should
get the point..)
First -setup the bounds:
// ==== It is necessary to make a setCenter call of some description
before adding markers ====
// ==== At this point we dont know the real values ====
map.setCenter(new GLatLng(0,0),0);
// ===== Start with an empty GLatLngBounds object =====
var bounds = new GLatLngBounds();
Then for every Marker - extend the bounds to include the point:
var point = new GLatLng(#ThisLat#,#ThisLong#);
var marker = createMarker(point,
"homeIcon",
"Your
Location",
"<strong>Your Location</strong>",
"This is
the<br>location You Entered.",
"Nothing",
"Address",
"Special")
map.addOverlay(marker);
// ==== Each time a point is found, extent the bounds auto
include it =====
bounds.extend(point);
When all points are made - Set Bounds:
// ===== determine the zoom level from the bounds =====
map.setZoom(map.getBoundsZoomLevel(bounds));
// ===== determine the centre from the bounds ======
map.setCenter(bounds.getCenter());
- Nick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330666
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4