JSFiddle - React, Tailwind, and code Playground

by MaurizioPiccini

HTML

<script src="https://maps.googleapis.com/maps/api/js?libraries=geometry&amp;sensor=false&amp;ext=.js"></script>
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/src/maplabel-compiled.js"></script>

<title>Google Maps API v3 : Hardcoded Polygon</title>

<body onload="initialize()">
<div id="map" style="width: 530px; height: 500px">
</div>

JavaScript

var polygon;
var infowindow = new google.maps.InfoWindow({});


function RistoCount(polygon, contoMarkers)  {
         
         //console.log (polygon[0].k) ;
         //alert (ne);
         //alert (sw);
         
         ///iniziamo  a contatre i risto nel polygon
         var polyCoords = [
              new google.maps.LatLng(41.8800711,12.5059979),
              new google.maps.LatLng(41.8800711,12.5659979),
              new google.maps.LatLng(41.9400711,12.5659979),
              new google.maps.LatLng(41.9400711,12.5059979),
     ];
    //       
    var ActiveRect = new google.maps.Polygon({
        paths: polyCoords //coodinate fisse iniziali
        //paths: polygon //coodinate aggiornate al cambio
    });
    
    //console.log (ActiveRect);
    //console.log (data);  //elenco dei ristoranti in mappa
    
    alert(contoMarkers);
    //  from http://jsfiddle.net/7wLWe/1/
    pos = new google.maps.LatLng( polygon[0].k , polygon[0].B);
    var mapLabel = new MapLabel({
        text: contoMarkers + ' Risto in Area',
        //position: pos ,
        map: map,
        fontColor: 'orange',
        fontSize: 18,
        align: 'left'
    });
    mapLabel.set('position', pos);    
}

function initialize() {
  var map = new google.maps.Map(document.getElementById("map"),
    {
        zoom: 12,
        center: new google.maps.LatLng(41.9100711,12.5359979,11),
        mapTypeId: google.maps.MapTypeId.HYBRID
    });

    
     var polyCoords = [
              new google.maps.LatLng(41.8800711,12.5059979),
              new google.maps.LatLng(41.8800711,12.5659979),
              new google.maps.LatLng(41.9400711,12.5659979),
              new google.maps.LatLng(41.9400711,12.5059979),
            ];

    polygon = new google.maps.Polygon({
        paths: polyCoords,
        strokeColor: "#0000FF",
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: "#0000FF",
        fillOpacity: 0.26
    });

    polygon.setMap(map);

    var bounds = new...