I want to create a web application where a user inputs a set of identifiers, and a set of dots on a map related to those identifiers appear.
Trouble is, this data can number in the tens to hundreds of thousands to even potentially millions. Given this possibility, I want to take a light tack. Below is my ideal aggregation behavior.
At low zoom levels, I want to aggregate these dots into counts by state (appropriate symbology size/color indicating higher intensity, with the dot centered on the state centroid). at slightly higher zoom levels, these would separate into counts by smaller polygons. at even higher zoom, yet smaller polygons. When, if unaggregated, the number of dots on the map would be less than ~500, then just plot the dots.
These polygons were already decided, and each dot has within its data the polygon ID for each polygon it is under.
Since the dots are randomly plotted within respective polygons to begin with, actual distribution of dots within polygons doesn't matter. Or rather, any aggregation that ignores which polygon the dots were plotted in will wipe out information. For this reason, I can't use markercluster (at least not with the options I saw. If there's an easy means to aggregate in the manner i'm looking for, please let me know)
For various reasons (I'm not a javascript programmer, I'm an R programmer) I am working within the bounds of the leaflet package within R. Is there a means by which I can change the aggregation level depending on zoom in this manner?
I've put together a toy dataset containing a relatively small subset (1 entity, 3 states, ~10k observations) along with the centroids for census tracts and counties for those states.
http://s000.tinyupload.com/index.php?file_id=00048836337627834343
cluster=clusterOptions(). Are you trying to do more than that?