Skip to main content
Glama
es3154
by es3154

misc_line_split

Split GeoJSON line segments into multiple parts using splitter geometries to divide spatial data for analysis and processing.

Instructions

用分割器将线段分割为多段。

此功能使用分割器几何图形将线段分割为多个部分,返回分割后的线段集合。

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 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lineYes
splitterYes

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/es3154/turf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server