transformation_concave
Calculate concave hulls from point sets to identify natural boundaries and spatial clusters in geographic data using Turf.js geospatial analysis.
Instructions
计算点集的凹包。
该函数使用 Turf.js 库的 concave 方法,从一组点生成凹包多边形。
Args: points: 点集 GeoJSON FeatureCollection - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范,包含 Point 特征 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-63.601226, 44.642643]}}, ...]}'
Returns: str: JSON 字符串格式的凹包 GeoJSON Polygon 或 MultiPolygon 特征 - 类型: GeoJSON Feature with Polygon or MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} 或 null(如果无法计算) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-63.6, 44.64], [-63.59, 44.65], ...]]}}'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-63.601226, 44.642643]}}]}' >>> options = '{"maxEdge": 1, "units": "miles"}' >>> result = asyncio.run(concave(points, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-63.6, 44.64], [-63.59, 44.65], ...]]}}'
Notes: - 输入参数 points 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 内部使用 turf-tin 生成几何图形 - 如果无法计算凹包,返回 null - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| options | No | ||
| points | Yes |