I am building a web application where points of interest are served from PostGIS. The points should be clustered either in the frontend or backend and plotted in Mapbox.
The situation is that users should be able to filter the points using criteria like land size, sale date, etc.
My question is: should we cluster the points in the frontend or backend?
What is the best practice? It would be even better if I could be provided with a codebase in Python.
As far as I know,
- Clustering the points in the frontend:
reduces server workload and resource usage, but a large amount of data needs to be transferred from the backend to the frontend. - Clustering in the backend:
can reduce the amount of data transferred to the frontend but may involve a lot of calculations in the backend. If the number of records increases, the server response time may not be reasonable for users.