Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Schema
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| aggregation_collect | 将点属性聚合到多边形中。 此功能将位于多边形内部的点的属性值聚合到多边形中,用于统计和汇总分析。 Args: polygons: 多边形特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Polygon or MultiPolygon features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}}, ...]}' points: 点特征集合
- 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection)
- 格式: FeatureCollection with Point features
- 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"population": 100}}, ...]}'
in_field: 输入字段名
- 类型: str
- 描述: 点特征中要聚合的属性字段名
- 示例: 'population'
out_field: 输出字段名
- 类型: str
- 描述: 多边形特征中要创建的聚合属性字段名
- 示例: 'total_population' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {..., "total_population": 聚合值}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"total_population": 1500}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygons = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}}]}' >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"population": 100}}]}' >>> result = asyncio.run(collect(polygons, points, 'population', 'total_population')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"total_population": 100}}, ...]}' Notes: - 输入参数 polygons 和 points 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 仅对位于多边形内部的点进行属性聚合 - 聚合方式为求和,即计算多边形内部所有点的属性值总和 - 依赖于 Turf.js 库和 Node.js 环境 |
| aggregation_clustersDbscan | 使用 DBSCAN 算法进行点聚类。 此功能使用基于密度的空间聚类算法 (DBSCAN) 对点进行聚类,识别密集区域。 Args: points: 点特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' max_distance: 最大距离
- 类型: float
- 描述: 聚类搜索的最大距离(单位:千米)
- 示例: 100.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- minPoints: 形成聚类所需的最小点数 (默认: 3)
- 示例: '{"units": "miles", "minPoints": 5}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {"cluster": 聚类编号, ...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"cluster": 1}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}]}' >>> result = asyncio.run(clustersDbscan(points, 100.0, '{"minPoints": 3}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"cluster": 1}}, ...]}' Notes: - 输入参数 points 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - DBSCAN 算法能够识别任意形状的聚类,并处理噪声点 - 聚类编号从 0 开始,-1 表示噪声点(不属于任何聚类) - 依赖于 Turf.js 库和 Node.js 环境 |
| aggregation_clustersKmeans | 使用 K-means 算法进行点聚类。 此功能使用 K-means 聚类算法对点进行聚类,将点划分为指定数量的簇。 Args: points: 点特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' number_of_clusters: 聚类数量
- 类型: int
- 描述: 要创建的聚类数量
- 示例: 5
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- numberOfClusters: 聚类数量(与 number_of_clusters 参数相同)
- mutate: 是否修改原始特征 (默认: false)
- 示例: '{"mutate": true}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {"cluster": 聚类编号, ...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"cluster": 1}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}]}' >>> result = asyncio.run(clustersKmeans(points, 5)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"cluster": 1}}, ...]}' Notes: - 输入参数 points 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - K-means 算法需要预先指定聚类数量 - 聚类编号从 0 开始 - 算法使用随机初始中心点,每次运行结果可能不同 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanClockwise | 检查环是否为顺时针方向。 此功能检查给定的坐标环(多边形边界)是否为顺时针方向。 Args: ring: 坐标环数组 - 类型: str (JSON 字符串格式的数组) - 格式: [[x1, y1], [x2, y2], [x3, y3], ...] - 示例: '[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> ring = '[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]' >>> result = asyncio.run(booleanClockwise(ring)) >>> print(result) '{"value": true}' Notes: - 输入参数 ring 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 顺时针环在多边形中表示外部边界 - 逆时针环在多边形中表示内部孔洞 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanContains | 检查第一个几何图形是否包含第二个几何图形。 此功能检查第一个GeoJSON几何图形是否完全包含第二个几何图形。 Args: geojson1: 第一个GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}' geojson2: 第二个GeoJSON对象
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 对象
- 示例: '{"type": "Point", "coordinates": [1, 1]}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson1 = '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}' >>> geojson2 = '{"type": "Point", "coordinates": [1, 1]}' >>> result = asyncio.run(booleanContains(geojson1, geojson2)) >>> print(result) '{"value": true}' Notes: - 输入参数 geojson1 和 geojson2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 包含关系要求第二个几何图形完全在第一个几何图形内部 - 边界接触不被视为包含 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanCrosses | 检查两个几何图形是否相交。 此功能检查两个GeoJSON几何图形是否相交(交叉但不相交于边界点)。 Args: geojson1: 第一个GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "LineString", "coordinates": [[0, 0], [2, 2]]}' geojson2: 第二个GeoJSON对象
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 对象
- 示例: '{"type": "LineString", "coordinates": [[0, 2], [2, 0]]}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson1 = '{"type": "LineString", "coordinates": [[0, 0], [2, 2]]}' >>> geojson2 = '{"type": "LineString", "coordinates": [[0, 2], [2, 0]]}' >>> result = asyncio.run(booleanCrosses(geojson1, geojson2)) >>> print(result) '{"value": true}' Notes: - 输入参数 geojson1 和 geojson2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 交叉关系要求几何图形在内部点相交 - 边界接触不被视为交叉 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanDisjoint | 检查两个几何图形是否不相交。 此功能检查两个GeoJSON几何图形是否完全不相交(没有共同点)。 Args: geojson1: 第一个GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "Polygon", "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]}' geojson2: 第二个GeoJSON对象
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 对象
- 示例: '{"type": "Polygon", "coordinates": [[[2, 2], [3, 2], [3, 3], [2, 3], [2, 2]]]}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson1 = '{"type": "Polygon", "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]}' >>> geojson2 = '{"type": "Polygon", "coordinates": [[[2, 2], [3, 2], [3, 3], [2, 3], [2, 2]]]}' >>> result = asyncio.run(booleanDisjoint(geojson1, geojson2)) >>> print(result) '{"value": true}' Notes: - 输入参数 geojson1 和 geojson2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 不相交关系要求几何图形没有任何共同点 - 边界接触也被视为相交 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanEqual | 检查两个几何图形是否相等。 此功能检查两个GeoJSON几何图形是否在几何上完全相等。 Args: geojson1: 第一个GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "Point", "coordinates": [1, 1]}' geojson2: 第二个GeoJSON对象
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 对象
- 示例: '{"type": "Point", "coordinates": [1, 1]}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson1 = '{"type": "Point", "coordinates": [1, 1]}' >>> geojson2 = '{"type": "Point", "coordinates": [1, 1]}' >>> result = asyncio.run(booleanEqual(geojson1, geojson2)) >>> print(result) '{"value": true}' Notes: - 输入参数 geojson1 和 geojson2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 相等关系要求几何图形具有相同的坐标和结构 - 属性不同不影响几何相等性判断 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanOverlap | 检查两个几何图形是否重叠。 此功能检查两个GeoJSON几何图形是否在空间上重叠(有共同区域但不完全包含)。 Args: geojson1: 第一个GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}' geojson2: 第二个GeoJSON对象
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 对象
- 示例: '{"type": "Polygon", "coordinates": [[[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]]}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson1 = '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}' >>> geojson2 = '{"type": "Polygon", "coordinates": [[[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]]}' >>> result = asyncio.run(booleanOverlap(geojson1, geojson2)) >>> print(result) '{"value": true}' Notes: - 输入参数 geojson1 和 geojson2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 重叠关系要求几何图形有共同区域但互不包含 - 边界接触不被视为重叠 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanParallel | 检查两条线段是否平行。 此功能检查两条线段是否在几何上平行。 Args: line1: 第一条线段 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: Feature with LineString geometry - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [1, 1]]}}' line2: 第二条线段
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: Feature with LineString geometry
- 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 1], [1, 2]]}}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line1 = '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [1, 1]]}}' >>> line2 = '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 1], [1, 2]]}}' >>> result = asyncio.run(booleanParallel(line1, line2)) >>> print(result) '{"value": true}' Notes: - 输入参数 line1 和 line2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 平行关系基于线段的方向向量 - 允许一定的数值容差 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanPointInPolygon | 检查点是否在多边形内部。 此功能检查点是否位于多边形或多边形集合的内部。 Args: point: 点特征 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: Feature with Point geometry - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [1, 1]}}' polygon: 多边形特征
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: Feature with Polygon or MultiPolygon geometry
- 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- ignoreBoundary: 是否忽略边界 (默认: false)
- 示例: '{"ignoreBoundary": true}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [1, 1]}}' >>> polygon = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}}' >>> result = asyncio.run(booleanPointInPolygon(point, polygon)) >>> print(result) '{"value": true}' Notes: - 输入参数 point 和 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 使用射线法算法判断点是否在多边形内部 - 边界上的点默认被视为内部 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanPointOnLine | 检查点是否在线上。 此功能检查点是否位于线段或多线的路径上。 Args: point: 点特征 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: Feature with Point geometry - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [1, 1]}}' line: 线特征
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: Feature with LineString or MultiLineString geometry
- 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [2, 2]]}}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- ignoreEndVertices: 是否忽略端点 (默认: false)
- 示例: '{"ignoreEndVertices": true}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [1, 1]}}' >>> line = '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [2, 2]]}}' >>> result = asyncio.run(booleanPointOnLine(point, line)) >>> print(result) '{"value": true}' Notes: - 输入参数 point 和 line 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 使用点到线段距离算法判断点是否在线上 - 允许一定的数值容差 - 依赖于 Turf.js 库和 Node.js 环境 |
| booleans_booleanWithin | 检查第一个几何图形是否在第二个几何图形内部。 此功能检查第一个GeoJSON几何图形是否完全位于第二个几何图形内部。 Args: geojson1: 第一个GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "Point", "coordinates": [1, 1]}' geojson2: 第二个GeoJSON对象
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 对象
- 示例: '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}' Returns: str: JSON 字符串格式的布尔结果 - 类型: 包含 value 的对象 - 格式: {"value": true 或 false} - 示例: '{"value": true}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson1 = '{"type": "Point", "coordinates": [1, 1]}' >>> geojson2 = '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]}' >>> result = asyncio.run(booleanWithin(geojson1, geojson2)) >>> print(result) '{"value": true}' Notes: - 输入参数 geojson1 和 geojson2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 内部关系要求第一个几何图形完全在第二个几何图形内部 - 边界接触不被视为内部 - 依赖于 Turf.js 库和 Node.js 环境 |
| classification_nearestPoint | 查找距离目标点最近的点特征。 此功能从点集合中查找距离给定目标点最近的点特征,并返回该点及其距离信息。 Args: target_point: 目标点特征 - 类型: str (JSON 字符串格式的 GeoJSON Feature) - 格式: Feature with Point geometry - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}' points: 点特征集合
- 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection)
- 格式: FeatureCollection with Point features
- 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]}}, ...]}' Returns: str: JSON 字符串格式的最近点特征 - 类型: GeoJSON Feature with Point geometry and distance property - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {"distance": 距离数值, ...}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]}, "properties": {"distance": 12.34, ...}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> target_point = '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}' >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]}}]}' >>> result = asyncio.run(nearestPoint(target_point, points)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]}, "properties": {"distance": 12.34, ...}}' Notes: - 输入参数 target_point 和 points 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算的是球面距离,单位为千米 - 返回的点特征包含原始属性以及新增的 distance 属性 - 依赖于 Turf.js 库和 Node.js 环境 |
| coordinate_mutation_clean_coords | 清理 GeoJSON 数据中的冗余坐标点。 此功能自动移除连续的重复坐标点,简化几何图形,使数据更加整洁。 Args: geojson: GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- mutate: 是否允许修改输入 GeoJSON (默认: false)
- 示例: '{"mutate": true}' Returns: str: JSON 字符串格式的清理后的 GeoJSON 特征或几何图形 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 清理冗余坐标后的 GeoJSON - 示例: '{"type": "LineString", "coordinates": [[0, 0], [0, 10]]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]}' >>> result = asyncio.run(clean_coords(line)) >>> print(result) '{"type": "LineString", "coordinates": [[0, 0], [0, 10]]}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 会移除连续的重复坐标点 - 依赖于 Turf.js 库和 Node.js 环境 |
| coordinate_mutation_flip | 交换坐标的经度和纬度位置。 此功能将坐标从 [经度, 纬度] 格式转换为 [纬度, 经度] 格式,适用于不同系统的坐标约定。 Args: geojson: GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [20.566406, 43.421008]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- mutate: 是否允许修改输入 GeoJSON (默认: false)
- 示例: '{"mutate": true}' Returns: str: JSON 字符串格式的坐标翻转后的 GeoJSON 特征 - 类型: GeoJSON Feature - 格式: 坐标翻转后的 GeoJSON - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [43.421008, 20.566406]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Point", "coordinates": [20.566406, 43.421008]}' >>> result = asyncio.run(flip(point)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [43.421008, 20.566406]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序从 [经度, 纬度] 翻转为 [纬度, 经度] - 主要用于在不同坐标系约定之间转换 - 依赖于 Turf.js 库和 Node.js 环境 - 注意:输入如果是几何图形,输出会转换为特征对象 |
| coordinate_mutation_rewind | 修正多边形的环方向,确保外环逆时针、内环顺时针。 此功能自动调整多边形的环方向,符合地理信息系统标准,确保多边形区域计算正确。 Args: geojson: GeoJSON 多边形特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Polygon 或 MultiPolygon 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- reverse: 是否启用反向重绕 (默认: false)
- mutate: 是否允许修改输入 GeoJSON (默认: false)
- 示例: '{"reverse": true, "mutate": false}' Returns: str: JSON 字符串格式的重绕后的 GeoJSON 多边形 - 类型: GeoJSON Feature with Polygon geometry - 格式: 重绕环方向后的多边形 - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[121, -29], [121, -18], [138, -18], [138, -29], [121, -29]]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]}' >>> result = asyncio.run(rewind(polygon)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[121, -29], [121, -18], [138, -18], [138, -29], [121, -29]]]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 外环应为逆时针方向,内环应为顺时针方向 - 依赖于 Turf.js 库和 Node.js 环境 |
| coordinate_mutation_round_number | 对数字进行四舍五入,控制小数位数。 此功能将数字四舍五入到指定的小数位数,用于精确控制数值的精度。 Args: num: 要四舍五入的数字 - 类型: float - 范围: 任意浮点数 - 示例: 120.4321 precision: 小数位数精度
- 类型: int
- 描述: 要保留的小数位数
- 默认: 0
- 范围: 0 或正整数
- 示例: 2 Returns: str: JSON 字符串格式的四舍五入结果对象 - 类型: 包含 value 的对象 - 格式: {"value": 四舍五入后的数值} - 示例: '{"value": 120.43}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> result = asyncio.run(round_number(120.4321, 2)) >>> print(result) '{"value": 120.43}' Notes: - 如果未提供精度参数,默认四舍五入到整数 - 精度为 0 时返回整数 - 依赖于 Turf.js 库和 Node.js 环境 |
| coordinate_mutation_truncate | 截断 GeoJSON 几何图形的坐标精度。 该函数使用 Turf.js 库的 truncate 方法,减少 GeoJSON 几何图形坐标的小数精度, 并可选择移除 Z 坐标值。 Args: geojson: GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [70.46923055566859, 58.11088890802906, 1508]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- precision: 坐标小数精度 (默认: 6)
- coordinates: 最大坐标维度数 (主要用于移除 Z 坐标) (默认: 3)
- mutate: 是否允许修改输入 GeoJSON (默认: false)
- 示例: '{"precision": 3, "coordinates": 2, "mutate": false}' Returns: str: JSON 字符串格式的精度截断后的 GeoJSON 特征 - 类型: GeoJSON Feature - 格式: 坐标精度截断后的 GeoJSON - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [70.469, 58.111]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Point", "coordinates": [70.46923055566859, 58.11088890802906, 1508]}' >>> options = '{"precision": 3, "coordinates": 2}' >>> result = asyncio.run(truncate(point, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [70.469, 58.111]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 通过设置 coordinates 为 2 可以移除 Z 坐标值 - 依赖于 Turf.js 库和 Node.js 环境 |
| data_sample | 从特征集合中随机采样指定数量的特征。 此功能从输入的特征集合中随机选择指定数量的特征,返回一个新的特征集合。 Args: feature_collection: 输入特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: 任何有效的 GeoJSON FeatureCollection - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' num: 采样数量
- 类型: int
- 描述: 要从输入集合中随机选择特征的数量
- 示例: 5 Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection - 格式: {"type": "FeatureCollection", "features": [...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> feature_collection = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' >>> result = asyncio.run(sample(feature_collection, 5)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Notes: - 输入参数 feature_collection 必须是有效的 JSON 字符串 - 采样数量不能超过输入特征集合中的特征总数 - 如果采样数量为0,返回空的特征集合 - 采样是随机进行的,每次调用可能得到不同的结果 - 依赖于 Turf.js 库和 Node.js 环境 |
| feature_conversion_combine | 将特征集合合并为复合几何图形。 此功能将点、线或多边形特征集合分别合并为多点、多线或多边形复合几何图形。 Args: feature_collection: GeoJSON 特征集合 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [19.026432, 47.49134]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [19.074497, 47.509548]}}]}' Returns: str: JSON 字符串格式的合并后 GeoJSON 特征集合 - 类型: GeoJSON FeatureCollection with MultiPoint, MultiLineString or MultiPolygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "...", "coordinates": [...]}}]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> fc = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [19.026432, 47.49134]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [19.074497, 47.509548]}}]}' >>> result = asyncio.run(combine(fc)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "MultiPoint", "coordinates": [[19.026432, 47.49134], [19.074497, 47.509548]]}}]}' Notes: - 输入参数 feature_collection 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 点特征会合并为多点,线特征会合并为多线,多边形特征会合并为多多边形 - 依赖于 Turf.js 库和 Node.js 环境 |
| feature_conversion_explode | 将几何图形分解为单独的点特征。 此功能将给定的 GeoJSON 特征分解为所有顶点坐标的单独点特征集合。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' Returns: str: JSON 字符串格式的点特征集合 - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' >>> result = asyncio.run(explode(polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-81, 41]}}, ...]}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回所有几何图形顶点的点特征集合 - 依赖于 Turf.js 库和 Node.js 环境 |
| feature_conversion_flatten | 将复合几何图形展平为简单几何图形。 此功能将多几何图形(如多点、多线、多多边形)展平为对应的简单几何图形特征集合。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "MultiPolygon", "coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]]}' Returns: str: JSON 字符串格式的展平后特征集合 - 类型: GeoJSON FeatureCollection with simple geometry features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "...", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> multi_polygon = '{"type": "MultiPolygon", "coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]]}' >>> result = asyncio.run(flatten(multi_polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]]}}, ...]}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 多几何图形会被展平为对应的简单几何图形集合 - 依赖于 Turf.js 库和 Node.js 环境 |
| feature_conversion_line_to_polygon | 将线转换为多边形。 此功能将线几何图形转换为多边形几何图形,自动闭合线段的起点和终点。 Args: line: GeoJSON 线特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 或 MultiLineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- properties: 传递给多边形的属性对象
- autoComplete: 是否自动完成线段闭合
- orderCoords: 是否重新排序坐标
- mutate: 是否修改原始线特征
- 示例: '{"properties": {"name": "converted polygon"}}' Returns: str: JSON 字符串格式的 GeoJSON Polygon 或 MultiPolygon 特征 - 类型: GeoJSON Feature with Polygon or MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]}' >>> options = '{"properties": {"name": "converted polygon"}}' >>> result = asyncio.run(line_to_polygon(line, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]}}' Notes: - 输入参数 line 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 线会自动闭合形成多边形边界 - 依赖于 Turf.js 库和 Node.js 环境 |
| feature_conversion_polygonize | 将线几何图形转换为多边形。 此功能将线或多线几何图形转换为多边形几何图形集合,基于线的闭合区域创建多边形。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection, Geometry 或 Feature 规范,包含 LineString 或 MultiLineString - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]}}]}' Returns: str: JSON 字符串格式的多边形特征集合 - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]}}]}' >>> result = asyncio.run(polygonize(geojson)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]}}]}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 基于线的闭合区域创建多边形 - 依赖于 Turf.js 库和 Node.js 环境 |
| feature_conversion_polygon_to_line | 将多边形转换为线几何图形。 此功能将多边形或多边形几何图形转换为线或多线几何图形,提取多边形的边界。 Args: polygon: GeoJSON 多边形特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Polygon 或 MultiPolygon 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]}' Returns: str: JSON 字符串格式的 GeoJSON LineString 或 MultiLineString 特征 - 类型: GeoJSON Feature with LineString or MultiLineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]}' >>> result = asyncio.run(polygon_to_line(polygon)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]}}' Notes: - 输入参数 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 提取多边形的边界作为线几何图形 - 依赖于 Turf.js 库和 Node.js 环境 |
| grid_hexGrid | 在边界框内生成六边形网格。 此功能在指定的边界框内创建六边形网格,用于空间分析和可视化。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) - 格式: [minX, minY, maxX, maxY] - 示例: '[-180, -90, 180, 90]' cell_size: 网格单元大小
- 类型: float
- 描述: 六边形外接圆的半径
- 示例: 50.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给所有六边形的属性对象
- mask: 用于裁剪网格的多边形特征
- 示例: '{"units": "miles", "properties": {"type": "hexagon"}}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"type": "hexagon"}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-180, -90, 180, 90]' >>> result = asyncio.run(hexGrid(bbox, 50.0, '{"units": "miles"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {...}}, ...]}' Notes: - 输入参数 bbox 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 六边形网格提供均匀的空间覆盖,常用于地理分析 - 依赖于 Turf.js 库和 Node.js 环境 |
| grid_pointGrid | 在边界框内生成点网格。 此功能在指定的边界框内创建规则分布的点网格,用于空间采样和插值。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) - 格式: [minX, minY, maxX, maxY] - 示例: '[-180, -90, 180, 90]' cell_size: 网格单元大小
- 类型: float
- 描述: 点之间的间距
- 示例: 50.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给所有点的属性对象
- mask: 用于裁剪网格的多边形特征
- 示例: '{"units": "miles", "properties": {"type": "grid_point"}}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"type": "grid_point"}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-180, -90, 180, 90]' >>> result = asyncio.run(pointGrid(bbox, 50.0, '{"units": "miles"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"type": "grid_point"}}, ...]}' Notes: - 输入参数 bbox 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 点网格提供规则的空间采样点,常用于插值和统计 - 依赖于 Turf.js 库和 Node.js 环境 |
| grid_squareGrid | 在边界框内生成正方形网格。 此功能在指定的边界框内创建正方形网格,用于空间分析和区域划分。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) - 格式: [minX, minY, maxX, maxY] - 示例: '[-180, -90, 180, 90]' cell_size: 网格单元大小
- 类型: float
- 描述: 正方形的边长
- 示例: 50.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给所有正方形的属性对象
- mask: 用于裁剪网格的多边形特征
- 示例: '{"units": "miles", "properties": {"type": "square"}}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"type": "square"}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-180, -90, 180, 90]' >>> result = asyncio.run(squareGrid(bbox, 50.0, '{"units": "miles"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"type": "square"}}, ...]}' Notes: - 输入参数 bbox 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 正方形网格提供规则的矩形区域,常用于统计和聚合 - 依赖于 Turf.js 库和 Node.js 环境 |
| grid_triangleGrid | 在边界框内生成三角形网格。 此功能在指定的边界框内创建三角形网格,用于空间分析和表面建模。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) - 格式: [minX, minY, maxX, maxY] - 示例: '[-180, -90, 180, 90]' cell_size: 网格单元大小
- 类型: float
- 描述: 三角形每条边的长度
- 示例: 50.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给所有三角形的属性对象
- mask: 用于裁剪网格的多边形特征
- 示例: '{"units": "miles", "properties": {"type": "triangle"}}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"type": "triangle"}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-180, -90, 180, 90]' >>> result = asyncio.run(triangleGrid(bbox, 50.0, '{"units": "miles"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"type": "triangle"}}, ...]}' Notes: - 输入参数 bbox 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 三角形网格提供灵活的空间划分,常用于表面建模 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_featureCollection | 将多个地理特征组合成一个特征集合。 此功能将一组地理特征组合成一个统一的特征集合,便于批量处理和管理多个地理对象。 Args: features: 特征数组 - 类型: str (JSON 字符串格式的数组) - 格式: 包含 GeoJSON 特征的数组 - 示例: '[{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]}}]' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征集合的标识符
- 示例: '{"bbox": [-76, 39, -75, 40], "id": "collection1"}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection - 格式: {"type": "FeatureCollection", "features": [...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> features = '[{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]}}]' >>> result = asyncio.run(featureCollection(features)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Notes: - 输入参数 features 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 特征集合是组织和管理多个地理对象的有效方式 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_feature | 创建单个地理特征对象。 此功能将几何图形和属性信息组合成一个完整的地理特征,用于表示具体的地理要素。 Args: geometry: 几何图形对象 - 类型: str (JSON 字符串格式的 GeoJSON 几何图形) - 格式: 任何有效的 GeoJSON 几何图形 - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "Location A", "type": "landmark"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [-75.5, 39.5, -75, 40], "id": "feature1"}' Returns: str: JSON 字符串格式的 GeoJSON Feature - 类型: GeoJSON Feature - 格式: {"type": "Feature", "geometry": {...}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"name": "Location A"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geometry = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> properties = '{"name": "Location A"}' >>> result = asyncio.run(feature(geometry, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"name": "Location A"}}' Notes: - 输入参数 geometry、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 特征是 GeoJSON 中的基本数据单元,包含几何信息和属性 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_geometryCollection | 创建几何图形集合特征。 此功能将多个不同类型的几何图形组合成一个几何集合特征,适用于包含多种几何类型的复杂场景。 Args: geometries: 几何图形数组 - 类型: str (JSON 字符串格式的数组) - 格式: 包含 GeoJSON 几何图形的数组 - 示例: '[{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "mixed geometries"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [99, -1, 103, 2], "id": "geometry_collection"}' Returns: str: JSON 字符串格式的 GeoJSON Feature with GeometryCollection - 类型: GeoJSON Feature with GeometryCollection geometry - 格式: {"type": "Feature", "geometry": {"type": "GeometryCollection", "geometries": [...]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100, 0]}, ...]}, "properties": {"name": "mixed geometries"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geometries = '[{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]' >>> properties = '{"name": "mixed geometries"}' >>> result = asyncio.run(geometryCollection(geometries, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "GeometryCollection", "geometries": [...]}, "properties": {"name": "mixed geometries"}}' Notes: - 输入参数 geometries、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 几何集合可以包含不同类型的几何图形 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_lineString | 创建线特征对象。 此功能根据坐标点数组创建线特征,用于表示路径、边界等线性地理要素。 Args: coordinates: 坐标点数组 - 类型: str (JSON 字符串格式的数组) - 格式: [[lng1, lat1], [lng2, lat2], ...] - 示例: '[[-74, 40], [-78, 42], [-82, 35]]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "route", "type": "highway"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [-83, 34, -73, 43], "id": "line1"}' Returns: str: JSON 字符串格式的 GeoJSON LineString Feature - 类型: GeoJSON Feature with LineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}, "properties": {"name": "route"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> coordinates = '[[-74, 40], [-78, 42], [-82, 35]]' >>> properties = '{"name": "route"}' >>> result = asyncio.run(lineString(coordinates, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}, "properties": {"name": "route"}}' Notes: - 输入参数 coordinates、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 至少需要两个坐标点才能创建有效的线 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_multiLineString | 创建多线特征对象。 此功能根据多组坐标点数组创建多线特征,用于表示包含多条线的复杂线性要素。 Args: coordinates: 多线坐标数组 - 类型: str (JSON 字符串格式的数组) - 格式: [[[lng1, lat1], [lng2, lat2], ...], [[lng3, lat3], [lng4, lat4], ...]] - 示例: '[[[[-24, 63], [-23, 60], [-25, 65], [-20, 69]]], [[[-14, 43], [-13, 40], [-15, 45], [-10, 49]]]]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "multi route"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [-26, 39, -9, 70], "id": "multi_line1"}' Returns: str: JSON 字符串格式的 GeoJSON MultiLineString Feature - 类型: GeoJSON Feature with MultiLineString geometry - 格式: {"type": "Feature", "geometry": {"type": "MultiLineString", "coordinates": [...]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "MultiLineString", "coordinates": [[[-24, 63], [-23, 60], ...], [[-14, 43], [-13, 40], ...]]}, "properties": {"name": "multi route"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> coordinates = '[[[[-24, 63], [-23, 60], [-25, 65], [-20, 69]]], [[[-14, 43], [-13, 40], [-15, 45], [-10, 49]]]]' >>> properties = '{"name": "multi route"}' >>> result = asyncio.run(multiLineString(coordinates, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "MultiLineString", "coordinates": [...]}, "properties": {"name": "multi route"}}' Notes: - 输入参数 coordinates、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 多线特征包含多条独立的线 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_multiPoint | 创建多点特征对象。 此功能根据坐标点数组创建多点特征,用于表示一组相关的点要素。 Args: coordinates: 多点坐标数组 - 类型: str (JSON 字符串格式的数组) - 格式: [[lng1, lat1], [lng2, lat2], ...] - 示例: '[[0, 0], [10, 10]]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "point group"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [-1, -1, 11, 11], "id": "multi_point1"}' Returns: str: JSON 字符串格式的 GeoJSON MultiPoint Feature - 类型: GeoJSON Feature with MultiPoint geometry - 格式: {"type": "Feature", "geometry": {"type": "MultiPoint", "coordinates": [...]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "MultiPoint", "coordinates": [[0, 0], [10, 10]]}, "properties": {"name": "point group"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> coordinates = '[[0, 0], [10, 10]]' >>> properties = '{"name": "point group"}' >>> result = asyncio.run(multiPoint(coordinates, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "MultiPoint", "coordinates": [[0, 0], [10, 10]]}, "properties": {"name": "point group"}}' Notes: - 输入参数 coordinates、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 多点特征包含多个独立的点 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_multiPolygon | 创建多多边形特征对象。 此功能根据多组多边形坐标数组创建多多边形特征,用于表示包含多个多边形的复杂区域要素。 Args: coordinates: 多多边形坐标数组 - 类型: str (JSON 字符串格式的数组) - 格式: [[[[lng1, lat1], [lng2, lat2], ...]], [[[lng3, lat3], [lng4, lat4], ...]]] - 示例: '[[[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [[[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]]]]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "multi area"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [-1, -1, 16, 11], "id": "multi_polygon1"}' Returns: str: JSON 字符串格式的 GeoJSON MultiPolygon Feature - 类型: GeoJSON Feature with MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [...]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]], [[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]]]}, "properties": {"name": "multi area"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> coordinates = '[[[[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]], [[[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]]]]' >>> properties = '{"name": "multi area"}' >>> result = asyncio.run(multiPolygon(coordinates, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [...]}, "properties": {"name": "multi area"}}' Notes: - 输入参数 coordinates、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 多多边形特征包含多个独立的多边形 - 每个多边形必须形成闭合环 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_point | 创建点特征对象。 此功能根据坐标点创建点特征,用于表示具体的地理位置点。 Args: coordinates: 坐标点 - 类型: str (JSON 字符串格式的数组) - 格式: [lng, lat] - 示例: '[-75.343, 39.984]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "Location A", "type": "city"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [-75.5, 39.5, -75, 40], "id": "point1"}' Returns: str: JSON 字符串格式的 GeoJSON Point Feature - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"name": "Location A"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> coordinates = '[-75.343, 39.984]' >>> properties = '{"name": "Location A"}' >>> result = asyncio.run(point(coordinates, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"name": "Location A"}}' Notes: - 输入参数 coordinates、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 点特征是地理信息系统中最基本的要素类型 - 依赖于 Turf.js 库和 Node.js 环境 |
| helper_polygon | 创建多边形特征对象。 此功能根据坐标点数组创建多边形特征,用于表示区域、地块等面状地理要素。 Args: coordinates: 多边形坐标数组 - 类型: str (JSON 字符串格式的数组) - 格式: [[[lng1, lat1], [lng2, lat2], [lng3, lat3], [lng1, lat1]]] - 示例: '[[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]' properties: 属性对象
- 类型: str (JSON 字符串) 或 None
- 格式: 键值对对象
- 示例: '{"name": "area", "type": "park"}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- id: 特征的标识符
- 示例: '{"bbox": [112, -28, 155, -14], "id": "polygon1"}' Returns: str: JSON 字符串格式的 GeoJSON Polygon Feature - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {...}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}, "properties": {"name": "area"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> coordinates = '[[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]' >>> properties = '{"name": "area"}' >>> result = asyncio.run(polygon(coordinates, properties)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}, "properties": {"name": "area"}}' Notes: - 输入参数 coordinates、properties 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 多边形必须形成闭合环,首尾坐标点必须相同 - 支持带孔的多边形(多个环) - 依赖于 Turf.js 库和 Node.js 环境 |
| interpolation_interpolate | 使用反距离权重法进行空间插值。 此功能根据已知点的属性值,使用反距离权重法在网格上估计属性值。 Args: points: 已知点的特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"elevation": 100}}, ...]}' cell_size: 网格单元大小
- 类型: float
- 描述: 每个网格单元的距离
- 示例: 100.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- gridType: 网格类型 ('square', 'point', 'hex', 'triangle') (默认: 'square')
- property: 用于插值的属性名 (默认: 'elevation')
- units: 距离单位 (默认: 'kilometers')
- weight: 距离衰减权重指数 (默认: 1)
- bbox: 边界框数组 [minX, minY, maxX, maxY]
- 示例: '{"gridType": "point", "property": "temperature", "units": "miles"}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point or Polygon features - 格式: {"type": "FeatureCollection", "features": [...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"temperature": 25.5}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"temperature": 25.5}}]}' >>> result = asyncio.run(interpolate(points, 100.0, '{"gridType": "point", "property": "temperature"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"temperature": 25.5}}, ...]}' Notes: - 输入参数 points 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 反距离权重法假设距离越近的点对插值结果影响越大 - 依赖于 Turf.js 库和 Node.js 环境 |
| interpolation_isobands | 从点网格生成等值带。 此功能从具有z值的点网格生成填充的等值带,用于创建连续值的区域表示。 Args: point_grid: 点网格特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features (必须是方形或矩形网格) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"elevation": 100}}, ...]}' breaks: 等值带断点数组
- 类型: str (JSON 字符串格式的数组)
- 格式: [break1, break2, break3, ...]
- 示例: '[0, 10, 20, 30, 40]'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- zProperty: z值属性名 (默认: 'elevation')
- commonProperties: 传递给所有等值带的属性对象
- breaksProperties: 按顺序传递给对应等值带的属性对象数组
- 示例: '{"zProperty": "temperature", "commonProperties": {"type": "isoband"}}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with MultiPolygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [...]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [...]}, "properties": {"min": 0, "max": 10}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point_grid = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"temperature": 25.5}}]}' >>> breaks = '[0, 10, 20, 30]' >>> result = asyncio.run(isobands(point_grid, breaks, '{"zProperty": "temperature"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [...]}, "properties": {"min": 0, "max": 10}}, ...]}' Notes: - 输入参数 point_grid、breaks 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 点网格必须是方形或矩形排列 - 等值带用于可视化连续数据的范围 - 依赖于 Turf.js 库和 Node.js 环境 |
| interpolation_isolines | 从点网格生成等值线。 此功能从具有z值的点网格生成等值线,用于创建连续值的线状表示。 Args: point_grid: 点网格特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features (必须是方形或矩形网格) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"elevation": 100}}, ...]}' breaks: 等值线断点数组
- 类型: str (JSON 字符串格式的数组)
- 格式: [break1, break2, break3, ...]
- 示例: '[0, 10, 20, 30, 40]'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- zProperty: z值属性名 (默认: 'elevation')
- commonProperties: 传递给所有等值线的属性对象
- breaksProperties: 按顺序传递给对应等值线的属性对象数组
- 示例: '{"zProperty": "temperature", "commonProperties": {"type": "isolines"}}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with LineString features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}, "properties": {"value": 10}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point_grid = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"temperature": 25.5}}]}' >>> breaks = '[0, 10, 20, 30]' >>> result = asyncio.run(isolines(point_grid, breaks, '{"zProperty": "temperature"}')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}, "properties": {"value": 10}}, ...]}' Notes: - 输入参数 point_grid、breaks 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 点网格必须是方形或矩形排列 - 等值线用于可视化连续数据的等值边界 - 依赖于 Turf.js 库和 Node.js 环境 |
| interpolation_planepoint | 计算点在三角形平面上的z值。 此功能根据三角形三个顶点的z值,计算给定点在三角形平面上的插值z值。 Args: point: 点特征 - 类型: str (JSON 字符串格式的 GeoJSON Feature) - 格式: Feature with Point geometry - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.3221, 39.529]}}' triangle: 三角形特征
- 类型: str (JSON 字符串格式的 GeoJSON Feature)
- 格式: Feature with Polygon geometry (必须包含三个顶点)
- 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-75.1221, 39.57], [-75.58, 39.18], [-75.97, 39.86], [-75.1221, 39.57]]]}, "properties": {"a": 11, "b": 122, "c": 44}}' Returns: str: JSON 字符串格式的z值结果 - 类型: 包含 value 的对象 - 格式: {"value": z值} - 示例: '{"value": 35.5}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.3221, 39.529]}}' >>> triangle = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-75.1221, 39.57], [-75.58, 39.18], [-75.97, 39.86], [-75.1221, 39.57]]]}, "properties": {"a": 11, "b": 122, "c": 44}}' >>> result = asyncio.run(planepoint(point, triangle)) >>> print(result) '{"value": 35.5}' Notes: - 输入参数 point 和 triangle 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 三角形必须包含三个顶点,且首尾坐标相同形成闭合环 - 三角形属性'a', 'b', 'c'分别对应三个顶点的z值 - 依赖于 Turf.js 库和 Node.js 环境 |
| interpolation_tin | 从点集创建不规则三角网。 此功能从点集创建不规则三角网,用于表面建模和地形分析。 Args: points: 点特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"elevation": 100}}, ...]}' z_property: z值属性名
- 类型: str 或 None
- 描述: 用于z值的属性名,如果为None则不添加额外数据
- 示例: 'elevation' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"a": 100, "b": 150, "c": 120}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984], "properties": {"elevation": 100}}]}' >>> result = asyncio.run(tin(points, 'elevation')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}, "properties": {"a": 100, "b": 150, "c": 120}}, ...]}' Notes: - 输入参数 points 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 不规则三角网用于创建连续的表面模型 - 每个三角形包含三个顶点的z值属性 - 依赖于 Turf.js 库和 Node.js 环境 |
| joins_pointsWithinPolygon | 查找多边形内部的点。 此功能识别位于多边形或多边形集合内部的点特征,返回这些点特征。 Args: points: 点特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' polygons: 多边形特征集合
- 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection)
- 格式: FeatureCollection with Polygon or MultiPolygon features
- 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}}, ...]}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}]}' >>> polygons = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}}]}' >>> result = asyncio.run(pointsWithinPolygon(points, polygons)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Notes: - 输入参数 points 和 polygons 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 仅返回位于多边形内部的点 - 位于多边形边界上的点可能被视为内部或外部,取决于具体实现 - 依赖于 Turf.js 库和 Node.js 环境 |
| joins_tag | 为点特征添加多边形属性。 此功能将多边形特征的属性值关联到位于多边形内部的点特征上。 Args: points: 点特征集合 - 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection) - 格式: FeatureCollection with Point features - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' polygons: 多边形特征集合
- 类型: str (JSON 字符串格式的 GeoJSON FeatureCollection)
- 格式: FeatureCollection with Polygon or MultiPolygon features
- 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]], "properties": {"name": "Area A"}}, ...]}'
field: 源字段名
- 类型: str
- 描述: 多边形特征中要提取的属性字段名
- 示例: 'name'
out_field: 输出字段名
- 类型: str
- 描述: 点特征中要创建的属性字段名
- 示例: 'area_name' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {...}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"area_name": "Area A"}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> points = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}]}' >>> polygons = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]], "properties": {"name": "Area A"}}]}' >>> result = asyncio.run(tag(points, polygons, 'name', 'area_name')) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}, "properties": {"area_name": "Area A"}}, ...]}' Notes: - 输入参数 points 和 polygons 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 仅对位于多边形内部的点添加属性 - 如果一个点位于多个多边形内,将使用最后一个匹配的多边形属性 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_along | 在线上计算指定距离处的点位置。 此功能沿着给定线段从起点开始移动指定距离,找到对应的坐标点位置。 Args: line: GeoJSON LineString 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[-83, 30], [-84, 36], [-78, 41]]}' distance: 沿线的距离
- 类型: float
- 描述: 从起点开始沿线的距离值
- 范围: 0 到线的总长度(超出范围会自动截断到端点)
- 示例: 200.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 其他 Turf.js 支持的选项参数
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 33.2]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-83, 30], [-84, 36], [-78, 41]]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(along(line, 200, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 33.2]}}' Notes: - 如果距离超过线长度,会自动返回线终点 - 如果距离为负值,会自动返回线起点 - 输入参数 line 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_area | 计算多边形区域的面积。 此功能计算给定多边形区域的面积,返回以平方米为单位的数值结果。 Args: polygon: GeoJSON 多边形特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Polygon 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}' Returns: str: JSON 字符串格式的面积结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 面积数值, "units": "square meters"} - 示例: '{"value": 1234567.89, "units": "square meters"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}' >>> result = asyncio.run(area(polygon)) >>> print(result) '{"value": 1234567.89, "units": "square meters"}' Notes: - 输入参数 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回的面积单位为平方米 - 依赖于 Turf.js 库和 Node.js 环境 - 支持 Polygon 和 MultiPolygon 几何类型 |
| measurement_bbox | 计算地理对象的边界范围。 此功能计算给定地理对象的边界框,返回包含对象的最小矩形范围坐标。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' Returns: str: JSON 字符串格式的边界框数组 - 类型: 数组 [minX, minY, maxX, maxY] - 格式: [最小经度, 最小纬度, 最大经度, 最大纬度] - 示例: '[-82, 35, -74, 42]' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' >>> result = asyncio.run(bbox(line)) >>> print(result) '[-82, 35, -74, 42]' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回的边界框格式为 [minX, minY, maxX, maxY] - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_bboxPolygon | 将边界框转换为多边形特征。 此功能将边界框坐标转换为完整的多边形几何图形,便于进行多边形操作和可视化。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) - 格式: [minX, minY, maxX, maxY] - 示例: '[-82, 35, -74, 42]' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- properties: 传递给多边形的属性对象
- id: 传递给多边形的 ID
- 示例: '{"properties": {"name": "bounding box"}, "id": "bbox1"}' Returns: str: JSON 字符串格式的 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-82, 35], [-74, 35], [-74, 42], [-82, 42], [-82, 35]]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-82, 35, -74, 42]' >>> options = '{"properties": {"name": "bounding box"}}' >>> result = asyncio.run(bboxPolygon(bbox, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-82, 35], [-74, 35], [-74, 42], [-82, 42], [-82, 35]]]}}' Notes: - 输入参数 bbox 和 options 必须是有效的 JSON 字符串 - 边界框格式为 [minX, minY, maxX, maxY] - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_bearing | 计算两点之间的地理方位角。 该函数使用 Turf.js 库的 bearing 方法,计算从第一个点到第二个点的方位角。 Args: point1: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' point2: 终点 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-75.534, 39.123]}' Returns: str: JSON 字符串格式的方位角结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 方位角数值, "units": "degrees"} - 示例: '{"value": 45.5, "units": "degrees"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point1 = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> point2 = '{"type": "Point", "coordinates": [-75.534, 39.123]}' >>> result = asyncio.run(bearing(point1, point2)) >>> print(result) '{"value": 45.5, "units": "degrees"}' Notes: - 输入参数 point1 和 point2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 方位角是从北方向顺时针测量的角度 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_center | 计算特征集合的中心点。 此功能计算给定特征集合的几何中心,返回所有特征边界框的中心点位置。 Args: geojson: GeoJSON 特征集合 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-97.522259, 35.4691]}}, ...]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- properties: 传递给中心点的属性对象
- bbox: 边界框数组
- id: 传递给中心点的 ID
- 示例: '{"properties": {"name": "center point"}}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-97.5, 35.5]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-97.522259, 35.4691]}}]}' >>> options = '{"properties": {"name": "center point"}}' >>> result = asyncio.run(center(geojson, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-97.5, 35.5]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回的中心点是所有特征边界框的中心 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_centerOfMass | 计算 GeoJSON 对象的质心。 该函数使用 Turf.js 库的 centerOfMass 方法,计算给定 GeoJSON 对象的质心。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- properties: 传递给质心的属性对象
- 示例: '{"properties": {"name": "center of mass"}}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 35.5]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' >>> options = '{"properties": {"name": "center of mass"}}' >>> result = asyncio.run(centerOfMass(polygon, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 35.5]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 质心是基于几何形状的质量分布计算的中心点 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_centroid | 计算几何对象的中心点。 此功能计算给定几何对象的几何中心,通过平均所有顶点坐标确定中心位置。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- properties: 传递给几何中心的属性对象
- 示例: '{"properties": {"name": "centroid"}}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 35.5]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' >>> options = '{"properties": {"name": "centroid"}}' >>> result = asyncio.run(centroid(polygon, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 35.5]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 几何中心是通过平均所有顶点坐标计算的中心点 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_destination | 从起点计算指定距离和方位角的目标点。 此功能从给定起点出发,沿着指定方位角移动指定距离,计算并返回目标点的位置坐标。 Args: origin: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' distance: 移动距离
- 类型: float
- 描述: 从起点开始移动的距离值
- 示例: 50.0
bearing: 方位角
- 类型: float
- 描述: 从北方向顺时针测量的角度
- 范围: -180 到 180 度
- 示例: 90.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给目标点的属性对象
- 示例: '{"units": "miles", "properties": {"name": "destination"}}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-74.5, 39.5]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> origin = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> options = '{"units": "miles", "properties": {"name": "destination"}}' >>> result = asyncio.run(destination(origin, 50.0, 90.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-74.5, 39.5]}}' Notes: - 输入参数 origin 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 方位角是从北方向顺时针测量的角度 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_distance | 计算两点之间的球面距离。 此功能计算地球上两点之间的实际距离,考虑地球曲率,返回指定单位的距离值。 Args: point1: 第一个 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' point2: 第二个 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-75.534, 39.123]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的距离结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 距离数值, "units": "距离单位"} - 示例: '{"value": 123.45, "units": "miles"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point1 = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> point2 = '{"type": "Point", "coordinates": [-75.534, 39.123]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(distance(point1, point2, options)) >>> print(result) '{"value": 123.45, "units": "miles"}' Notes: - 输入参数 point1、point2 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算的是两点之间的球面距离 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_envelope | 将地理对象转换为边界框多边形。 此功能计算给定地理对象的边界框,并将其转换为完整的多边形几何图形,便于进行多边形操作。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Returns: str: JSON 字符串格式的 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-82, 35], [-74, 35], [-74, 42], [-82, 42], [-82, 35]]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}]}' >>> result = asyncio.run(envelope(geojson)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-82, 35], [-74, 35], [-74, 42], [-82, 42], [-82, 35]]]}}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 包络多边形是包含所有输入特征的最小边界框多边形 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_length | 计算线或多线的长度。 此功能计算给定线或多线几何图形的实际长度,考虑地球曲率,返回指定单位的长度值。 Args: geojson: GeoJSON 线或多线对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 或 MultiLineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的长度结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 长度数值, "units": "距离单位"} - 示例: '{"value": 123.45, "units": "miles"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(length(line, options)) >>> print(result) '123.45' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算的是线或多线的球面长度 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_midpoint | 计算两点之间的中点。 该函数使用 Turf.js 库的 midpoint 方法,计算两个 GeoJSON 点特征之间的中点。 Args: point1: 第一个 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [144.834823, -37.771257]}' point2: 第二个 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [145.14244, -37.830937]}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [144.9886315, -37.801097]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point1 = '{"type": "Point", "coordinates": [144.834823, -37.771257]}' >>> point2 = '{"type": "Point", "coordinates": [145.14244, -37.830937]}' >>> result = asyncio.run(midpoint(point1, point2)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [144.9886315, -37.801097]}}' Notes: - 输入参数 point1 和 point2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算的是两点之间的球面中点 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_pointOnFeature | 在 GeoJSON 特征上找到最近的点。 该函数使用 Turf.js 库的 pointOnFeature 方法,在给定的 GeoJSON 特征上找到最近的点。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 35.5]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]}' >>> result = asyncio.run(pointOnFeature(polygon)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.5, 35.5]}}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回的特征上最近的点 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_pointToLineDistance | 计算点到线的最短距离。 该函数使用 Turf.js 库的 pointToLineDistance 方法,计算点到线的最短距离。 Args: point: 点 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' line: 线 GeoJSON 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON LineString 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- method: 计算方法 (默认: 'geodesic')
- 有效值: 'geodesic', 'planar'
- 示例: '{"units": "miles", "method": "geodesic"}' Returns: str: JSON 字符串格式的距离结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 距离数值, "units": "距离单位"} - 示例: '{"value": 12.34, "units": "miles"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> line = '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' >>> options = '{"units": "miles", "method": "geodesic"}' >>> result = asyncio.run(pointToLineDistance(point, line, options)) >>> print(result) '12.34' Notes: - 输入参数 point、line 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算的是点到线的最短球面距离 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_rhumbBearing | 计算两点之间的恒向线方位角。 该函数使用 Turf.js 库的 rhumbBearing 方法,计算从第一个点到第二个点的恒向线方位角。 Args: point1: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' point2: 终点 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-75.534, 39.123]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- final: 是否计算最终方位角 (默认: False)
- 示例: '{"final": true}' Returns: str: JSON 字符串格式的方位角结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 方位角数值, "units": "degrees"} - 示例: '{"value": 45.5, "units": "degrees"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point1 = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> point2 = '{"type": "Point", "coordinates": [-75.534, 39.123]}' >>> options = '{"final": true}' >>> result = asyncio.run(rhumbBearing(point1, point2, options)) >>> print(result) '45.5' Notes: - 输入参数 point1、point2 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 恒向线方位角是沿着恒向线(等角航线)的方位角 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_rhumbDestination | 沿恒向线计算目标点。 该函数使用 Turf.js 库的 rhumbDestination 方法,从起点沿着指定恒向线方位角移动指定距离来计算目标点。 Args: origin: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' distance: 移动距离
- 类型: float
- 描述: 从起点开始移动的距离值
- 示例: 50.0
bearing: 恒向线方位角
- 类型: float
- 描述: 从北方向顺时针测量的恒向线角度
- 范围: -180 到 180 度
- 示例: 90.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- properties: 传递给目标点的属性对���
- 示例: '{"units": "miles", "properties": {"name": "rhumb destination"}}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}} - 示例: '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-74.5, 39.5]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> origin = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> options = '{"units": "miles", "properties": {"name": "rhumb destination"}}' >>> result = asyncio.run(rhumbDestination(origin, 50.0, 90.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-74.5, 39.5]}}' Notes: - 输入参数 origin 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 恒向线方位角是沿着恒向线(等角航线)的方位角 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_rhumbDistance | 计算两点之间的恒向线距离。 该函数使用 Turf.js 库的 rhumbDistance 方法,计算两个 GeoJSON 点特征之间的恒向线距离。 Args: point1: 第一个 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}' point2: 第二个 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-75.534, 39.123]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的距离结果对象 - 类型: 包含 value 和 units 的对象 - 格式: {"value": 距离数值, "units": "距离单位"} - 示例: '{"value": 123.45, "units": "miles"}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point1 = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> point2 = '{"type": "Point", "coordinates": [-75.534, 39.123]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(rhumbDistance(point1, point2, options)) >>> print(result) '123.45' Notes: - 输入参数 point1、point2 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算的是两点之间的恒向线距离(等角航线距离) - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_square | 计算包含边界框的最小正方形边界框。 该函数使用 Turf.js 库的 square 方法,计算包含给定边界框的最小正方形边界框。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) - 格式: [minX, minY, maxX, maxY] - 示例: '[-20, -20, -15, 0]' Returns: str: JSON 字符串格式的正方形边界框数组 - 类型: 数组 [minX, minY, maxX, maxY] - 格式: [最小经度, 最小纬度, 最大经度, 最大纬度] - 示例: '[-20, -20, 0, 0]' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-20, -20, -15, 0]' >>> result = asyncio.run(square(bbox)) >>> print(result) '[-20, -20, 0, 0]' Notes: - 输入参数 bbox 必须是有效的 JSON 字符串 - 边界框格式为 [minX, minY, maxX, maxY] - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回的是包含输入边界框的最小正方形边界框 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_greatCircle | 计算两点之间的大圆路径。 该函数使用 Turf.js 库的 greatCircle 方法,计算两个 GeoJSON 点特征之间的大圆路径。 Args: start: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-122, 48]}' end: 终点 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-77, 39]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- properties: 传递给大圆路径的属性对象
- npoints: 路径上的点数 (默认: 100)
- offset: 控制跨越日期变更线时路径分割的可能性 (默认: 10)
- 示例: '{"properties": {"name": "Seattle to DC"}, "npoints": 200}' Returns: str: JSON 字符串格式的 GeoJSON LineString 或 MultiLineString 特征 - 类型: GeoJSON Feature with LineString or MultiLineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} 或 {"type": "Feature", "geometry": {"type": "MultiLineString", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-122, 48], [-120, 47], ...]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> start = '{"type": "Point", "coordinates": [-122, 48]}' >>> end = '{"type": "Point", "coordinates": [-77, 39]}' >>> options = '{"properties": {"name": "Seattle to DC"}, "npoints": 200}' >>> result = asyncio.run(greatCircle(start, end, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-122, 48], [-120, 47], ...]}}' Notes: - 输入参数 start、end 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果起点和终点跨越日期变更线,结果可能是 MultiLineString - 大圆路径是球面上两点之间的最短路径 - 依赖于 Turf.js 库和 Node.js 环境 |
| measurement_polygonTangents | 计算多边形上的切线点。 该函数使用 Turf.js 库的 polygonTangents 方法,计算从给定点到多边形(或多边形集合)的两个切线点。 Args: point: 点 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [61, 5]}' polygon: 多边形 GeoJSON 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Polygon 或 MultiPolygon 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Polygon", "coordinates": [[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng1, lat1]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng2, lat2]}}]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [15, 8]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [25, 3]}}]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> point = '{"type": "Point", "coordinates": [61, 5]}' >>> polygon = '{"type": "Polygon", "coordinates": [[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]}' >>> result = asyncio.run(polygonTangents(point, polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [15, 8]}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [25, 3]}}]}' Notes: - 输入参数 point 和 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回两个切线点,分别对应多边形的两个切线 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_kinks | 查找几何图形中的自相交点。 此功能检测线或多边形几何图形中的自相交点(扭结点),返回这些交叉点的位置坐标。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 LineString、MultiLineString、Polygon、MultiPolygon - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-12.034835, 8.901183], [-12.060413, 8.899826], [-12.03638, 8.873199], [-12.059383, 8.871418], [-12.034835, 8.901183]]]}' Returns: str: JSON 字符串格式的点特征集合 - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[-12.034835, 8.901183], [-12.060413, 8.899826], [-12.03638, 8.873199], [-12.059383, 8.871418], [-12.034835, 8.901183]]]}' >>> result = asyncio.run(kinks(polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-12.045, 8.885]}}]}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回所有自相交点的位置坐标 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_arc | 创建圆弧线段。 此功能以给定点为中心,创建指定半径和方位角范围的圆弧线段。 Args: center: 中心点 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75, 40]}' radius: 圆弧半径
- 类型: float
- 描述: 圆弧的半径值
- 示例: 5.0
bearing1: 起始方位角
- 类型: float
- 描述: 圆弧起始方位角(从北方向顺时针测量)
- 示例: 25.0
bearing2: 结束方位角
- 类型: float
- 描述: 圆弧结束方位角(从北方向顺时针测量)
- 示例: 45.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- steps: 圆弧分段数 (默认: 64)
- properties: 传递给圆弧线的属性对象
- 示例: '{"units": "miles", "steps": 32}' Returns: str: JSON 字符串格式的 GeoJSON LineString 特征 - 类型: GeoJSON Feature with LineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> center = '{"type": "Point", "coordinates": [-75, 40]}' >>> options = '{"units": "miles", "steps": 32}' >>> result = asyncio.run(line_arc(center, 5.0, 25.0, 45.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-75, 40], ...]}}' Notes: - 输入参数 center 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 方位角是从北方向顺时针测量的角度 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_chunk | 将线分割为指定长度的线段。 此功能将线或多线几何图形分割为多个指定长度的线段,便于分段处理和分析。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection, Geometry 或 Feature 规范,包含 LineString 或 MultiLineString - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[-95, 40], [-93, 45], [-85, 50]]}' segment_length: 线段长度
- 类型: float
- 描述: 每个线段的长度值
- 示例: 15.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- reverse: 是否反转坐标顺序 (默认: false)
- 示例: '{"units": "miles", "reverse": false}' Returns: str: JSON 字符串格式的线特征集合 - 类型: GeoJSON FeatureCollection with LineString features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-95, 40], [-93, 45], [-85, 50]]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(line_chunk(line, 15.0, options)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果线长度小于分段长度,则返回原始线 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_intersect | 计算两条线的交点。 此功能计算两条线或多边形几何图形之间的交点,返回所有交叉点的位置坐标。 Args: line1: 第一条线 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 LineString、MultiLineString、Polygon、MultiPolygon - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[126, -11], [129, -21]]}' line2: 第二条线 GeoJSON 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 支持 LineString、MultiLineString、Polygon、MultiPolygon
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "LineString", "coordinates": [[123, -18], [131, -14]]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- removeDuplicates: 是否移除重复交点 (默认: true)
- ignoreSelfIntersections: 是否忽略自相交点 (默认: true)
- 示例: '{"removeDuplicates": true, "ignoreSelfIntersections": true}' Returns: str: JSON 字符串格式的点特征集合 - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line1 = '{"type": "LineString", "coordinates": [[126, -11], [129, -21]]}' >>> line2 = '{"type": "LineString", "coordinates": [[123, -18], [131, -14]]}' >>> result = asyncio.run(line_intersect(line1, line2)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [127.5, -16]}}]}' Notes: - 输入参数 line1 和 line2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回两条线之间的所有交点 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_overlap | 查找两条线的重叠部分。 此功能计算两条线几何图形之间的重叠线段,返回这些重叠部分的几何图形。 Args: line1: 第一条线 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 LineString、MultiLineString、Polygon、MultiPolygon - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[115, -35], [125, -30], [135, -30], [145, -35]]}' line2: 第二条线 GeoJSON 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 支持 LineString、MultiLineString、Polygon、MultiPolygon
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "LineString", "coordinates": [[115, -25], [125, -30], [135, -30], [145, -25]]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- tolerance: 容差距离
- 示例: '{"tolerance": 0.01}' Returns: str: JSON 字符串格式的线特征集合 - 类型: GeoJSON FeatureCollection with LineString features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line1 = '{"type": "LineString", "coordinates": [[115, -35], [125, -30], [135, -30], [145, -35]]}' >>> line2 = '{"type": "LineString", "coordinates": [[115, -25], [125, -30], [135, -30], [145, -25]]}' >>> result = asyncio.run(line_overlap(line1, line2)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[125, -30], [135, -30]]}}]}' Notes: - 输入参数 line1 和 line2 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回两条线之间的所有重叠线段 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_segment | 将几何图形分解为线段。 此功能将线或多边形几何图形分解为独立的线段,每个线段包含两个顶点坐标。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 LineString、MultiLineString、Polygon、MultiPolygon - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]}' Returns: str: JSON 字符串格式的线特征集合 - 类型: GeoJSON FeatureCollection with LineString features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]}' >>> result = asyncio.run(line_segment(polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-50, 5], [-40, -10]]}}, ...]}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回所有几何图形的独立线段 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_slice | 在线段上截取指定起点和终点之间的部分。 此功能在线段上找到与起点和终点最近的位置,并截取这两点之间的线段部分。 Args: start_point: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-77.029609, 38.881946]}' end_point: 终点 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-77.021884, 38.889563]}'
line: 线 GeoJSON 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON LineString 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "LineString", "coordinates": [[-77.031669, 38.878605], [-77.029609, 38.881946], [-77.020339, 38.884084], [-77.025661, 38.885821], [-77.021884, 38.889563], [-77.019824, 38.892368]]}' Returns: str: JSON 字符串格式的 GeoJSON LineString 特征 - 类型: GeoJSON Feature with LineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> start = '{"type": "Point", "coordinates": [-77.029609, 38.881946]}' >>> end = '{"type": "Point", "coordinates": [-77.021884, 38.889563]}' >>> line = '{"type": "LineString", "coordinates": [[-77.031669, 38.878605], [-77.029609, 38.881946], [-77.020339, 38.884084], [-77.025661, 38.885821], [-77.021884, 38.889563], [-77.019824, 38.892368]]}' >>> result = asyncio.run(line_slice(start, end, line)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-77.029609, 38.881946], [-77.021884, 38.889563]]}}' Notes: - 输入参数 start_point、end_point 和 line 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 截取起点和终点之间的线段部分 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_slice_along | 沿线段长度截取指定距离范围的部分。 此功能根据起点距离和终点距离在线段上截取对应的部分,便于按长度分割线段。 Args: line: 线 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[7, 45], [9, 45], [14, 40], [14, 41]]}' start_distance: 起点距离
- 类型: float
- 描述: 从线段起点开始的截取起始距离
- 示例: 12.5
stop_distance: 终点距离
- 类型: float
- 描述: 从线段起点开始的截取结束距离
- 示例: 25.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的 GeoJSON LineString 特征 - 类型: GeoJSON Feature with LineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[7, 45], [9, 45], [14, 40], [14, 41]]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(line_slice_along(line, 12.5, 25.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[...]]}}' Notes: - 输入参数 line 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 根据距离范围截取线段部分 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_line_split | 用分割器将线段分割为多段。 此功能使用分割器几何图形将线段分割为多个部分,返回分割后的线段集合。 Args: line: 线 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[120, -25], [145, -25]]}' splitter: 分割器 GeoJSON 特征
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 任何有效的 GeoJSON 特征
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "LineString", "coordinates": [[130, -15], [130, -35]]}' Returns: str: JSON 字符串格式的线特征集合 - 类型: GeoJSON FeatureCollection with LineString features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[120, -25], [145, -25]]}' >>> splitter = '{"type": "LineString", "coordinates": [[130, -15], [130, -35]]}' >>> result = asyncio.run(line_split(line, splitter)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[120, -25], [130, -25]]}}, {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[130, -25], [145, -25]]}}]}' Notes: - 输入参数 line 和 splitter 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 使用分割器将线段分割为多个部分 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_mask | 使用掩膜多边形裁剪几何图形。 此功能使用掩膜多边形对输入多边形进行裁剪,返回掩膜范围内的多边形部分。 Args: polygons: 输入多边形 GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 Polygon、MultiPolygon、Feature、Feature、FeatureCollection<Polygon | MultiPolygon> - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]}' mask_polygon: 掩膜多边形 GeoJSON 对象
- 类型: str (JSON 字符串格式的 GeoJSON) 或 None
- 格式: 支持 Polygon、Feature<Polygon>
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Polygon", "coordinates": [[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- mutate: 是否修改原始掩膜多边形 (默认: false)
- 示例: '{"mutate": false}' Returns: str: JSON 字符串格式的 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygons = '{"type": "Polygon", "coordinates": [[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]}' >>> mask_polygon = '{"type": "Polygon", "coordinates": [[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]}' >>> result = asyncio.run(mask(polygons, mask_polygon)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}' Notes: - 输入参数 polygons 和 mask_polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未提供掩膜多边形,则使用世界范围作为掩膜 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_nearest_point_on_line | 找到线上距离给定点最近的位置。 此功能在线段上找到距离给定点最近的位置,返回该位置坐标及距离信息。 Args: line: 线 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[-77.031669, 38.878605], [-77.029609, 38.881946], [-77.020339, 38.884084], [-77.025661, 38.885821], [-77.021884, 38.889563], [-77.019824, 38.892368]]}' point: 点 GeoJSON 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-77.037076, 38.884017]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的 GeoJSON Point 特征 - 类型: GeoJSON Feature with Point geometry - 格式: {"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}, "properties": {"location": 距离起点位置, "distance": 距离值}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-77.031669, 38.878605], [-77.029609, 38.881946], [-77.020339, 38.884084], [-77.025661, 38.885821], [-77.021884, 38.889563], [-77.019824, 38.892368]]}' >>> point = '{"type": "Point", "coordinates": [-77.037076, 38.884017]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(nearest_point_on_line(line, point, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-77.03, 38.883]}, "properties": {"location": 0.5, "distance": 0.2}}' Notes: - 输入参数 line 和 point 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回线上距离给定点最近的位置及相关信息 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_sector | 创建扇形多边形区域。 此功能以给定点为中心,创建指定半径和方位角范围的扇形多边形区域。 Args: center: 中心点 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-75, 40]}' radius: 扇形半径
- 类型: float
- 描述: 扇形的半径值
- 示例: 5.0
bearing1: 起始方位角
- 类型: float
- 描述: 扇形起始方位角(从北方向顺时针测量)
- 示例: 25.0
bearing2: 结束方位角
- 类型: float
- 描述: 扇形结束方位角(从北方向顺时针测量)
- 示例: 45.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- steps: 扇形边界分段数 (默认: 64)
- properties: 传递给扇形的属性对象
- 示例: '{"units": "miles", "steps": 32}' Returns: str: JSON 字符串格式的 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> center = '{"type": "Point", "coordinates": [-75, 40]}' >>> options = '{"units": "miles", "steps": 32}' >>> result = asyncio.run(sector(center, 5.0, 25.0, 45.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-75, 40], ...]]}}' Notes: - 输入参数 center 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 方位角是从北方向顺时针测量的角度 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_shortest_path | 计算两点之间的最短路径。 此功能计算两个地理点之间的最短路径,考虑障碍物和地形因素,返回最优路径线段。 Args: start_point: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-122, 48]}' end_point: 终点 GeoJSON Point 特征或几何图形
- 类型: str (JSON 字符串格式的 GeoJSON)
- 格式: 必须符合 GeoJSON Point 规范
- 坐标系: WGS84 (经度在前,纬度在后)
- 示例: '{"type": "Point", "coordinates": [-77, 39]}'
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- obstacles: 障碍物 GeoJSON 特征集合
- resolution: 路径计算分辨率
- properties: 传递给路径的属性对象
- 示例: '{"resolution": 100}' Returns: str: JSON 字符串格式的 GeoJSON LineString 特征 - 类型: GeoJSON Feature with LineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> start = '{"type": "Point", "coordinates": [-122, 48]}' >>> end = '{"type": "Point", "coordinates": [-77, 39]}' >>> options = '{"resolution": 100}' >>> result = asyncio.run(shortest_path(start, end, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-122, 48], ...]]}}' Notes: - 输入参数 start_point 和 end_point 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算两点之间的最短路径,考虑地理因素 - 依赖于 Turf.js 库和 Node.js 环境 |
| misc_unkink_polygon | 消除多边形中的自相交部分。 此功能检测并消除多边形中的自相交部分(扭结),返回无自相交的多边形集合。 Args: polygon: 多边形 GeoJSON 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Polygon 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [0, 2], [2, 2], [0, 0]]]}' Returns: str: JSON 字符串格式的多边形特征集合 - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}, ...]} Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Polygon", "coordinates": [[[0, 0], [2, 0], [0, 2], [2, 2], [0, 0]]]}' >>> result = asyncio.run(unkink_polygon(polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [1, 1], [0, 2], [0, 0]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[1, 1], [2, 0], [2, 2], [1, 1]]]}}]}' Notes: - 输入参数 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 消除多边形中的自相交部分,返回多个无自相交的多边形 - 依赖于 Turf.js 库和 Node.js 环境 |
| random_randomPosition | 生成随机的地理坐标位置。 此功能在指定的边界框内随机生成一个地理坐标位置,返回经度和纬度坐标。 Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) 或 None - 格式: [minX, minY, maxX, maxY] - 默认: [-180, -90, 180, 90] (全球范围) - 示例: '[-180, -90, 180, 90]' Returns: str: JSON 字符串格式的坐标位置数组 - 类型: 数组 [经度, 纬度] - 格式: [lng, lat] - 示例: '[-75.343, 39.984]' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> bbox = '[-180, -90, 180, 90]' >>> result = asyncio.run(randomPosition(bbox)) >>> print(result) '[-75.343, 39.984]' Notes: - 输入参数 bbox 必须是有效的 JSON 字符串或 None - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未指定边界框,默认在全球范围内生成随机位置 - 依赖于 Turf.js 库和 Node.js 环境 |
| random_randomPoint | 生成随机点特征集合。 此功能在指定边界框内生成指定数量的随机点,返回点特征集合。 Args: count: 生成点的数量 - 类型: int - 默认: 1 - 示例: 25 options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY] (默认: [-180, -90, 180, 90])
- 示例: '{"bbox": [-180, -90, 180, 90]}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Point features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [lng, lat]}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> result = asyncio.run(randomPoint(25)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]}}, ...]}' Notes: - 输入参数 options 必须是有效的 JSON 字符串或 None - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未指定边界框,默认在全球范围内生成随机点 - 依赖于 Turf.js 库和 Node.js 环境 |
| random_randomLineString | 生成随机线特征集合。 此功能在指定边界框内生成指定数量的随机线,返回线特征集合。 Args: count: 生成线的数量 - 类型: int - 默认: 1 - 示例: 25 options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY] (默认: [-180, -90, 180, 90])
- num_vertices: 每条线的顶点数量 (默认: 10)
- max_length: 顶点与前一个顶点的最大距离 (默认: 0.0001)
- max_rotation: 线段与前一线段的最大旋转角度 (默认: Math.PI/8)
- 示例: '{"bbox": [-180, -90, 180, 90], "num_vertices": 10}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with LineString features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> result = asyncio.run(randomLineString(25)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}}, ...]}' Notes: - 输入参数 options 必须是有效的 JSON 字符串或 None - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未指定边界框,默认在全球范围内生成随机线 - 依赖于 Turf.js 库和 Node.js 环境 |
| random_randomPolygon | 生成随机多边形特征集合。 此功能在指定边界框内生成指定数量的随机多边形,返回多边形特征集合。 Args: count: 生成多边形的数量 - 类型: int - 默认: 1 - 示例: 25 options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- bbox: 边界框数组 [minX, minY, maxX, maxY] (默认: [-180, -90, 180, 90])
- num_vertices: 每个多边形的顶点数量 (默认: 10)
- max_radial_length: 顶点距离多边形中心的最大径向长度 (默认: 10)
- 示例: '{"bbox": [-180, -90, 180, 90], "num_vertices": 10}' Returns: str: JSON 字符串格式的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}, ...]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> result = asyncio.run(randomPolygon(25)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]}}, ...]}' Notes: - 输入参数 options 必须是有效的 JSON 字符串或 None - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未指定边界框,默认在全球范围内生成随机多边形 - 多边形会自动闭合,首尾坐标点相同 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_bboxClip | 将 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]]]}}' bbox: 边界框数组
- 类型: str (JSON 字符串格式的数组)
- 格式: [minX, minY, maxX, maxY]
- 示例: '[0, 0, 10, 10]' 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 环境 |
| transformation_bezierSpline | 将直线转换为平滑的贝塞尔曲线。 此功能将输入的直线路径转换为平滑的曲线路径,使线条更加流畅自然。 Args: line: GeoJSON LineString 特征 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-76.091308, 18.427501], [-76.695556, 18.729501], [-76.552734, 19.40443]]}}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- resolution: 分辨率控制点数 (默认: 10000)
- sharpness: 控制曲线锐度的参数 (默认: 0.85)
- 示例: '{"resolution": 20000, "sharpness": 0.5}' Returns: str: JSON 字符串格式的贝塞尔样条曲线 GeoJSON LineString 特征 - 类型: GeoJSON Feature with LineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-76.091308, 18.427501], [-76.5, 19.0], [-76.695556, 18.729501]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-76.091308, 18.427501], [-76.695556, 18.729501], [-76.552734, 19.40443]]}}' >>> options = '{"resolution": 20000, "sharpness": 0.5}' >>> result = asyncio.run(bezierSpline(line, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-76.091308, 18.427501], [-76.5, 19.0], [-76.695556, 18.729501]]}}' Notes: - 输入参数 line 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 生成的曲线会平滑原始 LineString 的路径 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_circle | 根据中心点和半径创建圆形区域。 此功能以指定的中心点和半径生成一个圆形多边形区域,可以控制圆形的平滑度和单位。 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 环境 |
| transformation_clone | 创建 GeoJSON 对象的完整副本。 此功能创建输入 GeoJSON 对象的深拷贝,包括所有属性和几何信息。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}, "properties": {"color": "red"}}' Returns: str: JSON 字符串格式的克隆后的 GeoJSON 对象 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 与输入相同的格式,包含所有属性和外成员 - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}, "properties": {"color": "red"}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}, "properties": {"color": "red"}}' >>> result = asyncio.run(clone(geojson)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}, "properties": {"color": "red"}}' Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 此方法比 JSON.parse + JSON.stringify 更快 - 包含所有可能的"外成员"(非标准属性) - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_concave | 计算点集的凹包。 该函数使用 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]}}, ...]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- maxEdge: 凹包边缘的最大长度 (默认: Infinity)
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"maxEdge": 1, "units": "miles"}' 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 环境 |
| transformation_convex | 计算点集的凸包。 该函数使用 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 环境 |
| transformation_difference | 计算两个多边形的差异。 该函数使用 Turf.js 库的 difference 方法,计算两个多边形的几何差异。 Args: featureCollection: 包含两个多边形的 GeoJSON FeatureCollection - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范,包含两个 Polygon 特征 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[128, -26], [141, -26], [141, -21], [128, -21], [128, -26]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[126, -28], [140, -28], [140, -20], [126, -20], [126, -28]]]}}]}' Returns: str: JSON 字符串格式的差异 GeoJSON Feature - 类型: GeoJSON Feature with Polygon or MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[128, -26], [141, -26], ...]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> featureCollection = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[128, -26], [141, -26], [141, -21], [128, -21], [128, -26]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[126, -28], [140, -28], [140, -20], [126, -20], [126, -28]]]}}]}' >>> result = asyncio.run(difference(featureCollection)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[128, -26], [141, -26], ...]]}}' Notes: - 输入参数 featureCollection 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 计算第一个多边形与第二个多边形的差异 - 返回第一个多边形中不在第二个多边形中的部分 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_dissolve | 合并相邻的多边形。 该函数使用 Turf.js 库的 dissolve 方法,合并相邻的多边形特征。 Args: featureCollection: 多边形特征集合 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范,包含 Polygon 特征 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, -1], [0, 0], [1, 0], [1, -1], [0,-1]]]}}]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- propertyName: 用于分组合并的属性名称
- 示例: '{"propertyName": "combine"}' Returns: str: JSON 字符串格式的合并后的 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, -1], [0, 1], [1, 1], [1, -1], [0, -1]]]}}]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> featureCollection = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, -1], [0, 0], [1, 0], [1, -1], [0,-1]]]}}]}' >>> options = '{"propertyName": "combine"}' >>> result = asyncio.run(dissolve(featureCollection, options)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, -1], [0, 1], [1, 1], [1, -1], [0, -1]]]}}]}' Notes: - 输入参数 featureCollection 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 不支持 MultiPolygon 特征 - 如果提供 propertyName,只有具有相同属性值的多边形才会被合并 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_intersect | 计算多边形的交集。 该函数使用 Turf.js 库的 intersect 方法,计算两个多边形的几何交集。 Args: featureCollection: 包含两个多边形的 GeoJSON FeatureCollection - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范,包含两个 Polygon 特征 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.801742, 45.48565], [-122.801742, 45.60491], [-122.584762, 45.60491], [-122.584762, 45.48565], [-122.801742, 45.48565]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.520217, 45.535693], [-122.64038, 45.553967], [-122.720031, 45.526554], [-122.669906, 45.507309], [-122.723464, 45.446643], [-122.532577, 45.408574], [-122.487258, 45.477466], [-122.520217, 45.535693]]]}}]}' Returns: str: JSON 字符串格式的交集 GeoJSON Feature - 类型: GeoJSON Feature with Polygon or MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} 或 null(如果没有交集) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.6, 45.5], [-122.5, 45.5], ...]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> featureCollection = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.801742, 45.48565], [-122.801742, 45.60491], [-122.584762, 45.60491], [-122.584762, 45.48565], [-122.801742, 45.48565]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.520217, 45.535693], [-122.64038, 45.553967], [-122.720031, 45.526554], [-122.669906, 45.507309], [-122.723464, 45.446643], [-122.532577, 45.408574], [-122.487258, 45.477466], [-122.520217, 45.535693]]]}}]}' >>> result = asyncio.run(intersect(featureCollection)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.6, 45.5], [-122.5, 45.5], ...]]}}' Notes: - 输入参数 featureCollection 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果没有交集,返回 null - 交集可以是 Point、LineString、Polygon 或 Multi* 几何类型 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_lineOffset | 计算线的偏移。 该函数使用 Turf.js 库的 lineOffset 方法,计算给定线的偏移线。 Args: line: GeoJSON LineString 或 MultiLineString 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON LineString 或 MultiLineString 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' distance: 偏移距离
- 类型: float
- 描述: 线的偏移距离,可以为负值
- 示例: 10.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- 示例: '{"units": "miles"}' Returns: str: JSON 字符串格式的偏移线 GeoJSON Feature - 类型: GeoJSON Feature with LineString or MultiLineString geometry - 格式: {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}} - 示例: '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74.1, 40.1], [-78.1, 42.1], [-82.1, 35.1]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-74, 40], [-78, 42], [-82, 35]]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(lineOffset(line, 10.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-74.1, 40.1], [-78.1, 42.1], [-82.1, 35.1]]}}' Notes: - 输入参数 line 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 距离可以为负值,表示相反方向的偏移 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_simplify | 简化 GeoJSON 几何。 该函数使用 Turf.js 库的 simplify 方法,简化给定的 GeoJSON 几何图形。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], [-70.659942, -33.394759], [-70.683975, -33.404504], [-70.697021, -33.419406], [-70.701141, -33.434306], [-70.700454, -33.446339], [-70.694274, -33.458369], [-70.682601, -33.465816], [-70.668869, -33.472117], [-70.646209, -33.473835], [-70.624923, -33.472117], [-70.609817, -33.468107], [-70.595397, -33.458369], [-70.587158, -33.442901], [-70.587158, -33.426283], [-70.590591, -33.414248], [-70.594711, -33.406224], [-70.603637, -33.399918]]]}' options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- tolerance: 简化容差 (默认: 1)
- highQuality: 是否使用高质量简化 (默认: false)
- mutate: 是否允许修改输入对象 (默认: false)
- 示例: '{"tolerance": 0.01, "highQuality": true}' Returns: str: JSON 字符串格式的简化后的 GeoJSON 对象 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 与输入相同的格式 - 示例: '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], ...]]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], [-70.659942, -33.394759], [-70.683975, -33.404504], [-70.697021, -33.419406], [-70.701141, -33.434306], [-70.700454, -33.446339], [-70.694274, -33.458369], [-70.682601, -33.465816], [-70.668869, -33.472117], [-70.646209, -33.473835], [-70.624923, -33.472117], [-70.609817, -33.468107], [-70.595397, -33.458369], [-70.587158, -33.442901], [-70.587158, -33.426283], [-70.590591, -33.414248], [-70.594711, -33.406224], [-70.603637, -33.399918]]]}' >>> options = '{"tolerance": 0.01, "highQuality": true}' >>> result = asyncio.run(simplify(geojson, options)) >>> print(result) '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], ...]]}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - tolerance 值越小,简化程度越低 - highQuality 为 true 时使用更精确但更慢的算法 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_tesselate | 将多边形分割为三角形。 该函数使用 Turf.js 库的 tesselate 方法,将给定的多边形分割为三角形集合。 Args: polygon: GeoJSON Polygon 特征 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Polygon 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]}}' Returns: str: JSON 字符串格式的三角形集合 GeoJSON FeatureCollection - 类型: GeoJSON FeatureCollection with Polygon features - 格式: {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}]} - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[11, 0], [22, 4], [31, 0], [11, 0]]]}}, ...]}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> polygon = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]}}' >>> result = asyncio.run(tesselate(polygon)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[11, 0], [22, 4], [31, 0], [11, 0]]]}}, ...]}' Notes: - 输入参数 polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 返回的三角形集合覆盖原始多边形的整个区域 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_transformRotate | 旋转 GeoJSON 对象。 该函数使用 Turf.js 库的 transformRotate 方法,围绕质心或指定枢轴点旋转 GeoJSON 对象。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[3.5,29],[2.5,32],[0,29]]]}}' angle: 旋转角度
- 类型: float
- 描述: 旋转角度(十进制度数),顺时针为正
- 示例: 10.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- pivot: 旋转枢轴点坐标 (默认: 'centroid')
- mutate: 是否允许修改输入对象 (默认: false)
- 示例: '{"pivot": [0, 25], "mutate": false}' Returns: str: JSON 字符串格式的旋转后的 GeoJSON 对象 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 与输入相同的格式 - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0.5,29.2],[3.8,29.1],[2.7,32.3],[0.5,29.2]]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[3.5,29],[2.5,32],[0,29]]]}}' >>> options = '{"pivot": [0, 25]}' >>> result = asyncio.run(transformRotate(geojson, 10.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0.5,29.2],[3.8,29.1],[2.7,32.3],[0.5,29.2]]]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 角度为十进制度数,顺时针为正 - 默认围绕几何图形的质心旋转 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_transformTranslate | 平移 GeoJSON 对象。 该函数使用 Turf.js 库的 transformTranslate 方法,沿恒向线移动 GeoJSON 对象。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[3.5,29],[2.5,32],[0,29]]]}}' distance: 移动距离
- 类型: float
- 描述: 移动距离,负值表示相反方向
- 示例: 100.0
direction: 移动方向
- 类型: float
- 描述: 移动方向(十进制度数),从北方向顺时针测量
- 示例: 35.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- units: 距离单位 (默认: 'kilometers')
- 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
- zTranslation: 垂直移动距离 (默认: 0)
- mutate: 是否允许修改输入对象 (默认: false)
- 示例: '{"units": "miles", "zTranslation": 10, "mutate": false}' Returns: str: JSON 字符串格式的平移后的 GeoJSON 对象 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 与输入相同的格式 - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0.6,29.3],[4.1,29.3],[3.1,32.3],[0.6,29.3]]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[3.5,29],[2.5,32],[0,29]]]}}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(transformTranslate(geojson, 100.0, 35.0, options)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0.6,29.3],[4.1,29.3],[3.1,32.3],[0.6,29.3]]]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 方向从北方向顺时针测量 - 距离可以为负值,表示相反方向移动 - 依赖于 Turf.js 库和 Node.js 环境 |
| transformation_transformScale | 缩放 GeoJSON 对象。 该函数使用 Turf.js 库的 transformScale 方法,从给定点缩放 GeoJSON 对象。 Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[3.5,29],[2.5,32],[0,29]]]}}' factor: 缩放因子
- 类型: float
- 描述: 缩放因子,例如 2 表示放大两倍
- 示例: 3.0
options: 可选参数配置
- 类型: str (JSON 字符串) 或 None
- 可选字段:
- origin: 缩放原点坐标 (默认: 'centroid')
- mutate: 是否允许修改输入对象 (默认: false)
- 示例: '{"origin": [0, 25], "mutate": false}' Returns: str: JSON 字符串格式的缩放后的 GeoJSON 对象 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 与输入相同的格式 - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[10.5,29],[7.5,32],[0,29]]]}}' Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常 Example: >>> import asyncio >>> geojson = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[3.5,29],[2.5,32],[0,29]]]}}' >>> result = asyncio.run(transformScale(geojson, 3.0)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0,29],[10.5,29],[7.5,32],[0,29]]]}}' Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 缩放因子为 2 表示尺寸加倍 - 默认从几何图形的质心缩放 - 对于 FeatureCollection,为每个特征单独计算原点 - 依赖于 Turf.js 库和 Node.js 环境 |