- 开始使用
- MEASUREMENT
- COORDINATE MUTATION
- TRANSFORMATION
- FEATURE CONVERSION
- MISC
- HELPER
- RANDOM
- DATA
- INTERPOLATION
- JOINS
- GRIDS
- CLASSIFICATION
- AGGREGATION
- META
- ASSERTIONS
- BOOLEANS
- UNIT CONVERSION
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
计算交集
Takes two polygons and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined.
取两个多边形并找到它们的交点。如果它们共享一个边界,返回边界;如果它们不相交,返回undefined。
参数
参数 | 类型 | 描述 |
---|---|---|
poly1 | Feature <Polygon> | the first polygon |
poly2 | Feature <Polygon> | the second polygon |
返回
(Feature|null) - returns a feature representing the point(s) they share (in case of a Point or MultiPoint ), the borders they share (in case of a LineString or a MultiLineString ), the area they share (in case of Polygon or MultiPolygon ). If they do not share any point, returns null.
示例
var poly1 = turf.polygon([[
[-122.801742, 45.48565], // 注意:polygon首尾坐标要一致
[-122.801742, 45.60491],
[-122.584762, 45.60491],
[-122.584762, 45.48565],
[-122.801742, 45.48565]
]]);
var poly2 = turf.polygon([[
[-122.520217, 45.535693], // 注意:polygon首尾坐标要一致
[-122.64038, 45.553967],
[-122.720031, 45.526554],
[-122.669906, 45.507309],
[-122.723464, 45.446643],
[-122.532577, 45.408574],
[-122.487258, 45.477466],
[-122.520217, 45.535693]
]]);
var intersection = turf.intersect(poly1, poly2);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论