通过复选框在地图上禁用/启用MarkerCluster的选项

时间:2015-01-28 07:01:23

标签: google-maps-api-3 markerclusterer

请您查看This Demo并告诉我是否可以通过选中和取消选中复选框来禁用或启用地图上的Markercluster?

目前我所拥有的是一个使用MarkerCluster插件启用的简单地图,我正在寻找一种方法来启用或禁用此设施,而无需重新绘制地图?

$(document).ready(function () {
    var latlng = new google.maps.LatLng(49.247477, -123.128000);
    var myOptions = {
        zoom: 11,
        center: latlng,
        disableDefaultUI: true,
        scaleControl: true,
        zoomControl: true,
        zoomControlOptions: {
            style: google.maps.ZoomControlStyle.SMALL
        },
        mapTypeControl: true,
        draggableCursor: 'move',
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    locations.length = 0;
    var markers = [];
    for (p = 0; p < data.markers.length; p++) {
        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(data.markers[p].LATITUDE, data.markers[p].LONGITUDE),
            map: map,
            title: "marker " + p
        });
        markers.push(marker);

    }
    var markerCluster = new MarkerClusterer(map, markers);
});

感谢

1 个答案:

答案 0 :(得分:1)

  • 为您的复选框添加ID。
  • 如果选中,请将MarkerClusterer的map属性设置为&#34; map&#34;变量
  • 如果未选中,请将MarkerCluseter的map属性设置为null。

google.maps.event.addDomListener(document.getElementById('cluster'),'click', function() {
    var set;
    if (document.getElementById('cluster').checked) {
        set = map;
    } else { 
        set = null;
    }
    markerCluster.setMap(set);
});

working fiddle

工作代码段:

&#13;
&#13;
var map;
var locations = [];
$(document).ready(function() {
  var latlng = new google.maps.LatLng(49.247477, -123.128000);
  var myOptions = {
    zoom: 11,
    center: latlng,
    disableDefaultUI: true,
    scaleControl: true,
    zoomControl: true,
    zoomControlOptions: {
      style: google.maps.ZoomControlStyle.SMALL
    },
    mapTypeControl: true,
    draggableCursor: 'move',
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  locations.length = 0;
  var markers = [];
  for (p = 0; p < data.markers.length; p++) {
    var marker = new google.maps.Marker({
      position: new google.maps.LatLng(data.markers[p].LATITUDE, data.markers[p].LONGITUDE),
      map: map,
      title: "marker " + p
    });
    markers.push(marker);

  }
  var markerCluster = new MarkerClusterer(map, markers);

  google.maps.event.addDomListener(document.getElementById('cluster'), 'click', function() {
    var set;
    if (document.getElementById('cluster').checked) {
      set = map;
    } else {
      set = null;
    }
    markerCluster.setMap(set);
  });
});
var data = {
  "markers": [{
    "SCHOOL_NAME": "Southlands Elem.",
    "LATITUDE": "49.238137586",
    "LONGITUDE": "-123.19781516",
    "ADDRESS": "5351 Camosun St",
    "URLLINK": "http://www.vsb.bc.ca/schools/southlands"
  }, {
    "SCHOOL_NAME": "Captain James Cook Elem.",
    "LATITUDE": "49.2193808",
    "LONGITUDE": "-123.03582905",
    "ADDRESS": "3340 E 54th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/captain-james-cook"
  }, {
    "SCHOOL_NAME": "Chief Maquinna Elem.",
    "LATITUDE": "49.267886314",
    "LONGITUDE": "-123.05058984",
    "ADDRESS": "2684 E 2nd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/chief-maquinna"
  }, {
    "SCHOOL_NAME": "Oppenheimer Elem.",
    "LATITUDE": "49.2133181112521",
    "LONGITUDE": "-123.058293310213",
    "ADDRESS": "2421 Scarboro Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/david-oppenheimer"
  }, {
    "SCHOOL_NAME": "Sir Charles Kingsford-Smith Elem.",
    "LATITUDE": "49.221596674",
    "LONGITUDE": "-123.0557042",
    "ADDRESS": "6901 Elliott St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-charles-kingsford-smith"
  }, {
    "SCHOOL_NAME": "Carnarvon Elem.",
    "LATITUDE": "49.2565874222733",
    "LONGITUDE": "-123.173557238565",
    "ADDRESS": "3400 Balaclava St",
    "URLLINK": "http://www.vsb.bc.ca/schools/carnarvon"
  }, {
    "SCHOOL_NAME": "Dr. A. R. Lord Elem.",
    "LATITUDE": "49.2796404851544",
    "LONGITUDE": "-123.03951720288",
    "ADDRESS": "555 Lillooet St",
    "URLLINK": "http://www.vsb.bc.ca/schools/dr-ar-lord"
  }, {
    "SCHOOL_NAME": "McKechnie Elem.",
    "LATITUDE": "49.21770659",
    "LONGITUDE": "-123.15401133",
    "ADDRESS": "7455 Maple St",
    "URLLINK": "http://www.vsb.bc.ca/schools/dr-re-mckechnie"
  }, {
    "SCHOOL_NAME": "Waverley Annex",
    "LATITUDE": "49.227837226",
    "LONGITUDE": "-123.05578593",
    "ADDRESS": "6111 Elliott St",
    "URLLINK": "http://www.vsb.bc.ca/schools/waverley"
  }, {
    "SCHOOL_NAME": "Cunningham Elem.",
    "LATITUDE": "49.236732227",
    "LONGITUDE": "-123.05745595",
    "ADDRESS": "2330 E 37th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/george-t-cunningham"
  }, {
    "SCHOOL_NAME": "Nootka Elem.",
    "LATITUDE": "49.253592971",
    "LONGITUDE": "-123.04294917",
    "ADDRESS": "3375 Nootka St",
    "URLLINK": "http://www.vsb.bc.ca/schools/nootka"
  }, {
    "SCHOOL_NAME": "Tecumseh Annex",
    "LATITUDE": "49.237116273",
    "LONGITUDE": "-123.07309884",
    "ADDRESS": "1551 E 37th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/tecumseh-annex"
  }, {
    "SCHOOL_NAME": "Jamieson Elem.",
    "LATITUDE": "49.226906936",
    "LONGITUDE": "-123.12100426",
    "ADDRESS": "6350 Tisdall St",
    "URLLINK": "http://www.vsb.bc.ca/schools/dr-annie-b-jamieson"
  }, {
    "SCHOOL_NAME": "Weir Elem.",
    "LATITUDE": "49.22957876",
    "LONGITUDE": "-123.04440254",
    "ADDRESS": "2900 E 44th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/dr-george-m-weir"
  }, {
    "SCHOOL_NAME": "Henderson Elem.",
    "LATITUDE": "49.222569589",
    "LONGITUDE": "-123.09527169",
    "ADDRESS": "451 E 53rd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/john-henderson"
  }, {
    "SCHOOL_NAME": "Queen Victoria Annex",
    "LATITUDE": "49.26718785",
    "LONGITUDE": "-123.06634874",
    "ADDRESS": "1850 E 3rd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/queen-victoria-grandview-annex"
  }, {
    "SCHOOL_NAME": "McBride Annex",
    "LATITUDE": "49.2419442301445",
    "LONGITUDE": "-123.084950188923",
    "ADDRESS": "4750 St. Catherines St",
    "URLLINK": "http://www.vsb.bc.ca/schools/mcbride-annex"
  }, {
    "SCHOOL_NAME": "King George Sec.",
    "LATITUDE": "49.289824153",
    "LONGITUDE": "-123.13644517",
    "ADDRESS": "1755 Barclay St",
    "URLLINK": "http://www.vsb.bc.ca/schools/king-george"
  }, {
    "SCHOOL_NAME": "Britannia Sec.",
    "LATITUDE": "49.2752359917843",
    "LONGITUDE": "-123.07192309841",
    "ADDRESS": "1001 Cotton Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/britannia-secondary"
  }, {
    "SCHOOL_NAME": "Magee Sec.",
    "LATITUDE": "49.2285538659929",
    "LONGITUDE": "-123.151537987609",
    "ADDRESS": "6360 Maple St",
    "URLLINK": "http://www.vsb.bc.ca/schools/magee"
  }, {
    "SCHOOL_NAME": "Kitsilano Sec.",
    "LATITUDE": "49.262654773",
    "LONGITUDE": "-123.16358941",
    "ADDRESS": "2550 W 10th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/kitsilano"
  }, {
    "SCHOOL_NAME": "John Oliver Sec.",
    "LATITUDE": "49.231957151",
    "LONGITUDE": "-123.09279776",
    "ADDRESS": "530 E 41st Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/john-oliver"
  }, {
    "SCHOOL_NAME": "Lord Byng Sec.",
    "LATITUDE": "49.2595665510185",
    "LONGITUDE": "-123.192530952998",
    "ADDRESS": "3939 W 16th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-byng"
  }, {
    "SCHOOL_NAME": "Templeton Sec.",
    "LATITUDE": "49.278439094",
    "LONGITUDE": "-123.06069106",
    "ADDRESS": "727 Templeton Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/templeton"
  }, {
    "SCHOOL_NAME": "Vancouver Technical Sec.",
    "LATITUDE": "49.260755476",
    "LONGITUDE": "-123.05129984",
    "ADDRESS": "2600 E Broadway",
    "URLLINK": "http://www.vsb.bc.ca/schools/vancouver-technical"
  }, {
    "SCHOOL_NAME": "Point Grey Sec.",
    "LATITUDE": "49.2372792444418",
    "LONGITUDE": "-123.153406112125",
    "ADDRESS": "5350 Eest Boulevard",
    "URLLINK": "http://www.vsb.bc.ca/schools/point-grey"
  }, {
    "SCHOOL_NAME": "Gladstone Sec.",
    "LATITUDE": "49.247612036",
    "LONGITUDE": "-123.06163307",
    "ADDRESS": "4105 Gladstone St",
    "URLLINK": "http://www.vsb.bc.ca/schools/gladstone"
  }, {
    "SCHOOL_NAME": "Sir Winston Churchill Sec.",
    "LATITUDE": "49.221059569",
    "LONGITUDE": "-123.12561546",
    "ADDRESS": "7055 Heather St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-winston-churchill"
  }, {
    "SCHOOL_NAME": "Killarney Sec.",
    "LATITUDE": "49.225300105",
    "LONGITUDE": "-123.04415722",
    "ADDRESS": "6454 Killarney St",
    "URLLINK": "http://www.vsb.bc.ca/schools/killarney"
  }, {
    "SCHOOL_NAME": "Sir Charles Tupper Sec.",
    "LATITUDE": "49.249753502",
    "LONGITUDE": "-123.09480948",
    "ADDRESS": "419 E 24th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-charles-tupper"
  }, {
    "SCHOOL_NAME": "David Thompson Sec.",
    "LATITUDE": "49.220439257",
    "LONGITUDE": "-123.0706316",
    "ADDRESS": "1755 E 55th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/david-thompson"
  }, {
    "SCHOOL_NAME": "Prince Of Wales Sec.",
    "LATITUDE": "49.244983054",
    "LONGITUDE": "-123.15953565",
    "ADDRESS": "2250 Eddington Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/prince-wales"
  }, {
    "SCHOOL_NAME": "Windermere Sec.",
    "LATITUDE": "49.246512457",
    "LONGITUDE": "-123.0371743",
    "ADDRESS": "3155 E 27th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/windermere"
  }, {
    "SCHOOL_NAME": "Eric Hamber Sec.",
    "LATITUDE": "49.239630962",
    "LONGITUDE": "-123.12579096",
    "ADDRESS": "5025 Willow St",
    "URLLINK": "http://www.vsb.bc.ca/"
  }, {
    "SCHOOL_NAME": "University Hill Sec.",
    "LATITUDE": "49.261616",
    "LONGITUDE": "-123.232815",
    "ADDRESS": "2896 Acadia Road",
    "URLLINK": "http://www.vsb.bc.ca/schools/university-hill"
  }, {
    "SCHOOL_NAME": "Lord Strathcona Elem.",
    "LATITUDE": "49.2798115155978",
    "LONGITUDE": "-123.091476792421",
    "ADDRESS": "592 E Pender St",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-strathcona"
  }, {
    "SCHOOL_NAME": "Sir Guy Carleton Elem.",
    "LATITUDE": "49.234347747",
    "LONGITUDE": "-123.03760798",
    "ADDRESS": "3250 Kingsway",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-guy-carleton"
  }, {
    "SCHOOL_NAME": "Lord Roberts Elem.",
    "LATITUDE": "49.286785283",
    "LONGITUDE": "-123.13784476",
    "ADDRESS": "1100 Bidwell St",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-roberts"
  }, {
    "SCHOOL_NAME": "Admiral Seymour Elem.",
    "LATITUDE": "49.27859427",
    "LONGITUDE": "-123.0803143",
    "ADDRESS": "1130 Keefer St",
    "URLLINK": "http://www.vsb.bc.ca/schools/admiral-seymour"
  }, {
    "SCHOOL_NAME": "Macdonald Elem.",
    "LATITUDE": "49.28072391",
    "LONGITUDE": "-123.06467911",
    "ADDRESS": "1950 E Hastings St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-william-macdonald"
  }, {
    "SCHOOL_NAME": "David Lloyd George Elem.",
    "LATITUDE": "49.209962412",
    "LONGITUDE": "-123.13634891",
    "ADDRESS": "8370 Cartier St",
    "URLLINK": "http://www.vsb.bc.ca/schools/david-lloyd-george"
  }, {
    "SCHOOL_NAME": "Brock Elem.",
    "LATITUDE": "49.241215222",
    "LONGITUDE": "-123.10063141",
    "ADDRESS": "4860 Main St",
    "URLLINK": "http://www.vsb.bc.ca/schools/general-brock"
  }, {
    "SCHOOL_NAME": "Kerrisdale Elem.",
    "LATITUDE": "49.236168246",
    "LONGITUDE": "-123.17345921",
    "ADDRESS": "5555 Carnarvon St",
    "URLLINK": "http://www.vsb.bc.ca/schools/kerrisdale"
  }, {
    "SCHOOL_NAME": "Lord Selkirk Elem.",
    "LATITUDE": "49.249691953",
    "LONGITUDE": "-123.06900705",
    "ADDRESS": "1750 E 22nd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-selkirk"
  }, {
    "SCHOOL_NAME": "Nightingale Elem.",
    "LATITUDE": "49.260059325",
    "LONGITUDE": "-123.09371757",
    "ADDRESS": "2740 Guelph St",
    "URLLINK": "http://www.vsb.bc.ca/schools/florence-nightingale"
  }, {
    "SCHOOL_NAME": "Gordon Elem.",
    "LATITUDE": "49.265979903",
    "LONGITUDE": "-123.17067418",
    "ADDRESS": "2896 W 6th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/general-gordon"
  }, {
    "SCHOOL_NAME": "Henry Hudson Elem.",
    "LATITUDE": "49.272245879",
    "LONGITUDE": "-123.14935629",
    "ADDRESS": "1551 Cypress St",
    "URLLINK": "http://www.vsb.bc.ca/schools/henry-hudson"
  }, {
    "SCHOOL_NAME": "Laura Secord Elem.",
    "LATITUDE": "49.261735704",
    "LONGITUDE": "-123.06022338",
    "ADDRESS": "2500 Lakewood Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/laura-secord"
  }, {
    "SCHOOL_NAME": "Walter Moberly Annex",
    "LATITUDE": "49.216109231",
    "LONGITUDE": "-123.08434542",
    "ADDRESS": "1000 E 59th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/walter-moberly"
  }, {
    "SCHOOL_NAME": "Trudeau Elem.",
    "LATITUDE": "49.214454005",
    "LONGITUDE": "-123.096959",
    "ADDRESS": "449 E 62nd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/pierre-elliott-trudeau"
  }, {
    "SCHOOL_NAME": "Van Horne Elem.",
    "LATITUDE": "49.231566487",
    "LONGITUDE": "-123.10656921",
    "ADDRESS": "5855 Ontario St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-william-van-horne"
  }, {
    "SCHOOL_NAME": "Dickens Elem.",
    "LATITUDE": "49.254862561",
    "LONGITUDE": "-123.08294436",
    "ADDRESS": "3351 Glen Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/charles-dickens"
  }, {
    "SCHOOL_NAME": "Livingstone Elem.",
    "LATITUDE": "49.250753337",
    "LONGITUDE": "-123.09798144",
    "ADDRESS": "315 E 23rd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/david-livingstone"
  }, {
    "SCHOOL_NAME": "Hastings Elem.",
    "LATITUDE": "49.2826109608204",
    "LONGITUDE": "-123.050577408683",
    "ADDRESS": "2625 Franklin St",
    "URLLINK": "http://www.vsb.bc.ca/schools/hastings"
  }, {
    "SCHOOL_NAME": "John Norquay Elem.",
    "LATITUDE": "49.241424696",
    "LONGITUDE": "-123.0516408",
    "ADDRESS": "4710 Slocan St",
    "URLLINK": "http://www.vsb.bc.ca/schools/john-norquay"
  }, {
    "SCHOOL_NAME": "Sexsmith Elem.",
    "LATITUDE": "49.217267793",
    "LONGITUDE": "-123.10879442",
    "ADDRESS": "7455 Ontario St",
    "URLLINK": "http://www.vsb.bc.ca/schools/jw-sexsmith"
  }, {
    "SCHOOL_NAME": "Sir James Douglas Elem.",
    "LATITUDE": "49.215594159",
    "LONGITUDE": "-123.06488106",
    "ADDRESS": "7550 Victoria Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-james-douglas"
  }, {
    "SCHOOL_NAME": "Franklin Elem.",
    "LATITUDE": "49.282496197",
    "LONGITUDE": "-123.02758566",
    "ADDRESS": "250 Skeena St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-john-franklin"
  }, {
    "SCHOOL_NAME": "Sir Sandford Fleming Elem.",
    "LATITUDE": "49.22574769",
    "LONGITUDE": "-123.07657409",
    "ADDRESS": "1401 E 49th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-sandford-fleming"
  }, {
    "SCHOOL_NAME": "Bayview Elem.",
    "LATITUDE": "49.266487007",
    "LONGITUDE": "-123.18233379",
    "ADDRESS": "2251 Collingwood St",
    "URLLINK": "http://www.vsb.bc.ca/schools/bayview"
  }, {
    "SCHOOL_NAME": "Lord Beaconsfield Elem.",
    "LATITUDE": "49.252138376",
    "LONGITUDE": "-123.05269627",
    "ADDRESS": "3663 Penticton St",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-beaconsfield"
  }, {
    "SCHOOL_NAME": "Kitchener Elem.",
    "LATITUDE": "49.250583805",
    "LONGITUDE": "-123.17917598",
    "ADDRESS": "4055 Blenheim St",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-kitchener"
  }, {
    "SCHOOL_NAME": "Edith Cavell Elem.",
    "LATITUDE": "49.25290711",
    "LONGITUDE": "-123.11722884",
    "ADDRESS": "500 W 20th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/edith-cavell"
  }, {
    "SCHOOL_NAME": "Shaughnessy Elem.",
    "LATITUDE": "49.248676076",
    "LONGITUDE": "-123.14380998",
    "ADDRESS": "4250 Marguerite St",
    "URLLINK": "http://www.vsb.bc.ca/schools/shaughnessy"
  }, {
    "SCHOOL_NAME": "Begbie Elem.",
    "LATITUDE": "49.2718308007739",
    "LONGITUDE": "-123.038010037124",
    "ADDRESS": "1430 Lillooet St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-matthew-begbie"
  }, {
    "SCHOOL_NAME": "Maple Grove Elem.",
    "LATITUDE": "49.2294087",
    "LONGITUDE": "-123.15151486",
    "ADDRESS": "6199 Cypress St",
    "URLLINK": "http://www.vsb.bc.ca/schools/maple-grove"
  }, {
    "SCHOOL_NAME": "Quilchena Elem.",
    "LATITUDE": "49.237246211",
    "LONGITUDE": "-123.15157081",
    "ADDRESS": "5300 Maple St",
    "URLLINK": "http://www.vsb.bc.ca/schools/quilchena"
  }, {
    "SCHOOL_NAME": "Grandview Elem.",
    "LATITUDE": "49.26619317",
    "LONGITUDE": "-123.0743697",
    "ADDRESS": "2055 Woodland Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/grandview"
  }, {
    "SCHOOL_NAME": "Renfrew Elem.",
    "LATITUDE": "49.251457775",
    "LONGITUDE": "-123.03205805",
    "ADDRESS": "3315 E 22nd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/renfrew"
  }, {
    "SCHOOL_NAME": "Sir Alexander Mackenzie Elem.",
    "LATITUDE": "49.234536436",
    "LONGITUDE": "-123.08671432",
    "ADDRESS": "960 E 39th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-alexander-mackenzie"
  }, {
    "SCHOOL_NAME": "Queen Elizabeth Elem.",
    "LATITUDE": "49.257791773",
    "LONGITUDE": "-123.20112784",
    "ADDRESS": "4102 W 16th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/queen-elizabeth"
  }, {
    "SCHOOL_NAME": "Thunderbird Elem.",
    "LATITUDE": "49.2636488913338",
    "LONGITUDE": "-123.031870585582",
    "ADDRESS": "2325 Cassiar St",
    "URLLINK": "http://www.vsb.bc.ca/schools/thunderbird"
  }, {
    "SCHOOL_NAME": "Trafalgar Elem.",
    "LATITUDE": "49.250178757",
    "LONGITUDE": "-123.16460607",
    "ADDRESS": "4170 Trafalgar St",
    "URLLINK": "http://www.vsb.bc.ca/http://www.vsb.bc.ca/schools/trafalgar"
  }, {
    "SCHOOL_NAME": "Laurier Elem.",
    "LATITUDE": "49.217762535",
    "LONGITUDE": "-123.12504721",
    "ADDRESS": "7350 Laurel St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-wilfred-laurier"
  }, {
    "SCHOOL_NAME": "Sir William Osler Elem.",
    "LATITUDE": "49.230762423",
    "LONGITUDE": "-123.13266216",
    "ADDRESS": "5970 Selkirk St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-william-osler"
  }, {
    "SCHOOL_NAME": "Bruce Elem.",
    "LATITUDE": "49.242069088",
    "LONGITUDE": "-123.02567271",
    "ADDRESS": "3633 Tanner St",
    "URLLINK": "http://www.vsb.bc.ca/schools/graham-d-bruce"
  }, {
    "SCHOOL_NAME": "Queen Elizabeth Annex",
    "LATITUDE": "49.24893678",
    "LONGITUDE": "-123.19469107",
    "ADDRESS": "4275 Crown St",
    "URLLINK": "http://www.vsb.bc.ca/schools/queen-elizabeth-annex"
  }, {
    "SCHOOL_NAME": "Tillicum Annex",
    "LATITUDE": "49.286263456",
    "LONGITUDE": "-123.05559853",
    "ADDRESS": "2450 Cambridge St",
    "URLLINK": "http://www.vsb.bc.ca/schools/tillicum-annex"
  }, {
    "SCHOOL_NAME": "Kerrisdale Annex",
    "LATITUDE": "49.232868",
    "LONGITUDE": "-123.177405",
    "ADDRESS": "3250 W 43rd Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/kerrisdale-annex"
  }, {
    "SCHOOL_NAME": "Lord Selkirk Annex",
    "LATITUDE": "49.245320775",
    "LONGITUDE": "-123.07246012",
    "ADDRESS": "4444 Dumfries St",
    "URLLINK": "http://www.vsb.bc.ca/schools/selkirk-annex"
  }, {
    "SCHOOL_NAME": "MacCorkindale Elem.",
    "LATITUDE": "49.2279901864655",
    "LONGITUDE": "-123.029355035116",
    "ADDRESS": "6100 Battison St",
    "URLLINK": "http://www.vsb.bc.ca/schools/dr-hn-maccorkindale"
  }, {
    "SCHOOL_NAME": "Chief Maquinna Annex",
    "LATITUDE": "49.266421544",
    "LONGITUDE": "-123.04511809",
    "ADDRESS": "2882 E 4th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/chief-maquinna"
  }, {
    "SCHOOL_NAME": "Henderson Annex",
    "LATITUDE": "49.221042144",
    "LONGITUDE": "-123.08804322",
    "ADDRESS": "801 E 54th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/henderson-annex"
  }, {
    "SCHOOL_NAME": "Tyee Elem.",
    "LATITUDE": "49.253569355",
    "LONGITUDE": "-123.07382164",
    "ADDRESS": "3525 Dumfries St",
    "URLLINK": "http://www.vsb.bc.ca/schools/tyee"
  }, {
    "SCHOOL_NAME": "Sir James Douglas Annex",
    "LATITUDE": "49.214830465",
    "LONGITUDE": "-123.07329351",
    "ADDRESS": "7668 Borden St",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-james-douglas-annex"
  }, {
    "SCHOOL_NAME": "Garibaldi Annex",
    "LATITUDE": "49.275416392",
    "LONGITUDE": "-123.05026877",
    "ADDRESS": "1025 Slocan St",
    "URLLINK": "http://www.vsb.bc.ca/"
  }, {
    "SCHOOL_NAME": "Laurier Annex",
    "LATITUDE": "49.210717996",
    "LONGITUDE": "-123.1194453",
    "ADDRESS": "590 W 65th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/laurier-annex"
  }, {
    "SCHOOL_NAME": "University Hill Elem.",
    "LATITUDE": "49.274792",
    "LONGITUDE": "-123.237384",
    "ADDRESS": "5395 Chancellor Boulevard",
    "URLLINK": "http://www.vsb.bc.ca/schools/university-hill-elementary"
  }, {
    "SCHOOL_NAME": "Dickens Annex",
    "LATITUDE": "49.250213062",
    "LONGITUDE": "-123.08271031",
    "ADDRESS": "3877 Glen Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/charles-dickens-annex"
  }, {
    "SCHOOL_NAME": "Mount Pleasant Elem.",
    "LATITUDE": "49.263965733",
    "LONGITUDE": "-123.09399954",
    "ADDRESS": "2300 Guelph St",
    "URLLINK": "http://www.vsb.bc.ca/schools/mount-pleasant"
  }, {
    "SCHOOL_NAME": "Champlain Heights Elem.",
    "LATITUDE": "49.220640302",
    "LONGITUDE": "-123.02774835",
    "ADDRESS": "6955 Frontenac St",
    "URLLINK": "http://www.vsb.bc.ca/schools/champlain-heights"
  }, {
    "SCHOOL_NAME": "Lord Roberts Annex",
    "LATITUDE": "49.283091711",
    "LONGITUDE": "-123.12980601",
    "ADDRESS": "1150 Nelson St",
    "URLLINK": "http://www.vsb.bc.ca/schools/roberts-annex"
  }, {
    "SCHOOL_NAME": "Britannia Elem.",
    "LATITUDE": "49.2745120095296",
    "LONGITUDE": "-123.071378795422",
    "ADDRESS": "1110 Cotton Drive",
    "URLLINK": "http://www.vsb.bc.ca/schools/britannia-elementary"
  }, {
    "SCHOOL_NAME": "Jules Quesnel Elem.",
    "LATITUDE": "49.259567806",
    "LONGITUDE": "-123.19253813",
    "ADDRESS": "3050 Crown St",
    "URLLINK": "http://www.vsb.bc.ca/schools/jules-quesnel"
  }, {
    "SCHOOL_NAME": "False Creek Elem.",
    "LATITUDE": "49.267103112",
    "LONGITUDE": "-123.12685921",
    "ADDRESS": "900 School Green",
    "URLLINK": "http://www.vsb.bc.ca/schools/false-creek"
  }, {
    "SCHOOL_NAME": "Champlain Heights Annex",
    "LATITUDE": "49.2140784326839",
    "LONGITUDE": "-123.030549689398",
    "ADDRESS": "7835 Champlain Crescent",
    "URLLINK": "http://www.vsb.bc.ca/schools/champlain-heights-annex"
  }, {
    "SCHOOL_NAME": "Queen Alexandra Elem.",
    "LATITUDE": "49.26197055",
    "LONGITUDE": "-123.07592057",
    "ADDRESS": "1300 E Broadway",
    "URLLINK": "http://www.vsb.bc.ca/schools/queen-alexandra"
  }, {
    "SCHOOL_NAME": "Queen Mary Elem.",
    "LATITUDE": "49.267856423",
    "LONGITUDE": "-123.20479699",
    "ADDRESS": "2000 Trimble St",
    "URLLINK": "http://www.vsb.bc.ca/http://www.vsb.bc.ca/schools/queen-mary"
  }, {
    "SCHOOL_NAME": "Fraser Elem.",
    "LATITUDE": "49.2571713563496",
    "LONGITUDE": "-123.108196899433",
    "ADDRESS": "100 W 15th Av",
    "URLLINK": "http://www.vsb.bc.ca/"
  }, {
    "SCHOOL_NAME": "L'Ecole Bilingue Elem.",
    "LATITUDE": "49.258084034",
    "LONGITUDE": "-123.1303864",
    "ADDRESS": "1166 W 14th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/lecole-bilingue"
  }, {
    "SCHOOL_NAME": "Carr Elem.",
    "LATITUDE": "49.250041653",
    "LONGITUDE": "-123.12609641",
    "ADDRESS": "4070 Oak St",
    "URLLINK": "http://www.vsb.bc.ca/schools/emily-carr"
  }, {
    "SCHOOL_NAME": "Wolfe Elem.",
    "LATITUDE": "49.247228707",
    "LONGITUDE": "-123.10596494",
    "ADDRESS": "4251 Ontario St",
    "URLLINK": "http://www.vsb.bc.ca/schools/general-wolfe"
  }, {
    "SCHOOL_NAME": "Lord Nelson Elem.",
    "LATITUDE": "49.272507738",
    "LONGITUDE": "-123.05971209",
    "ADDRESS": "2235 Kitchener St",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-nelson"
  }, {
    "SCHOOL_NAME": "Tennyson Elem.",
    "LATITUDE": "49.262518935",
    "LONGITUDE": "-123.14937705",
    "ADDRESS": "1936 W 10th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/lord-tennyson"
  }, {
    "SCHOOL_NAME": "McBride Elem.",
    "LATITUDE": "49.24415661",
    "LONGITUDE": "-123.07817551",
    "ADDRESS": "1300 E 29th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-richard-mcbride"
  }, {
    "SCHOOL_NAME": "Grenfell Elem.",
    "LATITUDE": "49.2428916216093",
    "LONGITUDE": "-123.034807374541",
    "ADDRESS": "3323 Wellington Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/sir-wilfred-grenfell"
  }, {
    "SCHOOL_NAME": "Tecumseh Elem.",
    "LATITUDE": "49.232055743",
    "LONGITUDE": "-123.06800394",
    "ADDRESS": "1850 E 41st Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/tecumseh"
  }, {
    "SCHOOL_NAME": "Elsie Roy Elem.",
    "LATITUDE": "49.272238",
    "LONGITUDE": "-123.122482",
    "ADDRESS": "150 Drake St",
    "URLLINK": "http://www.vsb.bc.ca/schools/elsie-roy"
  }, {
    "SCHOOL_NAME": "Collingwood Neighbourhood School",
    "LATITUDE": "49.236551",
    "LONGITUDE": "-123.03288",
    "ADDRESS": "3417 Euclid Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/collingwood-neighbourhood-bruce-annex"
  }, {
    "SCHOOL_NAME": "Walter Moberly Elem.",
    "LATITUDE": "49.216109231",
    "LONGITUDE": "-123.08434542",
    "ADDRESS": "1000 E 59th Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/walter-moberly"
  }, {
    "SCHOOL_NAME": "Waverley Elem.",
    "LATITUDE": "49.227837226",
    "LONGITUDE": "-123.05578593",
    "ADDRESS": "6111 Elliott St",
    "URLLINK": "http://www.vsb.bc.ca/schools/waverley"
  }, {
    "SCHOOL_NAME": "VLN - Secondary",
    "LATITUDE": "49.2319589658739",
    "LONGITUDE": "-123.091869475134",
    "ADDRESS": "530 E 41st Av",
    "URLLINK": "http://www.vsb.bc.ca/schools/vancouver-learning-network-secondary-0"
  }, {
    "SCHOOL_NAME": "VLN - Elementary",
    "LATITUDE": "49.275399523275",
    "LONGITUDE": "-123.049806085058",
    "ADDRESS": "1025 Slocan St",
    "URLLINK": "http://www.vsb.bc.ca/schools/vanocuver-learning-network-elementary"
  }]
};
&#13;
#box {
  padding: 20px;
  background: #F2F2F2;
}
#map_canvas {
  width: 100%;
  height: 400px;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js"></script>
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.1.2/markerclustererplus/src/markerclusterer.js"></script>
<div id="box">
  <input type="checkbox" id="cluster" checked="checked" />With Cluster</div>
<div id="map_canvas"></div>
&#13;
&#13;
&#13;