1

I'm using react.js and I currently know how to put a hole in a polygon via the following:

drawShape(google){
    var entireMap = [
    new google.maps.LatLng(-85.1054596961173, -180),
    new google.maps.LatLng(85.1054596961173, -180),
    new google.maps.LatLng(85.1054596961173, 180),
    new google.maps.LatLng(-85.1054596961173, 180),
    new google.maps.LatLng(-85.1054596961173, 0)];

 var innerCoords = [
    {lat: 28.745, lng: -70.579},
    {lat: 29.570, lng: -67.514},
    {lat: 27.339, lng: -66.668}
  ];

    const poly = new google.maps.Polygon({
        paths: [entireMap, innerCoords],
        strokeColor: '#000000',
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: '#000000',
        fillOpacity: 0.35
    });

    poly.setMap(google.map);
    }

Right now, I have a list of properties that contain lng and lat. Instead of having polygon as holes I want to have circles as holes, using the lng and lat.

So far, I see that the documentation allows you to create circles separately:

var cityCircle = new google.maps.Circle({
      strokeColor: '#FF0000',
      strokeOpacity: 0.8,
      strokeWeight: 2,
      fillColor: '#FF0000',
      fillOpacity: 0.35,
      map: map,
      center: citymap[city].center,
      radius: Math.sqrt(citymap[city].population) * 100
    });

However, I would like the circles to be "holes" within the entireMap polygon. Is it possible to combine the entireMap shape and circle shape or would I need to create a function that creates circles from the polygon shape?

lost9123193
  • 10,460
  • 26
  • 73
  • 113
  • 1
    related question: [Change map opacity outside circle of Google Maps JavaScript API v3](http://stackoverflow.com/questions/19736418/change-map-opacity-outside-circle-of-google-maps-javascript-api-v3) – geocodezip Nov 04 '16 at 00:03
  • 1
    related question: [Google Map API v3 shade everything EXCEPT for polygon](http://stackoverflow.com/questions/11130323/google-map-api-v3-shade-everything-except-for-polygon) – geocodezip Nov 04 '16 at 00:05
  • 1
    related question: [Drawing multiple holes into a polygon - google maps api](http://stackoverflow.com/questions/14919276/drawing-multiple-holes-into-a-polygon-google-maps-api) – geocodezip Nov 04 '16 at 00:06

0 Answers0