Reputation: 5898
Does anyone know of a google maps library that you can define your own clusters with?
There are plenty of clustering libraries, but as far as i know they all auto create clusters based on distance.
What i'm trying to do is aggrate data by local authority area.
At low zoom levels eg: zoomed out, i want to be able to aggrgate data by county, then as we zoom in the data is clustered by boroughs within the county, and as we zoom in further the data is clustered by sub-borough regions.
Essentially what i want to know if the there is a library that will allow me to pre-define where on a map each cluster would appear at a specific zoom level.
Hope i've explained that right, let me know if you're confused about what the question is.
Upvotes: 0
Views: 587
Reputation: 31912
I think what you'd need to do is create polygons (not necessarily visible ones) of the borders of each region/borough/county etc, at the different zoom levels. And also save the latlng coordinates of where in each of these areas you'd want your cluster marker to appear. Then at each zoom level, you'd plot your markers on those coordinates. i.e. you'd basically have to do it all yourself without any clustermarker plugin.
You'd need to have different arrays of coordinates, one array for each of county,region,borough etc. Have an event listener for when the map bounds change. In that event listener, check the zoom level, and decide which of those arrays to plot the markers for.
Upvotes: 1