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;
var infowindow = new google.maps.InfoWindow();

function initialize() {
 var map = new google.maps.Map(document.getElementById('map-canvas'), {
    zoom: 3,
    center: {lat: 0, lng: -180},
    mapTypeId: google.maps.MapTypeId.TERRAIN
  });

  var flightPlanCoordinates = [
    {lat: 37.772, lng: -122.214},
    {lat: 21.291, lng: -157.821},
    {lat: -18.142, lng: 178.431},
    {lat: -27.467, lng: 153.027}
  ];
  var flightPath = new google.maps.Polyline({
    path: flightPlanCoordinates,
    geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });

  flightPath.setMap(map);
       console.log(flightPath.getPath());
    
}

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