Searching for point density yields several threads on this website but none shed light on the problem I want to tackle. So, here goes…
I have a decent number of points, about ~500K, that I would like to show on a map. The web is full of posts touting how to render 10K or 100K or even 1M points in the browser using Canvas or WebGL or whatnot. The problem for me is not so much the speed of drawing the points in a leaflet heat map but delivering these points to the user. I could reduce the size of the JSON payload by reducing the scale of the lng/lat
values, but still, 500K points is 500K points.
For viz, I would like to show a heat map when sufficiently zoomed out (showing the entire world, or even a couple of zoom clicks in) and then change to a markercluster map at some sensible transition point. The question is -- how do I calculate and organize the 500K points in my db so that a reasonable amount of data is sent back to the user at any zoom level. I was thinking that at smaller scales (when zoomed out), I could somehow aggregate my points into points with some kind of density value attached as a proxy for polygons depicting polygon density. But I am a bit lost, really.
Now, a while back I asked a related question about displaying such data in a hexbin, and I achieved some success with creating hexbins using h3
on the server. But I am now exploring an alternative approach, as mentioned above, with just a simple heatmap at small scales, markerclusters at mid-scales, and indiv points at large scales.
On the server side, I am constrained to running node and SQLite. In other words, I can't (easily) include GRASS or other software in my toolchain.