JSFiddle - React, Tailwind, and code Playground

by Pradeep Shankar

HTML

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;signed_in=true"></script>
<div id="map-canvas"></div>

CSS

html, body, #map-canvas {
      height: 100%;
      margin: 0px;
      padding: 0px
  }

JavaScript

var map;
function initialize() {
  var mapOptions = {
    zoom: 3,
    center: new google.maps.LatLng(0, -180),
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };
  var bounds = new google.maps.LatLngBounds();
    var polygons = [];
    var arr = new Array();
  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);
 var coordinates = {
        "feed1": [
            [12.991838, 77.70851],
            [12.9912195, 77.707405],
            [12.989732, 77.705246],
            [12.989732, 77.70416]
        ]
 };
  var flightPlanCoordinates = [
    new google.maps.LatLng(37.772323, -122.214897),
    new google.maps.LatLng(21.291982, -157.821856),
    new google.maps.LatLng(-18.142599, 178.431),
    new google.maps.LatLng(-27.46758, 153.027892)
  ];
  var flightPath = new google.maps.Polyline({
    path: flightPlanCoordinates,
    geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });
    
  flightPath.setMap(map);
    
     var infowindow = new google.maps.InfoWindow({
            content: "Hello World!"
        });

        google.maps.event.addListener(flightPath, 'click', function (event) {
            infowindow.open(map);
            infowindow.setPosition(event.latLng);
        });
}

google.maps.event.addDomListener(window, 'load', initialize);