Geography
把 GeoJSON FeatureCollection 渲染为无 tile 依赖的可嵌入静态 SVG:OSM Carto 风格的水域/绿地/建筑/分等级道路,按 amenity/shop/tourism 标签分类的带标签 POI 图钉,叠加 GeoJSON LineString 路线并按测地方位角画方向箭头,含比例尺、经纬网格与完整 OSM 署名(© OpenStreetMap contributors,ODbL);可选 Nominatim 地理编码(≤5 查询、按官方政策限速并携带标识 User-Agent)叠加地点标记。
用三种语言从你的代码中调用此工具。
curl -X POST 'http://127.0.0.1:3003/zh/api/tools/openstreetmap-nominatim-geojson-static-svg-map-renderer-with-styled-poi-icons-and-route-overlay' \
-H 'Content-Type: application/json' \
-d '{"geojsonInput":"{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"natural\": \"water\",\n \"name\": \"Cold River\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.235,\n 52.632\n ],\n [\n -1.225,\n 52.636\n ],\n [\n -1.212,\n 52.633\n ],\n [\n -1.205,\n 52.637\n ],\n [\n -1.198,\n 52.634\n ],\n [\n -1.2,\n 52.63\n ],\n [\n -1.21,\n 52.628\n ],\n [\n -1.222,\n 52.63\n ],\n [\n -1.235,\n 52.632\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"leisure\": \"park\",\n \"name\": \"Riverside Park\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.232,\n 52.646\n ],\n [\n -1.218,\n 52.649\n ],\n [\n -1.21,\n 52.644\n ],\n [\n -1.222,\n 52.641\n ],\n [\n -1.232,\n 52.646\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"landuse\": \"residential\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.205,\n 52.648\n ],\n [\n -1.192,\n 52.65\n ],\n [\n -1.188,\n 52.642\n ],\n [\n -1.2,\n 52.64\n ],\n [\n -1.205,\n 52.648\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"building\": \"yes\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.203,\n 52.646\n ],\n [\n -1.199,\n 52.647\n ],\n [\n -1.197,\n 52.643\n ],\n [\n -1.201,\n 52.642\n ],\n [\n -1.203,\n 52.646\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"building\": \"yes\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.196,\n 52.646\n ],\n [\n -1.193,\n 52.647\n ],\n [\n -1.192,\n 52.644\n ],\n [\n -1.195,\n 52.643\n ],\n [\n -1.196,\n 52.646\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"highway\": \"motorway\"\n },\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -1.235,\n 52.651\n ],\n [\n -1.215,\n 52.647\n ],\n [\n -1.198,\n 52.649\n ],\n [\n -1.19,\n 52.652\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"highway\": \"residential\"\n },\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -1.213,\n 52.635\n ],\n [\n -1.206,\n 52.64\n ],\n [\n -1.198,\n 52.644\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"name\": \"Ridge Trail\"\n },\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -1.23,\n 52.65\n ],\n [\n -1.222,\n 52.648\n ],\n [\n -1.216,\n 52.644\n ],\n [\n -1.208,\n 52.645\n ],\n [\n -1.201,\n 52.648\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"amenity\": \"restaurant\",\n \"name\": \"Harbor Grill\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.21,\n 52.647\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"amenity\": \"cafe\",\n \"name\": \"Bean There\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.2,\n 52.642\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"tourism\": \"hotel\",\n \"name\": \"Lakeside Inn\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.194,\n 52.646\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"tourism\": \"viewpoint\",\n \"name\": \"Eagle Point\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.226,\n 52.648\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"amenity\": \"parking\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.216,\n 52.641\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"tourism\": \"attraction\",\n \"name\": \"Old Mill\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.205,\n 52.634\n ]\n }\n }\n ]\n}","nominatimQueries":"","svgWidth":960,"svgHeight":640,"showLabels":true,"showBearingArrows":true,"showScaleBar":true,"showGraticule":false,"writeSvgFile":false}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST http://127.0.0.1:3003/zh/api/tools/openstreetmap-nominatim-geojson-static-svg-map-renderer-with-styled-poi-icons-and-route-overlay| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| geojsonInput | textarea | 是 | — |
| nominatimQueries | text | 否 | — |
| svgWidth | number | 否 | — |
| svgHeight | number | 否 | — |
| showLabels | checkbox | 否 | — |
| showBearingArrows | checkbox | 否 | — |
| showScaleBar | checkbox | 否 | — |
| showGraticule | checkbox | 否 | — |
| writeSvgFile | checkbox | 否 | — |
HTML 结果
{
"result": "<div>Processed HTML content</div>",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
将以下内容加入你的 MCP 客户端配置:
{
"mcpServers": {
"elysiatools-openstreetmap-nominatim-geojson-static-svg-map-renderer-with-styled-poi-icons-and-route-overlay": {
"name": "openstreetmap-nominatim-geojson-static-svg-map-renderer-with-styled-poi-icons-and-route-overlay",
"description": "把 GeoJSON FeatureCollection 渲染为无 tile 依赖的可嵌入静态 SVG:OSM Carto 风格的水域/绿地/建筑/分等级道路,按 amenity/shop/tourism 标签分类的带标签 POI 图钉,叠加 GeoJSON LineString 路线并按测地方位角画方向箭头,含比例尺、经纬网格与完整 OSM 署名(© OpenStreetMap contributors,ODbL);可选 Nominatim 地理编码(≤5 查询、按官方政策限速并携带标识 User-Agent)叠加地点标记。",
"baseUrl": "http://127.0.0.1:3003/mcp/sse?toolId=openstreetmap-nominatim-geojson-static-svg-map-renderer-with-styled-poi-icons-and-route-overlay",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}连接到 SSE 端点后,列出已开放的工具:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}通过工具 id 调用,参数由其参数表构建:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "openstreetmap-nominatim-geojson-static-svg-map-renderer-with-styled-poi-icons-and-route-overlay",
"arguments": {
"geojsonInput": "{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"natural\": \"water\",\n \"name\": \"Cold River\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.235,\n 52.632\n ],\n [\n -1.225,\n 52.636\n ],\n [\n -1.212,\n 52.633\n ],\n [\n -1.205,\n 52.637\n ],\n [\n -1.198,\n 52.634\n ],\n [\n -1.2,\n 52.63\n ],\n [\n -1.21,\n 52.628\n ],\n [\n -1.222,\n 52.63\n ],\n [\n -1.235,\n 52.632\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"leisure\": \"park\",\n \"name\": \"Riverside Park\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.232,\n 52.646\n ],\n [\n -1.218,\n 52.649\n ],\n [\n -1.21,\n 52.644\n ],\n [\n -1.222,\n 52.641\n ],\n [\n -1.232,\n 52.646\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"landuse\": \"residential\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.205,\n 52.648\n ],\n [\n -1.192,\n 52.65\n ],\n [\n -1.188,\n 52.642\n ],\n [\n -1.2,\n 52.64\n ],\n [\n -1.205,\n 52.648\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"building\": \"yes\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.203,\n 52.646\n ],\n [\n -1.199,\n 52.647\n ],\n [\n -1.197,\n 52.643\n ],\n [\n -1.201,\n 52.642\n ],\n [\n -1.203,\n 52.646\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"building\": \"yes\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -1.196,\n 52.646\n ],\n [\n -1.193,\n 52.647\n ],\n [\n -1.192,\n 52.644\n ],\n [\n -1.195,\n 52.643\n ],\n [\n -1.196,\n 52.646\n ]\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"highway\": \"motorway\"\n },\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -1.235,\n 52.651\n ],\n [\n -1.215,\n 52.647\n ],\n [\n -1.198,\n 52.649\n ],\n [\n -1.19,\n 52.652\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"highway\": \"residential\"\n },\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -1.213,\n 52.635\n ],\n [\n -1.206,\n 52.64\n ],\n [\n -1.198,\n 52.644\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"name\": \"Ridge Trail\"\n },\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -1.23,\n 52.65\n ],\n [\n -1.222,\n 52.648\n ],\n [\n -1.216,\n 52.644\n ],\n [\n -1.208,\n 52.645\n ],\n [\n -1.201,\n 52.648\n ]\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"amenity\": \"restaurant\",\n \"name\": \"Harbor Grill\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.21,\n 52.647\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"amenity\": \"cafe\",\n \"name\": \"Bean There\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.2,\n 52.642\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"tourism\": \"hotel\",\n \"name\": \"Lakeside Inn\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.194,\n 52.646\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"tourism\": \"viewpoint\",\n \"name\": \"Eagle Point\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.226,\n 52.648\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"amenity\": \"parking\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.216,\n 52.641\n ]\n }\n },\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"tourism\": \"attraction\",\n \"name\": \"Old Mill\"\n },\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -1.205,\n 52.634\n ]\n }\n }\n ]\n}",
"nominatimQueries": "",
"svgWidth": 960,
"svgHeight": 640,
"showLabels": true,
"showBearingArrows": true,
"showScaleBar": true,
"showGraticule": false,
"writeSvgFile": false
}
}
}有问题或反馈?请联系 [email protected]