Map Grabber
Get site base maps from OpenStreetMap: provide an address, receive street network and optional building footprints as vector data (SVG, GeoPackage, or DXF) for use in CAD or Rhino.
Dependencies
- -
osmnx (OSM data and graph; requires geopandas, networkx) - INLINECODE3 (optional; for DXF export)
Setup: OpenClaw does not install Python packages automatically. After installing this skill, run once: pip install -r requirements.txt (from the skill folder). If a script fails with ModuleNotFoundError, install the missing package (osmnx pulls geopandas; for DXF add ezdxf).
Usage
Grab map by address
Parameters:
- -
address: Address or place name (e.g. "SoHo, New York" or "123 Main St, Los Angeles"). - INLINECODE7 : Radius in meters around the point (default 500).
- INLINECODE8 : Also download building footprints.
- INLINECODE9 : Output path for SVG (street network plot).
- INLINECODE10 : Output path for PNG (same map as image; use for Telegram or preview).
- INLINECODE11 : Output path for GeoPackage (streets and optionally buildings as layers).
- INLINECODE12 : Output path for DXF (requires ezdxf; for CAD/Rhino).
At least one of --svg, --png, --gpkg, or --dxf is required.
CODEBLOCK0
Output: street network (and optionally buildings) in the requested formats.
Sending images to Telegram
Used from the OpenClaw Telegram conversation. To show the user the map: run the script with --png <path>.png (e.g. --png site.png), then send that PNG to the conversation via the OpenClaw message/media tool. Use --png (not only --svg) when the user expects an image in chat.
OpenClaw allowed paths: The message tool only sends files from allowed dirs (~/.openclaw/media/, ~/.openclaw/agents/, or /tmp). Use e.g. --png ~/.openclaw/media/site.png or --png /tmp/site.png; do not use the skill install directory or sending will fail.
Agent behavior: When the user asks for a site map, base map, or OSM map (by address or place name), run the script directly using exec: call grab_map.py with the given address, --png <path>.png with <path> under an allowed dir (and optional --dist, --buildings), then send the generated PNG to the user. Do not ask for confirmation; execute and return the image and a short confirmation.
Examples
User: "Get me a site base map for 123 Main St" or "抓一张这个地址的场地底图."
Action: Run grab_map.py "123 Main St" --png /tmp/site.png (or similar path), then send the PNG to the user and confirm.
User: "Get me a site base map for 123 Main St as SVG and DXF."
Action: Run grab_map.py with that address, --svg, --dxf, and optionally --png for chat; return the file paths and confirmation.
User: "I need OSM data for this address with building footprints for Rhino."
Action: Run with --buildings, --gpkg and optionally --dxf; if they want an image in chat, also use --png and send it.
地图抓取器
从OpenStreetMap获取场地底图:提供地址,接收街道网络和可选的建筑轮廓作为矢量数据(SVG、GeoPackage或DXF),用于CAD或Rhino。
依赖项
- - osmnx(OSM数据和图形;需要geopandas、networkx)
- ezdxf(可选;用于DXF导出)
设置: OpenClaw不会自动安装Python包。安装此技能后,运行一次:pip install -r requirements.txt(从技能文件夹中)。如果脚本因ModuleNotFoundError失败,请安装缺失的包(osmnx会拉取geopandas;如需DXF请添加ezdxf)。
使用方法
按地址抓取地图
参数:
- - address:地址或地名(例如SoHo, New York或123 Main St, Los Angeles)。
- --dist:围绕点的半径(米),默认500。
- --buildings:同时下载建筑轮廓。
- --svg:SVG输出路径(街道网络图)。
- --png:PNG输出路径(相同地图的图片;用于Telegram或预览)。
- --gpkg:GeoPackage输出路径(街道和可选的建筑作为图层)。
- --dxf:DXF输出路径(需要ezdxf;用于CAD/Rhino)。
至少需要--svg、--png、--gpkg或--dxf中的一个。
bash
用于Telegram的PNG + GeoPackage
python3 scripts/grab_map.py Times Square, New York --dist 400 --png site.png --gpkg site.gpkg
带建筑和DXF
python3 scripts/grab_map.py Shanghai Tower, Shanghai --dist 500 --buildings --png site.png --gpkg site.gpkg --dxf site.dxf
输出:请求格式的街道网络(以及可选的建筑)。
发送图片到Telegram
从OpenClaw Telegram对话中使用。要向用户显示地图:使用--png <路径>.png(例如--png site.png)运行脚本,然后通过OpenClaw消息/媒体工具将该PNG发送到对话中。当用户期望在聊天中看到图片时,使用--png(而不仅仅是--svg)。
OpenClaw允许的路径: 消息工具只能从允许的目录(~/.openclaw/media/、~/.openclaw/agents/或/tmp)发送文件。使用例如--png ~/.openclaw/media/site.png或--png /tmp/site.png;不要使用技能安装目录,否则发送将失败。
代理行为: 当用户请求场地地图、底图或OSM地图(按地址或地名)时,使用exec直接运行脚本:使用给定的地址调用grab_map.py,使用--png <路径>.png且<路径>在允许的目录下(以及可选的--dist、--buildings),然后将生成的PNG发送给用户。无需请求确认;直接执行并返回图片和简短确认。
示例
用户: Get me a site base map for 123 Main St或抓一张这个地址的场地底图。
操作: 运行grab_map.py 123 Main St --png /tmp/site.png(或类似路径),然后将PNG发送给用户并确认。
用户: Get me a site base map for 123 Main St as SVG and DXF.
操作: 使用该地址运行grab_map.py,加上--svg、--dxf,以及可选的--png用于聊天;返回文件路径和确认。
用户: I need OSM data for this address with building footprints for Rhino.
操作: 使用--buildings、--gpkg和可选的--dxf运行;如果他们想要聊天中的图片,也使用--png并发送。