这是相当长一段时间以来第一个新的 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.