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

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

AI 导读

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

推荐理由

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

正文 · AI 翻译

这是 Datasette 久违的首个新地理空间插件!它将出色的 MapLibre GL 库与 OpenFreeMap 结合起来,后者是由 Zsolt Ero 运营的免费矢量地图服务器(你应该在 GitHub 上赞助 Zsolt)。

我只向 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

“发挥创意,跳出思维定式”带来了几个巧妙的点子——我最喜欢的是,它会先显示 GeoJSON 图形的 SVG 预览,等到这些图形滚动进入可视区域时,才加载 WebGL 预览。

我还让 Claude 构建了一个全面的演示,可在最新版 Datasette Lite 中运行,因此你可以访问此链接,通过 Pyodide 和 WebAssembly 在浏览器中加载该插件和一个演示数据库。

我喜欢这个演示页面,它在同一张地图上同时展示了 GeoJSON 图形和经纬度点:

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