How to combine circles in Google Maps

后端 未结 2 1940
广开言路
广开言路 2021-01-06 23:44

I would like to be able to draw multiple circles on a Google Map with javascript, but combine them as a \"single shape\" so that their areas don\'t overlap, but are shared.

相关标签:
2条回答
  • 2021-01-07 00:20

    You can use a Polygon as stated here.

    Check this fiddle inspired in that solution.

    The most important part is combining the circles:

    var joined = new google.maps.Polygon({
        paths: [drawCircle(smallOne, 150/1609.344, 1),
                drawCircle(bigOne, 300/1609.344, 1)],
                strokeColor: "#ff0000",
                strokeOpacity: 0.35,
                strokeWeight: 0,
                fillColor: "#FF0000",
                fillOpacity: 0.35
    });
    
    joined.setMap(map);
    
    0 讨论(0)
  • 2021-01-07 00:38

    You can intersect polygons maybe try topojson.

    0 讨论(0)
提交回复
热议问题