JSFiddle - React, Tailwind, and code Playground

by Wolf

HTML

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry&sensor=false"></script>

<div id="map-canvas"></div>

CSS

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

#map-canvas{
  height: 100%;
}

JavaScript

function initialize() {
    var mapOptions = {
    zoom: 16,
    center: new google.maps.LatLng(0, 1),
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  var poly = new google.maps.Polyline({
    path: [
      new google.maps.LatLng(0, 0),
      new google.maps.LatLng(0, 1),
      new google.maps.LatLng(1, 1)
    ],
      map: map
  });

    google.maps.event.addListener(poly, 'click', function(event){
        console.log(google.maps.geometry.poly.isLocationOnEdge(event.latLng, this, 0.00001));
        console.log(event.latLng.toString());
    });
}

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