misc_unkink_polygon
Detect and remove self-intersections in polygons to create clean, non-overlapping polygon collections from GeoJSON input data.
Instructions
消除多边形中的自相交部分。
此功能检测并消除多边形中的自相交部分(扭结),返回无自相交的多边形集合。
Args: polygon: 多边形 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Polygon 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [0, 2], [2, 2], [0, 0]]]}'
Returns: str: JSON 字符串格式的多边形特征集合 - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}, ...]}
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [0, 2], [2, 2], [0, 0]]]}' >>> result = asyncio.run(unkink_polygon(polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [1, 1], [0, 2], [0, 0]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[1, 1], [2, 0], [2, 2], [1, 1]]]}}]}'
Notes: - 输入参数 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 消除多边形中的自相交部分,返回多个无自相交的多边形 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| polygon | Yes |