This helped; however, now I have a new problem. Since I added the
bounds() only 1 marker is being added to the map even though there are
multiple markers in the script. I'm using PHP to pull the data from an
array. There are quite a few markers, I have removed the majority of
them to save space, since it's just replication. Please have a look
and let me know.
<script>
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(0,0),0);
function createMarker(point, text, title) {
var marker = new GMarker(point,{title:title});
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(text);
});
return marker;
}
var bounds = new GLatLngBounds();
var marker = createMarker(
new GLatLng(41.913697,-87.662468),
'Joe Pug plus The Blueheels',
'Joe Pug plus The Blueheels');
map.addOverlay(marker);
bounds.extend(point);
var marker = createMarker(
new GLatLng(39.1619,-84.4569),
'PugFair 2008',
'PugFair 2008');
map.addOverlay(marker);
bounds.extend(point);
map.setZoom(map.getBoundsZoomLevel(bounds));
map.setCenter(bounds.getCenter());
}
else {
alert("Sorry, the Google Maps API is not compatible with this
browser");
}
}
On Oct 2, 4:46 pm, "warden [Andrew Leach - Maps API Guru]"
<[EMAIL PROTECTED]> wrote:
> On Oct 2, 8:46 pm, kenjo <[EMAIL PROTECTED]> wrote:
>
>
>
> > How can this be done?
>
> http://econym.org.uk/gmap/-- The Basics, part 14: Fitting the map to
> the data
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---