title: how to calculate number of markers inside a polygon in google maps
body: <p>Looking for a way to count the number of markers inside a polygon which is drawn dynamically by the user</p>
  
  <p>The code below can draw the polygon now i want to show the count of number of markers inside the polygon if there exists </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Simple Polygon&lt;/title&gt;
      &lt;style&gt;
          html, body {
              height: 100%;
              margin: 0;
              padding: 0;
          }
          #map {
              height: 100%;
              width: 100%;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="map"&gt;&lt;/div&gt;
  &lt;script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.17&amp;AIzaSyBLnIMoOLvgLaeIUEzLX3sIw0-FOXwXcag"&gt; &lt;/script&gt;
  &lt;script&gt;
      function initMap() {
          var mapOptions={
              center:{lat: 27.174977,lng:78.042064},
              zoom: 8
          };
          var map15= new google.maps.Map(document.getElementById("map"),mapOptions);
  
          var polygon= new google.maps.Polygon({
              strokeColor: "#1E41AA",
              strokeOpacity: 1.0,
              strokeWeight: 3,
              map: map15,
              fillColor: "#2652F2",
              fillOpacity: 0.6
          });
  
          var poly= polygon.getPath();
          function addPolyPoints(e){
              poly.push(e.latLng);
          }
  
          google.maps.event.addListener(map15,'click',addPolyPoints);
      }
      initMap();
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>ie, when the user draw the polygon the map if there exists a marker the count should be provided.</p>
  
  <p>How to do it?</p>