Skip to main content
Glama

Turf-MCP

by es3154

coordinate_mutation_rewind

Corrects polygon ring orientation to ensure outer rings are counter-clockwise and inner rings clockwise, maintaining geographic information system standards for accurate area calculations.

Instructions

修正多边形的环方向,确保外环逆时针、内环顺时针。

此功能自动调整多边形的环方向,符合地理信息系统标准,确保多边形区域计算正确。

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

Input Schema

NameRequiredDescriptionDefault
geojsonYes
optionsNo

Input Schema (JSON Schema)

{ "properties": { "geojson": { "type": "string" }, "options": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null } }, "required": [ "geojson" ], "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