0

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.

5
  • Just decide at which zoom you want to switch to clusters and then show clusters instead of heatmap.
    – TomazicM
    Commented Sep 4 at 12:23
  • thanks for the response. The real problem I want to figure out is how to convert my ~500K points into a dataset that provides the information needed to create a heatmap but with fewer points. Sending 500K point pairs is not practical in a data-constrained environment (note: taking out the words "point density" from the post title changes the nature of the question)
    – punkish
    Commented Sep 4 at 14:38
  • So you just want to reduce point density but keep information? That's not possible. Or you want to reduce point density only on lower zoom levels and keep it at higher zoom levels?
    – TomazicM
    Commented Sep 4 at 17:45
  • I am likely not asking the question properly. Here is another attempt -- imagine that while I have 500K points, at any given zoom level, I want to send only 1000 points to the user. Yes, at every zoom level I want to convey a visual distribution of the points. So, when zoomed out to the world, my 1000 points paint a heat map. Zoomed in to a small country, say Portugal or Spain, my 1000 points show up as clusters. And zoomed in further to a part of the country, the individual 1000 points show up. The key is, only 1000 points (limited data) are transferred on each query. HTH
    – punkish
    Commented Sep 4 at 21:28
  • The only solution that comes to mind is to use vector tiles, but I don't know how is then with heatmap and marker clusters in Leaflet. Here is an example how it can be resolved for heat map in OpenLayers: gis.stackexchange.com/questions/418820/…
    – TomazicM
    Commented Sep 5 at 7:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.