函数名:booleanContains
功能:判断一个复合多边形是否包含另一个点、线、面等几何要素。
语法:
turf.booleanContains(poly: Feature<Polygon|MultiPolygon>, other: Feature<any>): boolean
参数:
poly: 复合多边形,可以是 Feature<Polygon> 或 Feature<MultiPolygon>other: 需要被包含的其他几何要素,可以是 Feature<Point>、Feature<LineString>、Feature<Polygon> 等返回值: 返回 true 表示 poly 包含 other,否则返回 false。
例子:
var poly1 = turf.polygon([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]);
var poly2 = turf.polygon([[[5, 5], [5, 15], [15, 15], [15, 5], [5, 5]]]);
turf.booleanContains(poly1, poly2); // return false
turf.booleanContains(poly2, poly1); // return true
备注:
poly 或 other 为 null 或 undefined,则会抛出异常。other 的类型不是与 poly 种类相同的多边形类型,则会抛出异常并返回 false。