跳到正文
Simon Willison·· 20 天前精选

Willison分享地图插件实践:让Claude先参考旧实现,再组合功能

AI 导读

Simon Willison称,他让Claude Fable 5.2先阅读两个现有地图插件和本地示例,再组合功能并尝试扩展,完成了新插件的大部分工作。一个具体结果是先显示GeoJSON的SVG预览,滚动进入视野后再加载WebGL。文章提供提示词和浏览器演示,插件目前为初始Alpha版本。

推荐理由

提供参考现有实现后组织编码任务的具体提示词。原文正文+原站 RSS 时间核验,发布页确认Alpha状态;完成比例属作者自述,功能未复测。

正文 · 原文

The first new Datasette geospatial plugin in quite a while! This one combines the excellent MapLibre GL library with OpenFreeMap, the free vector map server operated by Zsolt Ero (you should sponsor Zsolt on GitHub.)

I built most of this with a single prompt to Claude Fable 5.2:

Look at datasette-cluster-map and datasette-leaflet-geojson plugins, then look at ~/dev/tools/openfreemap-demo.html - then build a brand new Datasette plugin that uses maplibreGL and openfreemap and combines the features of those other two plugins - but be creative and think outside the box for other useful features the plugin might have

"Be creative and think outside the box" resulted in a few neat ideas - my favorite is that it displays SVG previews of GeoJSON shapes, then loads a WebGL preview only when they scroll into view.

I also had Claude build a comprehensive demo which works in the latest Datasette Lite, so you can visit this link to load the plugin and a demo database in your browser via Pyodide and WebAssembly.

I like this demo page showing both GeoJSON shapes and lat/lon points on the same map:

Screenshot of a web map interface. Toolbar: "View" set to "Clusters", "Colour by" set to "continent", plus "Filter to this area" and "Download GeoJSON" buttons. A world map shows countries outlined and shaded by continent, with coloured dots and numbered cluster circles. A popup for a point in South America reads: capital Caracas, country Venezuela, continent South America, capital_population 2985000, latitude 10.502944, longitude -66.918983. Legend: Africa (52), Asia (45), Europe (39), North America (16), South America (13), Oceania (6). Text: "All 171 rows are on the map". Below, a table with columns country, continent, capital_population, latitude, longitude, boundary. First row: Afghanistan, Asia, 3277000, 34.518636, 69.181314, with a small map in the boundary column showing Afghanistan outlined and shaded in blue.

来源:Simon Willison · simonwillison.net