google maps Выделение цветом области на гугл картах -- пример JS

Пример выделения Бермудского треугольника (предположим, что id блока = google-map):

function initGoogleMap()
{
    var map = new google.maps.Map(document.getElementById('google-map'), {
      zoom: 5,
      center: {lat: 24.886, lng: -70.268},
      mapTypeId: 'terrain'
    });

    // Define the LatLng coordinates for the polygon's path.
    var triangleCoords = [
      {lat: 25.774, lng: -80.190},
      {lat: 18.466, lng: -66.118},
      {lat: 32.321, lng: -64.757},
      {lat: 25.774, lng: -80.190}
    ];

    // Construct the polygon.
    var bermudaTriangle = new google.maps.Polygon({
      paths: triangleCoords,
      strokeColor: '#FF0000',
      strokeOpacity: 0.8,
      strokeWeight: 2,
      fillColor: '#FF0000',
      fillOpacity: 0.35
    });
    bermudaTriangle.setMap(map);
}

Можно также выделить несколько областей:

function initGoogleMap()
{
    var map = new google.maps.Map(document.getElementById('google-map'), {
        zoom: map_options.zoom,
        center: map_options.google_center,
        styles: googleMapStyleSettings,
    });

    map_data.forEach(function (area) {

            // Define the LatLng coordinates for the polygon's path.
        var areaCoords = area.google_poly;

        // Construct the polygon.
        var areaSettings = new google.maps.Polygon({
          paths: areaCoords,
          strokeColor: '#A93439',
          strokeOpacity: 0.8,
          strokeWeight: 2,
          fillColor: '#A93439',
          fillOpacity: 0.35
        });
        areaSettings.setMap(map);
    });
}

Key Words for FKN + antitotal forum (CS VSU):