javascript – 在谷歌地图中减去两个多边形

我在Google地图上绘制了三个多边形,第一个在第二个,第二个在第三个.
我想在javascript中将它们减去另一种形状.

P3-P2?
P2-P1?

解决方法:

我想的更容易:

var poly1Area = google.maps.geometry.spherical.computeArea(poly1.getPath());
var poly2Area = google.maps.geometry.spherical.computeArea(poly2.getPath());
var poly3Area = google.maps.geometry.spherical.computeArea(poly3.getPath());

poly2Area = poly2Area - poly1Area;
poly3Area = poly3Area - poly2Area;

ref:https://developers.google.com/maps/documentation/javascript/reference?csw=1#spherical

上一篇:A. Add Odd or Subtract Even


下一篇:比较两个字典的值以接收它们的数值差异Python