Cluster POIs on low zoom levels #1020
Replies: 2 comments 3 replies
-
@georgbachmann I would recommend evaluating the performance of the ST_ClusterDBScan first - if it works for your usage, than you won't need to do anything else. Plus you can setup varnish or nginx(?) or some other reverse proxy to cache responses, plus use CDN. This way it will be cached most of the time regardless. If the solution is still too slow, you can use various database tricks to make it faster. For example, you can create a materialized view that pre-generates clustered tiles for low zooms (e.g. 0-9 is only 350,000 tiles that you can store in a single table). Then write a SQL function that either goes to that cache table (for low zooms), or uses your POIs directly for higher zooms. This way you will only work with a tiny subset of the POIs in real time, and go to the materialized view for pre-generated tiles. |
Beta Was this translation helpful? Give feedback.
-
@georgbachmann did you proceed with this approach? If so, are you willing to share your SQL function for Martin? |
Beta Was this translation helpful? Give feedback.
-
I am very new to martin, like the possibilities I think I might have with it :)
So I have a map where I want to display POIs, but those should be clustered… MapLibre does not support clustering of a vector-tile-source it seems, right?!? I guess I have to do clustering then on the martin side of things, right?
Currently we have around 200.000 entries in our table, so not that huge… But doing it on the fly would still be a bit much CPU work I guess?!?
I guess I would need to do a per zoom level e.g. ST_ClusterDBScan and group by that using the function functionality from martin?
But as i am again very new to martin I would love to get feedback and ideas. Maybe there are many better ways of doing it that I simply overlooked.
Beta Was this translation helpful? Give feedback.
All reactions