supercluster
supercluster copied to clipboard
Question - the right way to serve cluster vector tiles to the client
I'm new to mapbox/supercluster and have a question on the best / right way to serve vector tiles with clusters to the client on the server side.
Once I get the clusters as
let index = supercluster({ minZoom: 0, maxZoom: 16, radius: 40, extent: 8192, log: true }).load(points.features)
I can get a tile by
let clusters = index.getTile(tile.z, tile.x, tile.y);
My question is how do I serve it to the client. From online documents, looks I need to convert it to pbf through vt-pbf package, as
vtpbf.fromGeojsonVt({ clusters }, {version: 2})
but the results seem wrong (duplicated clusters on map at the client side, and jumpy points while zooming). Can somebody point me to the right direction? Thanks.
Same question
You need to mention the extent to vtpbf like: vtpbf.fromGeojsonVt({ clusters }, {version: 2, extent: 8192}).