transformation_circle
Create circular geographic areas from center points and radii for spatial analysis. Specify units and smoothness to generate GeoJSON polygon features.
Instructions
根据中心点和半径创建圆形区域。
此功能以指定的中心点和半径生成一个圆形多边形区域,可以控制圆形的平滑度和单位。
Args: center: 中心点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范或坐标数组 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' 或 '[-75.343, 39.984]'
radius: 圆的半径
- 类型: float
- 描述: 圆的半径值
- 示例: 5.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- steps: 圆的边数 (默认: 64)
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给圆形多边形的属性对象
- 示例: '{"steps": 32, "units": "miles", "properties": {"name": "circle"}}'Returns: str: JSON 字符串格式的圆形 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-75.35, 39.99], [-75.34, 39.99], ...]]}}'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> center = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> options = '{"steps": 32, "units": "miles"}' >>> result = asyncio.run(circle(center, 5.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-75.35, 39.99], [-75.34, 39.99], ...]]}}'
Notes: - 输入参数 center 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - steps 参数控制圆的平滑度,值越大圆越平滑 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| center | Yes | ||
| radius | Yes | ||
| options | No |