misc_mask
Crop geographic polygons using mask boundaries to extract specific regions from spatial data. Processes GeoJSON polygons with WGS84 coordinates to return only the masked area.
Instructions
使用掩膜多边形裁剪几何图形。
此功能使用掩膜多边形对输入多边形进行裁剪,返回掩膜范围内的多边形部分。
Args: polygons: 输入多边形 GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 Polygon、MultiPolygon、Feature、Feature、FeatureCollection<Polygon | MultiPolygon> - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]}'
Returns: str: JSON 字符串格式的 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> polygons = '{"type": "Polygon", "coordinates": [[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]}' >>> mask_polygon = '{"type": "Polygon", "coordinates": [[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]}' >>> result = asyncio.run(mask(polygons, mask_polygon)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}'
Notes: - 输入参数 polygons 和 mask_polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未提供掩膜多边形,则使用世界范围作为掩膜 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mask_polygon | No | ||
| options | No | ||
| polygons | Yes |