Closed mrmascott10 closed 3 months ago
Yes, getClusters
expects an integer zoom level because this is how hierarchical clustering works — by generating clusters at each integer zoom level. If you look at the docs for the method, it explicitly says it expects an integer zoom.
I use Leaflet.SmoothWheelZoom for most of my leaflet projects.
This means that the zoom level on my map is nearly always a decimal. When using this in conjunction with supercluster this causes an error.
TypeError: Cannot read properties of undefined (reading 'range') at SuperCluster.getClusters (supercluster.js:281:24)
I've managed to fix this for my project by rounding the zoom level in the
getClusters
function. I changed the line below.const tree = this.trees[this._limitZoom(Math.round(zoom))];