0

我想使用类似于以下站点的 Google Maps API 创建带有圆形叠加层的地图:[链接] https://whypoll.crowdmap.com/

我可以将圆形图层添加到 Google Map API。谁能告诉我如何得到圈内的计数。例如这里它应该在圆圈内打印 1。

在此处输入图像描述 提前致谢。

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Circle Overlay</title>

    <style type="text/css">
      #map {
    width: 1200px;
    height: 775px;
      }
    </style>

  <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBdTuWJjEUMvQZ6VVPGksE12XNgQgs__Qk&sensor=false&libraries=visualization"></script>

    <script type="text/javascript">
      /**
       * Called on the initial page load.
       */
      function init() {
    var mapCenter = new google.maps.LatLng(23.30, 80.00);
    var map = new google.maps.Map(document.getElementById('map'), {
      'zoom': 5,
      'center': mapCenter,
       draggable: false,
       disableDefaultUI: true,
      'mapTypeId': google.maps.MapTypeId.ROADMAP
    });


      var marker = new google.maps.Marker({
     // map: map,
      position: new google.maps.LatLng(18.7000, 79.1833),
      draggable: false
    });

      var circle = new google.maps.Circle({
      map: map,
      radius: 100000, 
      strokeColor: "#FF0000",
      fillColor: "#FF0000",
      fillOpacity: 0.35,
      strokeWeight: 2,
      strokeOpacity: 0.8
    });

    // Since Circle and Marker both extend MVCObject, you can bind them
    // together using MVCObject's bindTo() method.  Here, we're binding
    // the Circle's center to the Marker's position.
    // http://code.google.com/apis/maps/documentation/v3/reference.html#MVCObject
    circle.bindTo('center', marker, 'position');
      }

      // Register an event listener to fire when the page finishes loading.
      google.maps.event.addDomListener(window, 'load', init);
    </script>
  </head>
  <body>

    <div id="map"></div>
  </body>
</html>
4

0 回答 0