transformation_bboxClip
Clip GeoJSON features to specified bounding box coordinates, retaining only the portions that fall within the defined geographic area for spatial data processing.
Instructions
将 GeoJSON 特征裁剪到指定的边界框内。
此功能将输入的 GeoJSON 特征(线或多边形)裁剪到给定的边界框范围内,只保留边界框内的部分。
Args: feature: GeoJSON 特征 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Feature 规范,支持 LineString、MultiLineString、Polygon、MultiPolygon - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[2, 2], [8, 4], [12, 8], [3, 7], [2, 2]]]}}'
Returns: str: JSON 字符串格式的裁剪后的 GeoJSON 特征 - 类型: GeoJSON Feature with LineString, MultiLineString, Polygon, or MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[2, 2], [8, 4], [10, 8], [3, 7], [2, 2]]]}}'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> feature = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[2, 2], [8, 4], [12, 8], [3, 7], [2, 2]]]}}' >>> bbox = '[0, 0, 10, 10]' >>> result = asyncio.run(bboxClip(feature, bbox)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[2, 2], [8, 4], [10, 8], [3, 7], [2, 2]]]}}'
Notes: - 输入参数 feature 和 bbox 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 裁剪多边形时可能会产生退化边 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | Yes | ||
| feature | Yes |