Closed alpha-beta-soup closed 8 years ago
Popup construction is now bound to click events, rather than done up-front with the loading of the geojson, which has made it noticeably smoother. Next up is to move most of the property construction from Python to JS, which should make an even bigger difference.
Done. With three months of data, the geojson went from 3.7 mb to 1.7 mb.
At present, the accident pop-ups get populated once, by a Python script that reads the coded values from the CSV into the GeoJSON. This means that the GeoJSON file becomes very big, and people unknowingly download all of the popups each time they look at the map.
A better solution is to populate the GeoJSON with the coded values, and decode these into a popup when the popup is requested. This should happen in the Javascript. The only reason it isn't is because my Python is much better than my Javascript, and I initially set out just to write a Python parser of the CSV data. It's an irritating hangover.
Any slowdown caused by performing the conversion on-the-fly will probably be more than compensated by the ability to show more data, and/or a smaller GeoJSON considerably improving initial load time.