transformation_buffer
Create buffer polygons around GeoJSON features with specified radius and customizable options for spatial analysis in geographic applications.
Instructions
为 GeoJSON 特征创建缓冲区。
此功能为输入的 GeoJSON 特征创建指定半径的缓冲区多边形。
Args: geojson: GeoJSON 特征 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-90.548630, 14.616599]}}'
radius: 缓冲区半径
- 类型: float
- 描述: 缓冲区的半径值
- 示例: 500.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- steps: 缓冲区边界分段数 (默认: 64)
- 示例: '{"units": "miles", "steps": 32}'Returns: str: JSON 字符串格式的缓冲区 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-90.55, 14.62], ...]]}}'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> geojson = '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-90.548630, 14.616599]}}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(buffer(geojson, 500.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-90.55, 14.62], ...]]}}'
Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 可以为点、线、多边形等几何类型创建缓冲区 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geojson | Yes | ||
| radius | Yes | ||
| options | No |