Merged copyWithLayers into copyMap.