Hello,
I am using the Google Maps V3 API and have my map working.
Basically I want a few markers to be shown at ever zoom level.
Then from zoom level 8 onwards I want more markers to be added.
I know it can be done using the Google Maps Marker Manager but I really cannot get it to work.
Please can someone have a look and try to give me a hand:
// Set up map on home index page
if ($('body').hasClass('home')) {
// Define map centre as world over view
var worldCenter = new google.maps.LatLng(33.4, -5);
// Set up homeMap options
var homeMapOptions = {
scrollwheel: false,
zoom: 2,
center: worldCenter,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
// Display map on page
var homeMap = new google.maps.Map($('.home .map')[0], homeMapOptions);
// Set up a markerManager and apply it to the homeMap
var mgr = new MarkerManager(homeMap);
//Show all Parks as markers on homeMap
// Make json request and run a function with all parks in the parks object
$.getJSON('parks.json', function(parks) {
// Set up an infoWindow
var infoWindow;
// For each park...
$.each(parks, function(key, park) {
// Set a location variable
latlng = new google.maps.LatLng(park.lat, park.long);
// Create a marker for the current park and put it on the map
var marker = new google.maps.Marker({
position: latlng,
map: homeMap,
title: park.name
})
// Add the current marker to the marker manager with a minimum zoom level of 5
mgr.addMarker(marker, 2);
// Refresh the marker manager
mgr.refresh();
});
});
Currently, no markers even appear on the map.
Please help