Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point clustering #753

Closed
zakjan opened this issue Mar 18, 2021 · 7 comments
Closed

Point clustering #753

zakjan opened this issue Mar 18, 2021 · 7 comments

Comments

@zakjan
Copy link

zakjan commented Mar 18, 2021

Is it possible to implement server-side point clustering with Tegola, for use cases with high point count and low zoom level?

Currently it's possible with custom implemented Node.js service using supercluster and vt-pbf, connected to PostGIS data source. I'm looking for an out-of-the-box solution.

@ARolek
Copy link
Member

ARolek commented Mar 24, 2021

@zakjan I have not had to do clustering server-side yet, but it looks like the functions you need are availalbe in PostGIS. Have you played with ST_ClusterDBSCAN yet?

If you do dive into using this function, I would be interested in seeing the solution you come up with as I think it could help others. I'm happy to help with the research if need be.

@edtjones
Copy link

edtjones commented Feb 4, 2022

@zakjan did you ever get anywhere with serverside clustering? I would love to hear your progress if you did.

@iwpnd
Copy link
Member

iwpnd commented Feb 5, 2022

Definitely possible.

Say you have a bunch of points in your provider. You create two layers.

  1. layer uses the center point of a cluster as geometry field
  2. layer uses the default geometry field of your points

Then building your map, you use the first layer with the center points of the clusters from zoom level x to y and the second layer from y to z.

For static geometry data I suggest to create the cluster center points and store them in the database. For infrequently changing point data I suggest caching and for frequently changing data I suggest either a big database instance or another approach.

@edtjones
Copy link

edtjones commented Feb 5, 2022

@iwpnd thats a really clever idea! I’ve got relatively static data AND a big database server, so I think I can cache these clusters in the db and judiciously update with triggers. Thanks for the insight! 🙂

@iwpnd
Copy link
Member

iwpnd commented Feb 5, 2022

@ARolek @edtjones I created an example over at iwpnd/tegola-cluster-points. I didn't really bother with performance here but from what I can see, this seems viable.

@edtjones
Copy link

edtjones commented Feb 5, 2022 via email

@ARolek
Copy link
Member

ARolek commented Mar 23, 2022

I'm going to close this issue for now. Thanks for helping @iwpnd

@ARolek ARolek closed this as completed Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants