Skip to main content
Glama
es3154

Turf-MCP

by es3154

misc_mask

Crop geospatial polygons using a mask polygon to extract the overlapping area. This tool processes GeoJSON input in WGS84 coordinates and returns the clipped polygon geometry within the mask boundary.

Instructions

使用掩膜多边形裁剪几何图形。

此功能使用掩膜多边形对输入多边形进行裁剪,返回掩膜范围内的多边形部分。

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
polygonsYes
mask_polygonNo
optionsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

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