title: OpenLayers 3 zoom to boundary box
body: <p>I tried to zoom to all points on map. I have array of GPS (lon,lat) coords, makes extent and I tried to zoom. But map is zoomed outside of extent. How can I do that? I tried this code:</p>
  
  <pre><code>var devices = document.querySelectorAll(".device_icon");
  var coords = [];
  
  for (var i = 0; i &lt; devices.length; i++) {
      var lon = devices[i].getAttribute("data-lon");
      var lat = devices[i].getAttribute("data-lat");
  
      coords.push([lon, lat]);
  }
  var ex = ol.extent.boundingExtent(coords);
  var areaExtent = ol.extent.applyTransform(ex, ol.proj.getTransform('EPSG:4326', 'EPSG:3857'));
  
  map.getView().fitExtent(areaExtent, map.getSize());
  </code></pre>
  
  <p>Thanks.</p>