Skip to content

Releases: openlayers/openlayers

v3.8.1

06 Aug 16:54
Compare
Choose a tag to compare

Summary

This is a patch release that updates the URL for builds shown in the examples. Details below.

v3.8.0

06 Aug 16:58
Compare
Choose a tag to compare

Summary

The v3.8.0 release includes features and fixes from 33 pull requests since v3.7.0. While summer vacations have slowed the pace of development a bit this month, there are some nice improvements in this release. See the complete list below for details.

Note - Please see the 3.8.1 patch release for downloading release artifacts.

New features and fixes

v3.7.0

03 Jul 09:51
Compare
Choose a tag to compare

v3.7.0

Summary

The v3.7.0 release includes features and fixes from 43 pull requests since v3.6.0. To simplify the code base, there were some changes to "experimental" features. Please follow the upgrade notes to make your applications work with the latest release.

Upgrade notes

Removal of ol.FeatureOverlay

Instead of an ol.FeatureOverlay, we now use an ol.layer.Vector with an
ol.source.Vector. If you previously had:

var featureOverlay = new ol.FeatureOverlay({
  map: map,
  style: overlayStyle
});
featureOverlay.addFeature(feature);
featureOverlay.removeFeature(feature);
var collection = featureOverlay.getFeatures();

you will have to change this to:

var collection = new ol.Collection();
var featureOverlay = new ol.layer.Vector({
  map: map,
  source: new ol.source.Vector({
    features: collection,
    useSpatialIndex: false // optional, might improve performance
  }),
  style: overlayStyle,
  updateWhileAnimating: true, // optional, for instant visual feedback
  updateWhileInteracting: true // optional, for instant visual feedback
});
featureOverlay.getSource().addFeature(feature);
featureOverlay.getSource().removeFeature(feature);

With the removal of ol.FeatureOverlay, zIndex symbolizer properties of overlays are no longer stacked per map, but per layer/overlay. If you previously had multiple feature overlays where you controlled the rendering order of features by using zIndex symbolizer properties, you can now achieve the same rendering order only if all overlay features are on the same layer.

Note that ol.FeatureOverlay#getFeatures() returned an {ol.Collection.<ol.Feature>}, whereas ol.source.Vector#getFeatures() returns an {Array.<ol.Feature>}.

ol.TileCoord changes

Until now, the API exposed two different types of ol.TileCoord tile coordinates: internal ones that increase left to right and upward, and transformed ones that may increase downward, as defined by a transform function on the tile grid. With this change, the API now only exposes tile coordinates that increase left to right and upward.

Previously, tile grids created by OpenLayers either had their origin at the top-left or at the bottom-left corner of the extent. To make it easier for application developers to transform tile coordinates to the common XYZ tiling scheme, all tile grids that OpenLayers creates internally have their origin now at the top-left corner of the extent.

This change affects applications that configure a custom tileUrlFunction for an ol.source.Tile. Previously, the tileUrlFunction was called with rather unpredictable tile coordinates, depending on whether a tile coordinate transform took place before calling the tileUrlFunction. Now it is always called with OpenLayers tile coordinates. To transform these into the common XYZ tiling scheme, a custom tileUrlFunction has to change the y value (tile row) of the ol.TileCoord:

function tileUrlFunction = function(tileCoord, pixelRatio, projection) {
  var urlTemplate = '{z}/{x}/{y}';
  return urlTemplate
      .replace('{z}', tileCoord[0].toString())
      .replace('{x}', tileCoord[1].toString())
      .replace('{y}', (-tileCoord[2] - 1).toString());
}

The ol.tilegrid.TileGrid#createTileCoordTransform() function which could be used to get the tile grid's tile coordinate transform function has been removed. This function was confusing and should no longer be needed now that application developers get tile coordinates in a known layout.

The code snippets below show how your application code needs to be changed:

Old application code (with ol.tilegrid.TileGrid#createTileCoordTransform()):

var transform = source.getTileGrid().createTileCoordTransform();
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
  tileCoord = transform(tileCoord, projection);
  return 'http://mytiles.com/' +
      tileCoord[0] + '/' + tileCoord[1] + '/' + tileCoord[2] + '.png';
};

Old application code (with custom y transform):

var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
  var z = tileCoord[0];
  var yFromBottom = tileCoord[2];
  var resolution = tileGrid.getResolution(z);
  var tileHeight = ol.size.toSize(tileSize)[1];
  var matrixHeight =
      Math.floor(ol.extent.getHeight(extent) / tileHeight / resolution);
  return 'http://mytiles.com/' +
      tileCoord[0] + '/' + tileCoord[1] + '/' +
      (matrixHeight - yFromBottom - 1) + '.png';

};

New application code (simple -y - 1 transform):

var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
  return 'http://mytiles.com/' +
      tileCoord[0] + '/' + tileCoord[1] + '/' + (-tileCoord[2] - 1) + '.png';
};

Removal of ol.tilegrid.Zoomify

The replacement of ol.tilegrid.Zoomify is a plain ol.tilegrid.TileGrid, configured with extent, origin and resolutions. If the size passed to the ol.source.Zoomify source is [width, height], then the extent for the tile grid will be [0, -height, width, 0], and the origin will be [0, 0].

Replace ol.View.fitExtent() and ol.View.fitGeometry() with ol.View.fit()

  • This combines two previously distinct functions into one more flexible call which takes either a geometry or an extent.
  • Rename all calls to fitExtent and fitGeometry to fit.

Change to ol.interaction.Modify

When single clicking a line or boundary within the pixelTolerance, a vertex is now created.

New features and fixes

Read more

v3.6.0

07 Jun 13:26
Compare
Choose a tag to compare

Summary

The v3.6.0 release includes features and fixes from 40 pull requests since v3.5.0. To simplify the code base, there were some changes to "experimental" features. Please follow the upgrade notes to make your applications work with the latest release.

Upgrade notes

ol.interaction.Draw changes

  • The minPointsPerRing config option has been renamed to minPoints. It is now also available for linestring drawing, not only for polygons.
  • The ol.DrawEvent and ol.DrawEventType types were renamed to ol.interaction.DrawEvent and ol.interaction.DrawEventType. This has an impact on your code only if your code is compiled together with ol3.

ol.tilegrid changes

  • The ol.tilegrid.XYZ constructor has been replaced by a static ol.tilegrid.createXYZ() function. The ol.tilegrid.createXYZ() function takes the same arguments as the previous ol.tilegrid.XYZ constructor, but returns an ol.tilegrid.TileGrid instance.
  • The internal tile coordinate scheme for XYZ sources has been changed. Previously, the y of tile coordinates was transformed to the coordinates used by sources by calculating -y-1. Now, it is transformed by calculating height-y-1, where height is the number of rows of the tile grid at the zoom level of the tile coordinate.
  • The widths constructor option of ol.tilegrid.TileGrid and subclasses is no longer available, and it is no longer necessary to get proper wrapping at the 180° meridian. However, for ol.tilegrid.WMTS, there is a new option sizes, where each entry is an ol.Size with the width ('TileMatrixWidth' in WMTS capabilities) as first and the height ('TileMatrixHeight') as second entry of the array. For other tile grids, users can
    now specify an extent instead of widths. These settings are used to restrict the range of tiles that sources will request.
  • For ol.source.TileWMS, the default value of warpX used to be undefined, meaning that WMS requests with out-of-extent tile BBOXes would be sent. Now wrapX can only be true or false, and the new default is true. No application code changes should be required, but the resulting WMS requests for out-of-extent tiles will no longer use out-of-extent BBOXes, but ones that are shifted to real-world coordinates.

New features and fixes

v3.5.0

05 May 18:45
Compare
Choose a tag to compare

v3.5.0

Summary

The 3.5.0 release includes features and fixes from a whopping 129 pull requests since 3.4.0. This release removes a number of "experimental" features from the API, so take a close look at the notes below when upgrading.

Upgrade notes

ol.Object and bindTo

  • The following experimental methods have been removed from ol.Object: bindTo, unbind, and unbindAll. If you want to get notification about ol.Object property changes, you can listen for the 'propertychange' event (e.g. object.on('propertychange', listener)). Two-way binding can be set up at the application level using property change listeners. See #3472 for details on the change.

  • The experimental ol.dom.Input component has been removed. If you need to synchronize the state of a dom Input element with an ol.Object, this can be accomplished using listeners for change events. For example, you might bind the state of a checkbox type input with a layer's visibility like this:

    var layer = new ol.layer.Tile();
    var checkbox = document.querySelector('#checkbox');
    
    checkbox.addEventListener('change', function() {
      var checked = this.checked;
      if (checked !== layer.getVisible()) {
        layer.setVisible(checked);
      }
    });
    
    layer.on('change:visible', function() {
      var visible = this.getVisible();
      if (visible !== checkbox.checked) {
        checkbox.checked = visible;
      }
    });

New Vector API

  • The following experimental vector classes have been removed: ol.source.GeoJSON, ol.source.GML, ol.source.GPX, ol.source.IGC, ol.source.KML, ol.source.OSMXML, and ol.source.TopoJSON. You now will use ol.source.Vector instead.

    For example, if you used ol.source.GeoJSON as follows:

    var source = new ol.source.GeoJSON({
      url: 'features.json',
      projection: 'EPSG:3857'
    });

    you will need to change your code to:

    var source = new ol.source.Vector({
      url: 'features.json',
      format: new ol.format.GeoJSON()
    });

    See http://openlayers.org/en/v3.5.0/examples/vector-layer.html for a real example.

    Note that you no longer need to set a projection on the source!

    Previously the vector data was loaded at source construction time, and, if the data projection and the source projection were not the same, the vector data was transformed to the source projection before being inserted (as features) into the source.

    The vector data is now loaded at render time, when the view projection is known. And the vector data is transformed to the view projection if the data projection and the source projection are not the same.

    If you still want to "eagerly" load the source you will use something like this:

    var source = new ol.source.Vector();
    $.ajax('features.json').then(function(response) {
      var geojsonFormat = new ol.format.GeoJSON();
      var features = geojsonFormat.readFeatures(response,
          {featureProjection: 'EPSG:3857'});
      source.addFeatures(features);
    });

    The above code uses jQuery to send an Ajax request, but you can obviously use any Ajax library.

    See http://openlayers.org/en/v3.5.0/examples/igc.html for a real example.

  • Note about KML

    If you used ol.source.KML's extractStyles or defaultStyle options, you will now have to set these options on ol.format.KML instead. For example, if you used:

    var source = new ol.source.KML({
      url: 'features.kml',
      extractStyles: false,
      projection: 'EPSG:3857'
    });

    you will now use:

    var source = new ol.source.Vector({
      url: 'features.kml',
      format: new ol.format.KML({
        extractStyles: false
      })
    });
  • The ol.source.ServerVector class has been removed. If you used it, for example as follows:

    var source = new ol.source.ServerVector({
      format: new ol.format.GeoJSON(),
      loader: function(extent, resolution, projection) {
        var url = ;
        $.ajax(url).then(function(response) {
          source.addFeatures(source.readFeatures(response));
        });
      },
      strategy: ol.loadingstrategy.bbox,
      projection: 'EPSG:3857'
    });

    you will need to change your code to:

    var source = new ol.source.Vector({
      loader: function(extent, resolution, projection) {
        var url = ;
        $.ajax(url).then(function(response) {
          var format = new ol.format.GeoJSON();
          var features = format.readFeatures(response,
              {featureProjection: projection});
          source.addFeatures(features);
        });
      },
      strategy: ol.loadingstrategy.bbox
    });

    See http://openlayers.org/en/v3.5.0/examples/vector-osm.html for a real example.

  • The experimental ol.loadingstrategy.createTile function has been renamed to ol.loadingstrategy.tile. The signature of the function hasn't changed. See http://openlayers.org/en/v3.5.0/examples/vector-osm.html for an example.

Change to ol.style.Icon

  • When manually loading an image for ol.style.Icon, the image size should now be set
    with the imgSize option and not with size. size is supposed to be used for the
    size of a sub-rectangle in an image sprite.

Support for non-square tiles

The return value of ol.tilegrid.TileGrid#getTileSize() will now be an ol.Size array instead of a number if non-square tiles (i.e. an ol.Size array instead of a number as tilsSize) are used. To always get an ol.Size, the new ol.size.toSize() was added.

Change to ol.interaction.Draw

When finishing a draw, the drawend event is now dispatched before the feature is inserted to either the source or the collection. This change allows application code to finish setting up the feature.

Misc.

If you compile your application together with the library and use the ol.feature.FeatureStyleFunction type annotation (this should be extremely rare), the type is now named ol.FeatureStyleFunction.

New features and fixes

Read more

v3.4.0

27 Mar 10:58
Compare
Choose a tag to compare

Summary

The 3.4.0 release includes more than 40 merged pull requests since the 3.3.0 version. New features include dateline wrapping for tile based sources. See for instance the tiled WMS example and the WMTS example.
Also the draw interaction can be used to draw circles see the updated Draw features example which now has a Circle option.

Upgrade notes

No upgrade notes for this release.

Overview of all changes

v3.3.0

03 Mar 21:52
Compare
Choose a tag to compare

Summary

The 3.3.0 release includes almost 40 merged pull requests since the 3.2.1 version. And many of those are from new contributors! New features include support for ArcGIS Rest tile layers, several WMTS format parser and layer creation improvements, monitoring of loading tiles and an autoPan option for panning overlays such as popups into view.

Upgrade notes

  • The ol.events.condition.mouseMove function was replaced by ol.events.condition.pointerMove (see #3281). For example, if you use ol.events.condition.mouseMove as the condition in a Select interaction then you now need to use ol.events.condition.pointerMove:

    var selectInteraction = new ol.interaction.Select({
      condition: ol.events.condition.pointerMove
      // …
    });

Changes

v3.2.1

13 Feb 19:06
Compare
Choose a tag to compare

Summary

This is a patch release that fixes a regression with the select interaction in the 3.2.0 release.

Changes

v3.2.0

06 Feb 10:37
Compare
Choose a tag to compare

Summary

The 3.2.0 release includes 70 merged pull requests since 3.1.0. Of note, the KML format now parses NetworkingLink tags. The measure example was reworked to display measurements and help messages while drawing. A WMTS GetCapabilities format was added. The WebGL renderer now supports feature hit detection (on point features). And you can now detect features/colored pixels on image and tile layers! See the full list of changes below.

Upgrade notes

The 3.2.0 release maintains a backwards-compatible API with the 3.1.0 release, so upgrades should be painless. Some special considerations below.

  • You should not call view.setRotation with undefined, to reset the view rotation to 0 then use view.setRotation(0) (see #3176).
  • If you use $(map.getViewport()).on('mousemove') to detect features when the mouse is hovered on the map, you should now rely on the pointermove map event type and check in the pointermove listener that the dragging event property is false (see #3190).

Changes

Read more

v3.1.1

23 Dec 18:55
Compare
Choose a tag to compare

Summary

This patch release fixes an issue with the select interaction in the 3.1.0 release.

Changes

  • #3082 - Correct arguments for forEachGeometryAtPixel. (@tschaub)