Fantastic bit of code and tutorial about aggregating point data for JSON objects using SQL.
NOTE: I’ll use CARTO but you can apply all this to any webmapping technology backed by a modern database.
Get all the data
So we start with the typical use case where we have a one to many relationship like this:
Easy peasy, we have a map with many stacked points. From here you can jump to this excellent post by James Milner about dense point maps. My example is not about having thousands of scattered points that at certain zoom levels overlap. Mine is a small set of locations but many points “stacking” on them. In this case you can do two things: aggregate or not. When you aggregate you pay a prize for readability: reducing all your data to those locations and maybe using visual variables to show counts or averages or any other aggregated value and finally try to use the interactivity of your map to…
View original post 522 more words