I'm taking a layer (
layer_orig) and calling the
clone method to create a new layer (
layer_clone) with same features, styles, etc. I am changing the name and
map instance of the layer with:
layer_clone.map = null; layer_clone.setName(name);
This works exactly as expected, even giving a unique layer id to the new layer.
However, if I then update the styleMap of
layer_clone, the styleMap of
layer_orig is updated as well - suggesting that
layer_clone is a reference to
layer_orig and not a completely unique Layer object.
Is there a way to get a unique Layer object that is a direct clone of another layer?