OpenLayers collections vs vanilla js
: Greg Newton
Minutes: 360
Spent way too much time adding a feature for AS. The request was to provide a method to show/hide production and consumption sites as a map de-cluttering method.
Initially I assumed that I could use OpenLayers collections, which are special arrays containing OL features (as opposed to GeoJSON). However, creating them from async’d GeoJSON was a hassle (all sorts of extra async functions and so forth). I did manage to get it working, but then found that an OL dev counselled against it due to memory overhead.
So, I ended up using simple js to change a property on the existing features such that the features get hidden. All of that for a click-to-show/hide.