Geomap: legend enhancements

If you are going to append, then do it after the loop. It is very expensive to append something to the DOM and then to change it repeatedly in a loop. Best to make all the changes outside of the DOM and then append it at the end. DOM hits are very expensive so they should be minimized.