Skip to main content
Glama

Turf-MCP

by es3154

misc_line_slice

Extract a segment from a line between specified start and end points using GeoJSON coordinates to isolate specific portions of linear geographic features.

Instructions

在线段上截取指定起点和终点之间的部分。

此功能在线段上找到与起点和终点最近的位置,并截取这两点之间的线段部分。

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

Input Schema

NameRequiredDescriptionDefault
end_pointYes
lineYes
start_pointYes

Input Schema (JSON Schema)

{ "properties": { "end_point": { "type": "string" }, "line": { "type": "string" }, "start_point": { "type": "string" } }, "required": [ "start_point", "end_point", "line" ], "type": "object" }

Other Tools from Turf-MCP

Related Tools

    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