Skip to content

Releases: openlayers/openlayers

6.0.1

30 Sep 18:48
d7acbc4
Compare
Choose a tag to compare

Hot on the heels of the 6.0 release, this patch release includes a few fixes for existing functionality. There should be nothing special needed to upgrade an application from 6.0.0 to 6.0.1. See the 6.0.0 release notes for details on upgrading from an older version.

Changes

Dependency Updates

6.0.0

26 Sep 21:39
55adb4e
Compare
Choose a tag to compare

Wow. The 6.0 release includes changes from 1780 commits in 544 pull requests since the 5.3 release. Thanks to all who contributed to this effort.

A major feature in this release is the ability to compose layers with different renderer types. Previously, the map used a single rendering strategy, and all layers in your map had to implement that strategy. Now it is possible to have a map with layers that use different rendering technologies. This makes it possible, for example, to have Canvas (2D) layer composed together with a WebGL based layer in the same map. It is also possible to create layers with custom renderers. So you could have a map that uses another library (like d3) to render one layer and use OpenLayers to render the other layers. We will continue to take advantage of this new flexibility in future releases.

In addition, the 6.0 release includes a number of vector tile rendering improvements and should have a lower memory footprint overall. The release also includes a number of experimental features that are not yet part of the stable API. Take a look through the examples for a new WebGL based renderer and the experimental useGeographic() function. Watch upcoming releases for more detail on these.

This release includes a number of backwards incompatible changes. Take a careful look at the notes below when upgrading your application from the 5.3 release.

Backwards incompatible changes

Usage of map.forEachLayerAtPixel

Due to performance considerations, the layers in a map will sometimes be rendered into one
single canvas instead of separate elements.
This means map.forEachLayerAtPixel will bring up false positives.

The easiest solution to avoid that is to assign different className properties to each layer like so:

new Layer({
   // ...
   className: 'my-layer'
})

Please note that this may incur a significant performance loss when dealing with many layers and/or
targetting mobile devices.

Removal of TOUCH constant from ol/has

If you were previously using this constant, you can check if 'ontouchstart' is defined in window instead.

if ('ontouchstart' in window) {
  // ...
}
Removal of GEOLOCATION constant from ol/has

If you were previously using this constant, you can check if 'geolocation' is defined in navigator instead.

if ('geolocation' in navigator) {
  // ...
}
Removal of CSS print rules

The CSS media print rules were removed from the ol.css file. To get the previous behavior, use the following CSS:

@media print {
  .ol-control {
    display: none;
  }
}
Removal of optional this arguments

The optional this (i.e. opt_this) arguments were removed from the following methods.
Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).

  • forEachCorner in ol/extent
  • LRUCache#forEach
  • RBush#forEach and RBush#forEachInExtent
The setCenter, setZoom, setResolution and setRotation methods on ol/View do not bypass constraints anymore

Previously, these methods allowed setting values that were inconsistent with the given view constraints.
This is no longer the case and all changes to the view state now follow the same logic:
target values are provided and constraints are applied on these to determine the actual values to be used.

Removal of the constrainResolution option on View.fit, PinchZoom, MouseWheelZoom and ol/interaction.js

The constrainResolution option is now only supported by the View class. A View.setConstrainResolution method was added as well.

Generally, the responsibility of applying center/rotation/resolutions constraints was moved from interactions and controls to the View class.

The view extent option now applies to the whole viewport

Previously, this options only constrained the view center. This behaviour can still be obtained by specifying constrainCenterOnly in the view options.

As a side effect, the view rotate method is gone and has been replaced with adjustRotation which takes a delta as input.

The view is constrained so only one world is visible

Previously, maps showed multiple worlds at low zoom levels. In addition, it used to be possible to pan off the north or south edge of the world. Now, the view is restricted to show only one world, and you cannot pan off the edge. To get the previous behavior, configure the ol/View with multiWorld: true.

Removal of deprecated methods

The inherits function that was used to inherit the prototype methods from one constructor into another has been removed.
The standard ECMAScript classes should be used instead.

The deprecated getSnapToPixel and setSnapToPixel functions from the ImageStyle class have been removed.

New internal tile coordinates

Previously, the internal tile coordinates used in the library had an unusual row order – the origin of the tile coordinate system was at the top left as expected, but the rows increased upwards. This meant that all tile coordinates within a tile grid's extent had negative y values.

Now, the internal tile coordinates used in the library have the same row order as standard (e.g. XYZ) tile coordinates. The origin is at the top left (as before), and rows or y values increase downward. So the top left tile of a tile grid is now 0, 0, whereas it was 0, -1 before.

x, y values for tile coordinates

origin
  *__________________________
  |        |        |        |
  |  0, 0  |  1, 0  |  2, 0  |
  |________|________|________|
  |        |        |        |
  |  0, 1  |  1, 1  |  2, 1  |
  |________|________|________|
  |        |        |        |
  |  0, 2  |  1, 2  |  2, 2  |
  |________|________|________|

This change should only affect you if you were using a custom tileLoadFunction or tileUrlFunction. For example, if you used to have a tileUrlFunction that looked like this:

// before
function tileUrlFunction(tileCoord) {
  const z = tileCoord[0];
  const x = tileCoord[1];
  const y = -tileCoord[2] - 1;
  // do something with z, x, y
}

You would now do something like this:

// after
function tileUrlFunction(tileCoord) {
  const z = tileCoord[0];
  const x = tileCoord[1];
  const y = tileCoord[2];
  // do something with z, x, y
}

In addition (this should be exceedingly rare), if you previously created a ol/tilegrid/WMTS by hand and you were providing an array of sizes, you no longer have to provide a negative height if your tile origin is the top-left corner (the common case). On the other hand, if you are providing a custom array of sizes and your origin is the bottom of the grid (this is uncommon), your height values must now be negative.

Removal of the "vector" render mode for vector tile layers

If you were previously using VectorTile layers with renderMode: 'vector', you have to remove this configuration option. That mode was removed. 'hybrid' (default) and 'image' are still available.

Removal of the "renderMode" option for vector layers

If you were previously using Vector layers with renderMode: 'image', you have to remove this configuration option. Instead, use the new ol/layer/VectorImage layer with your ol/source/Vector.

New declutter behavior

If a map has more than one layer with declutter set to true, decluttering now considers all Vector and VectorTile layers, instead of decluttering each layer separately. Only VectorImage layers continue to be decluttered separately. The higher the z-index of a layer, the higher the priority of its decluttered items.

Within a layer, the declutter order has changed. Previously, styles with a lower zIndex were prioritized over those with a higher zIndex. Now the opposite order is used.

On vector layers, even if decluttered images or texts have a lower z-Index than polygons or lines, they will now be rendered on top of the polygons or lines. For vector tile layers, this was the case already in previous releases.

New prerender and postrender layer events replace old precompose, render and postcompose events

If you were previously registering for precompose and postcompose events, you should now register for prerender and postrender events on layers. Instead of the previous render event, you should now listen for postrender. Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.

New getVectorContext function provides access to the immediate vector rendering API

Previously, render events included a vectorContext property that allowed you to render features or geometries directly to the map. This is still possible, but you now have to explicitly create a vector context with the getVectorContext function. This change makes the immediate rendering API an explicit dependency if your application uses it. If you don't use this API, your application bundle will not include the vector rendering modules (as it did before).

Here is an abbreviated example of how to use the getVectorContext function:

import {getVectorContext} from 'ol/render';

// construct your map and layers as usual

layer.on('postrender', function(event) {
  const vectorContext = getVectorContext(event);
  // use any of the drawing methods on the vector context
});
Layers can only be added to a single map

Previously, it was possible to render a single layer in two maps. Now, each layer can only belong to a single map (in the same way that a single DOM element can only have one parent).

T...
Read more

v5.3.3

29 May 10:14
272a3c6
Compare
Choose a tag to compare
5.3.3

v5.3.0

06 Nov 18:20
346cd56
Compare
Choose a tag to compare

We're continuing to work toward more complete type checking with TypeScript – based on JSDoc annotations in the source. The 5.3 release includes a number of bug fixes related to the type checking effort. In addition the release comes with a handful of new features and improved API reference docs.

Upgrade Notes

The getUid function returns string

The getUid function from the ol/util module now returns a string instead of a number.

Attributions are not collapsible for ol/source/OSM

When a map contains a layer from a ol/source/OSM source, the ol/control/Attribution control will be shown with the collapsible: false behavior.

To get the previous behavior, configure the ol/control/Attribution control with collapsible: true.

New Features and Fixes

Read more

v5.2.0

29 Aug 08:44
badc350
Compare
Choose a tag to compare

The 5.2 release adds a few new features a handful of fixes, including regressions that were reported after the 5.1 release. You should be able to upgrade without any additional work. See the one note below regarding snapToPixel on ol/style/Image and subclasses.

We're still working toward type checking with TypeScript. Until that is complete, we apologize for some flwas in the online API documentation. We're excited about the improved experience for application developers when the effort is finished, and will highlight some of the benefit in upcoming releases.

Upgrade Notes

Removal of the snapToPixel option for ol/style/Image subclasses

The snapToPixel option has been removed, and the getSnapToPixel and setSnapToPixel methods are deprecated.

The renderer now snaps to integer pixels when no interaction or animation is running to get crisp rendering. During interaction or animation, it does not snap to integer pixels to avoid jitter.

When rendering with the Immediate API, symbols will no longer be snapped to integer pixels. To get crisp images, set context.imageSmoothingEnabled = false before rendering with the Immediate API, and context.imageSmoothingEnabled = true afterwards.

New Features and Fixes

Dependency Updates
Read more

v5.1.3

21 Jul 15:49
9ec6233
Compare
Choose a tag to compare

The 5.1.3 release is a patch to fix the API docs and the legacy full build. See the 5.1.0 notes for detail on the 5.1 release.

v5.1.2

21 Jul 02:05
2767ddf
Compare
Choose a tag to compare

The 5.1.2 release is a patch to fix the API docs. See the 5.1.0 notes for detail on the 5.1 release.

v5.1.1

21 Jul 01:43
0b0d5c6
Compare
Choose a tag to compare

The 5.1.1 release is a patch to include the readme in the package. See the 5.1.0 notes for detail on the 5.1 release.

v5.1.0

21 Jul 01:36
e5d7b30
Compare
Choose a tag to compare

The 5.1 release adds a few new features a handful of fixes. You should be able to upgrade without any additional work. See the one note below regarding null geometry coordinates.

We're working toward type checking with TypeScript. This will complete our move away from using the Closure Compiler for type checking and compilation. We're excited about the improved experience for application developers and will highlight some of the benefit in upcoming releases.

Upgrade Notes

Geometry constructor and setCoordinates no longer accept null coordinates

Geometries (ol/geom/*) now need to be constructed with valid coordinates (center for ol/geom/Circle) as first constructor argument. The same applies to the setCoordinates() (setCenter() for ol/geom/Circle`) method.

New Features and Fixes

Dependency Updates

v5.0.3

11 Jul 09:38
349e602
Compare
Choose a tag to compare

The v5.0.3 fixes a regression in the vector tile renderer and improves the built examples and release package.

Fixes