Introduction¶
DeepSeek Harness (DSH) uses a plugin-based architecture that allows developers to extend its functionality. When working with geospatial data, plain command-line interaction often lacks intuitiveness. dsh-geolibre is designed to address this issue: it brings GeoLibre’s mapping capabilities into the DSH Web GUI and provides agents with a tool interface to operate a live map.
What It Is¶
This is a DSH plugin (dsh-geolibre) developed by maintainer baddying and released under the MIT license. It mainly does two things: first, it renders GeoJSON/vector data into an interactive GeoLibre map and synchronizes it to the session project; second, it enables agents to operate the live map through agent tools, including managing layers, styles, and views, as well as running GeoLibre algorithms and Whitebox WASM tools.
Installation and Enablement¶
Installing the plugin requires modifying the configuration files for the target DSH profile.
- Declare the dependency in
package.jsonand add it to the bundles:
{
"dependencies": { "dsh-geolibre": "0.1.0" },
"dsh": { "profile": { "bundles": ["…", "dsh-geolibre"] } }
}
- Configure the plugin parameters in
cordis.patch.yml(usually a Python environment needs to be specified):
- id: geolibre
config:
geolibreEnv: "" # 留空则自动探测,否则需显式指定 geolibre 包的安装目录
python: "python" # 默认 python 可执行文件
Prerequisites:
- Node.js >= 20
- Python 3 (requires the geolibre package, installable via pip install geolibre)
Core Features¶
The plugin provides four agent tools on the host side and implements a map interaction interface on the browser side.
1. Host-side Agent Tools¶
- geolibre_render_map: Accepts GeoJSON data (text/local file/URL), renders it as a map, and synchronizes it to the current session project.
- geolibre_map_status: Queries the real-time map session status, including the layer list, visibility, current view, and connection status.
- geolibre_map_run: Sends commands to a ready map and waits for results. Supported commands include:
getView,getCenter,getBounds,flyTo,fitBounds,zoomToLayer,identify,getLayerFeatures,getSelectedFeatures,getDrawnFeatures,listAlgorithms,runAlgorithm,runModelBuilder,listWhiteboxTools,runWhiteboxTool,toImage, etc. - geolibre_map_update: Performs bulk or partial updates to the project or layers. Supports operations such as replacing the entire project, adding layers, deleting/renaming/showing/hiding/changing styles of layers, and moving the view.
2. Browser-side Implementation¶
- Registers a “Map” sidebar tab with the GeoLibre app embedded.
- Acts as a bidirectional relay between the host process and the GeoLibre app in the iframe, communicating via message protocols such as
geolibre:load-project,geolibre:command, andstate. - The GeoLibre Web App is served locally from the same origin at
/dsh-geolibre/app/*, without relying on external CDNs.
Typical Usage¶
Agents can directly call the tools above to interact with the map.
-
Render Data:
The agent receives a user instruction and callsgeolibre_render_mapto render GeoJSON data as a map. -
Run an Algorithm:
First, find available algorithms viageolibre_map_run(method="listAlgorithms"), then callgeolibre_map_run(method="runAlgorithm", params={...})to perform the operation, for example creating a 100 km buffer for a layer. -
Update the View or Layers:
Callgeolibre_map_updateto update the map view (for example, moving to Shanghai) or update layer styles and data (for example, displaying all provincial capital cities).
Notes and Development¶
- Project State Source: The project and layer state use the session project in the host process as the single source of truth.
- Runtime Artifacts: Demo projects in the workspace (
.geolibre-maps/) are runtime artifacts and are not shipped with the package. - Refresh Mechanism: The refresh button at the top of the “Map” tab remounts the iframe and loads the current project from the host.
- Development Commands:
npm install # 安装开发依赖
npm test # 冒烟测试(纯 Node 检查 + 可选 Python 字节编译)
npm run prepack # 发布前语法检查
Short Closing¶
dsh-geolibre provides DSH with visualized map operation capabilities. Combined with GeoLibre’s processing algorithms and Whitebox WASM tools, it is suitable for scenarios that require geospatial analysis within agent workflows. For more details, see its GitHub repository.