cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              var data = [
  {country: 'France', name: 'Paris', lat: 48.8589507, lng: 2.2775175},
  {country: 'France', name: 'Melun', lat: 48.5421645, lng: 2.6377199},
  {country: 'France', name: 'Lyon', lat: 45.7580101, lng: 4.8001017},
  {country: 'Germany', name: 'Berlin', lat: 52.5076682, lng: 13.2860632},
  {country: 'Germany', name: 'Baden Baden', lat: 48.7574219, lng: 8.1443686},
  {country: 'United Kingdom', name: 'Londres', lat: 51.5287718, lng: -0.2416803},
  {country: 'United Kingdom', name: 'Bristol', lat: 51.468575, lng: -2.6607488},
  {country: 'United Kingdom', name: 'Plymouth', lat: 50.3888309, lng: -4.1824949}

function initMap() {
  var map = new google.maps.Map(document.getElementById('google-map'), {
    center: {lat: 46.52863469527167, lng: 2.43896484375},
    zoom: 3

  // Save Markers by location
  var placeMarkerList = {};

  // Checks every place
  for (var i = 0; i < data.length; ++i) {
    var place = data[i];
    var latLng = new google.maps.LatLng(place.lat, place.lng);

    if(!placeMarkerList.hasOwnProperty(place.country)) {
      placeMarkerList[place.country] = [];
    // Creates the marker and save it in place marker list
    var marker = new google.maps.Marker({
      position: latLng

  // Parse every country to display a cluster for the country
  for (var country in placeMarkerList) {
    if (placeMarkerList.hasOwnProperty(country)) {
      var markerCluster = new MarkerClusterer(map, placeMarkerList[country], {
        imagePath: 'https://googlemaps.github.io/js-marker-clusterer/images/m'

Loading ..................