示例中如何从 ClusterBuster 矢量瓦片服务器接收瓦片数据?

How to receive tile data from ClusterBuster vector tile server in the sample example?

总结

似乎这些人在 ClusterBuster 矢量切片服务器上的内置过滤、集群和缓存方面做得很好。 我对这个看起来很有前途的项目感到非常兴奋,我很想尝试一下!

我正在做一个关于绘图的项目Deck.gl layers (MVTLayer) on top of Google Maps from a vector tile server through their integration。 我想尝试集成并从 ClusterBuster 服务器提供一些保存在 PostGIS 中的聚类点。

预期结果:

实际结果:

我的尝试

我尝试构建 运行 提供的示例,但不知何故,我无法做到这一点。

我 运行 提供的快速服务器 clusterbuster/example/express.ts 和前端尝试使用 clusterbuster/example/mapbox.html 提供的 mapbox 示例(使用我的 mapbox 令牌)但 mapbox 地图上没有任何内容(也没有出现在Google 映射到我的 Deck.gl 示例)。

clusterbuster/example/readme.md 中所述,我创建了一个带有 PostGIS 连接设置的 .env 文件。

在 运行 之后执行以下命令:

yarn
yarn start

我得到这个输出:

C:\zFVStuff\Google Maps - Deck.gl\_Servers\ClusterBuster\clusterbuster-master> yarn start
yarn run v1.22.4
$ yarn build && ts-node example/express.ts
$ rollup --config rollup.config.js

./lib/index.ts → dist/index.d.ts...
created dist/index.d.ts in 5.7s

./lib/index.ts → dist/index.js...
created dist/index.js in 5.1s
attempting to create supporting SQL functions
failure in creating First SQL function
failure in creating TileBBox SQL function
failure in creating TileDoubleBBox SQL function
Example app listening on port 3005!

send3663284b-0e58-4587-af82-b35604a99303: 4.964ms
3663284b-0e58-4587-af82-b35604a99303: 817.819ms
sendd0bdd671-1f47-4b40-84ba-2fed6adfd045: 3.451ms
d0bdd671-1f47-4b40-84ba-2fed6adfd045: 1276.588ms
sendcd36f672-4c4b-4a95-b772-7584e6eb8c55: 1.349ms
cd36f672-4c4b-4a95-b772-7584e6eb8c55: 1754.146ms

请求似乎正常,返回状态 200,但来自 ClusterBuster 服务器的切片数据未定义地图上没有任何内容(您的 Mapbox 或我的 Google 地图)。 此外,奇怪的是,所有磁贴响应似乎都具有相同的大小 216 B。

数据已成功导入PostGIS数据库。

使用 VSCode Javascript 调试终端调试 express.ts 服务器文件并使用命令 ts-node .\example\express.ts.[=28 启动它后,结果为 undefined =]

在 Chrome 网络选项卡中,在子选项卡预览或响应的 none 中我看不到任何数据。

我还尝试在成功函数中将结果磁贴记录到快速服务器中,

server({ 
   ...//excluded for visibility 
}).then(result => {
   ...//excluded for visibility 

   console.log(result)

   res.status(200).send(result);
})

下面是输出,我得到 undefined

非常感谢任何帮助或建议!提前致谢!

在 TileServer 配置中启用调试后(debug: true),我注意到 2 个错误:

SELECT ST_AsMVT(tile, 'points', 4096, 'geom') AS mvt FROM tile
{
  e: error: password authentication failed for user "userXYZ"
...
SELECT ST_AsMVT(tile, 'points', 4096, 'geom') AS mvt FROM tile
{
  e: Error: read ECONNRESET
      at TCP.onStreamRead (internal/stream_base_commons.js:205:27) {
...

最初我 运行 从 clusterbuster 的根目录使用 ts-node .\example\express.tsyarn start (下面使用相同的并且它尝试连接我的用户而不是 .env 配置文件)

example 文件夹中的 运行 ts-node express.ts 之后,它考虑了使用 postgres 用户而不是我的用户的 .env 配置文件。现在来自服务器的图块数据返回正常,示例按预期运行。

非常感谢帮助我的贡献者cosmin-petrescu。 可以看到整个线程here on github