Google Maps API Polygon with “Hole” In Center

后端 未结 1 618
猫巷女王i
猫巷女王i 2020-12-01 16:51

Inserting a polygon inside another polygon is supposed to make a \"hole\" in the center (see the Google maps Pentagon example). However, my program keeps failing to make a h

相关标签:
1条回答
  • 2020-12-01 17:20

    It really is a matter of direction of indices in your polygons, while one is clockwise other should be counter-clockwise. Change your second array to:

    var circleOverlay = [
       new google.maps.LatLng(25.774252, -80.190262),
       new google.maps.LatLng(32.321384, -64.75737),  //second and third coordinates
       new google.maps.LatLng(18.466465, -66.118292), //are swapped compared to your original
       new google.maps.LatLng(25.774252, -80.190262)
     ];
    

    and it will display a nice hole in your triangle

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