transformation_convex
Generate convex hull polygons from point sets using Turf.js to create the smallest convex shape containing all input points for spatial analysis.
Instructions
计算点集的凸包。
该函数使用 Turf.js 库的 convex 方法,从一组点生成凸包多边形。
Args: points: 点集 GeoJSON FeatureCollection - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范,包含 Point 特征 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [10.195312, 43.755225]}}, ...]}'
Returns: str: JSON 字符串格式的凸包 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[10.195312, 43.755225], [10.404052, 43.8424511], ...]]}}'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [10.195312, 43.755225]}}]}' >>> result = asyncio.run(convex(points)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[10.195312, 43.755225], [10.404052, 43.8424511], ...]]}}'
Notes: - 输入参数 points 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 凸包是包含所有点的最小凸多边形 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| points | Yes |