NEON-1987 Prevent the map from adding duplicate legends
NEON-1987 Prevent the map from adding duplicate legends

When the user changed the options for a map layer, the old legend would stay
around and a new legend would be added. These legends would continue to
accumulate. This happened because modifying the layer causes a new OpenLayers
layer to be generated with a new ID, and the legends are associated with the
layers by ID. There was code that tried to maintain the connection between the
layer and its legend, but it ran before the new layer was created.

NextCenturyCorporation/neon-gtd,NextCenturyCorporation/neon-gtd,NextCenturyCorporation/neon-gtd