prashantchhabra89/Alternate-Power-Source-Property-Mapper — pull request #58 by maxentropic (2014-10-26 11:09:38+00:00)
Title: Heatmaps have binning!

While the last pull request had nice looking heatmaps and all, it was almost impossible to zoom out without everything dying a slow, horrible death (I think for the second furthest zoom the browser prompted me to kill the script that was taking twice before the map finished loading). Obviously this was a huge problem, so I decided to add binning right away.

There are a number of different solutions implemented. I draw the heatmaps at different resolutions based dynamically off the zoom level, change how much boundary data I use for calculations at different zooms, and bin and chunk the data and interpolation processing into sections for drawing when at the furthest out zoom levels.

What this means for performance (on my computer) is that the data interpolation at the furthest out zoom where you can see all of Vancouver Island has gone from not loading (in the last pull request) to taking only 2 seconds to fully process (down from 9 seconds when I only had the resolution change added in). Also important, the visible information has little degradation - you don't lose a lot of information in the heatmap between zoom levels.

*A brief disclaimer: I haven't set a static value yet for weight scaling, so the colours will still change a bit as you zoom/move the map; also solar doesn't quite display things how we're going to eventually want it to. It will need a bit more thought. But the pull request is ready for merging, pending review - those issues are separate.*