title: Removing specific layers
body: <p>I have an application where I need to remove all layers, except for two specific ones.
  My Goal is to be able to iterate over the layers and don't remove specified ones.</p>
  <p>something like:</p>
  <pre><code>map.getLayers().forEach(layer =&gt; {
    if (layer has something) {
      map.removeLayer(layer);
    }
  });
  </code></pre>
  <p>I found:</p>
  <pre><code>map.getLayers().forEach(layer =&gt; {
    if (layer &amp;&amp; layer.get('name') === 'Marker') {
      map.removeLayer(layer);
    }
  });
  </code></pre>
  <p>but I don't know how to set the name of a layer.</p>