title: OpenLayers 3 doesn't show KML layer
body: <p>I'm newbie with OpenLayers and I'm trying to add a KML layer to a map.</p>
  
  <p>Here is my script:</p>
  
  <pre><code>var projection = ol.proj.get('EPSG:3857');
  
  var mapa = new ol.layer.Tile({
      source: new ol.source.OSM()
  });
  
  var map = new ol.Map({
      target: 'map',
      controls: ol.control.defaults({
          attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
              collapsible: false
          })
      }),
      view: new ol.View({
          center: [-5462834.47, -3058929.70],
          projection: projection,
          zoom: 10
      })
  });
  
  map.addLayer(mapa);
  
  var alfalfa_zaragoza = new ol.layer.Vector({
      source: new ol.source.Vector({
          url: 'kml/ms_alfalfazaragoza_rgba_ndvi.kml',
          format: new ol.format.KML()
      }),
      extractStyles: true,
      extractAttributes: true,
      maxDepth: 2,
      setVisibility: true
  });
  
  
  
  document.getElementById('addKML').onclick = function () {
      map.addLayer(alfalfa_zaragoza);
  };
  </code></pre>
  
  <p>And my html page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Title&lt;/title&gt;
      &lt;link rel="stylesheet" href="http://openlayers.org/en/v3.2.0/css/ol.css" type="text/css"&gt;
      &lt;script type="javascript" src="&lt;%=request.getContextPath()%&gt;/resources/OpenLayersv3.14.2/build/ol.js"&gt;&lt;/script&gt;
      &lt;script src="http://maps.google.com/maps/api/js?v=3&amp;amp;sensor=false"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="&lt;%=request.getContextPath()%&gt;/resources/OpenLayersv3.14.2/css/ol.css" type="text/css" /&gt;
      &lt;link rel="stylesheet" href="&lt;%=request.getContextPath()%&gt;/resources/ol3-google-maps-v0.4/ol3gm.css" type="text/css" /&gt;
      &lt;link rel="stylesheet" href="&lt;%=request.getContextPath()%&gt;/resources/layout.css" type="text/css" /&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class="container-fluid"&gt;
      &lt;div class="row-fluid"&gt;
          &lt;div class="span12"&gt;
              &lt;div id="map" class="map"&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="row-fluid"&gt;
          &lt;div class="span12"&gt;
              &lt;h4&gt;Concept example&lt;/h4&gt;
  
              &lt;div class="row"&gt;
                  &lt;div class="col-md-4 col-sm-4"&gt;
                      &lt;fieldset&gt;
                          &lt;input id="addKML" type="button" value="Add KML"
                                 title="Add KML layer"/&gt;
                      &lt;/fieldset&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;   
  &lt;script src="&lt;%=request.getContextPath()%&gt;/resources/ol3-google-maps-v0.4/ol3gm.js"&gt;&lt;/script&gt;
  &lt;script src="&lt;%=request.getContextPath()%&gt;/resources/kml.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Where is the error? The idea is to press "addKML" button and the layer is added to the map, but when I press it, nothing happens.</p>