I'm working on a Ruby on Rails application that is showing road signs on the map(leaflet). So, user can browse map and road signs, great. But, if there are a lot of signs and user wants to zoom out, there are obvious problems for my app.
- First problem is to prevent loading a lot of elements (signs) at the same time.
- And the second problem is to have clear view of elements on the map.
Insted of this:
Solution by my research is to cluster elements by locations as user is zoom-ing in and out. More precisely, using k-means algorithm.
My questions are :
- Are there some done solutions for this?
- If done solutions not exists, how to use k-means algorithm with zoom level?
I'm using Postgres database with Postgis extension and Ruby on Rails build API.