The 4.6 release includes enhancements and fixes from 30 or so pull requests. Headlining this release, vector layers got new textBackgroundFill
, textBackgroundStroke
and padding
options that can be used to render background boxes for text. ol.source.ImageVector
is now deprecated and replaced by a more convenient way to render vectors as images: by simply setting renderMode: 'image'
on the vector layer.
Please note that if you are using closure-util
to build your OpenLayers based application, it is time to migrate to using the ol
package and a module bundler like webpack. OpenLayers has not had a dependency on the Closure Library since the 3.19 release; and with the 5.0 release we will be moving completely away from goog.require
and goog.provide
, dropping support for closure-util
, and going with ES modules for our sources.
See the wiki about upcoming changes in 5.0 and tips on how to upgrade. We likely won't have another 4.x release before the 5.0 release. If you're interested in continuing to get feature enhancements in future releases, migrating to the ol
package now will make the transition easier.
To update your applications, simply replace exceedLength
with overflow
.
Rendering vector sources as image is now directly supported by ol.layer.Vector
with the new renderMode: 'image'
configuration option. Change code like this:
new ol.layer.Image({
source: new ol.source.ImageVector({
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
})
});
to:
new ol.layer.Vector({
renderMode: 'image',
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
});
See below for the full list of changes.
- #7538 - removeFromLoadedExtents to remove extents that failed to load (@ahocevar)
- #7537 - Fix Draw.removeLastPoint exception when no points to remove (@walkermatt)
- #7461 - Use the matrixSet projection by default (@oterral)
- #5883 - Fixes setUrl() for WMTS sources (ol.source.WMTS) (@bylexus)
- #7531 - Update the ol package readme (@ahocevar)
- #7372 - Add method to set max cache size in ol.style.IconImageCache (@notnotse)
- #7530 - Check forward/back 1 world if wrapping (@raiyni)
- #7526 - Allow clicks to be stopped while drawing (@tschaub)
- #7524 - Snap view center to pixel (@ahocevar)
- #7521 - fix setMinZoom/setMaxZoom (@cs09g)
- #7519 - Reuse declutter tree for hit detection (@ahocevar)
- #7499 - Remove attributions from olx.FrameState instances (@openlayers)
- #7501 - Option to render vector layers as images (@ahocevar)
- #7516 - Deprecate exceedLength and replace with overflow (@ahocevar)
- #7510 - Do not fade the states layer (@ahocevar)
- #7513 - Make strokeKey safer (@ahocevar)
- #7514 - Prune the label cache less aggressively (@ahocevar)
- #7505 - Remove ol.DeviceOrientation link from API index (@fredj)
- #7497 - Use getGeometry (@nicholas-l)
- #7495 - Remove layer renderers when viewport is removed (@ahocevar)
- #7492 - Remove unneeded type cast from examples (@fredj)
- #7489 - Allow string to be passed as ol.interaction.Draw type (@fredj)
- #7445 - Load css rules from full-screen.css in examples (@fredj)
- #7481 - Make zoom to extent control extensible (@gberaudo)
- #7477 - Make text states available for replay time (@ahocevar)
- #7482 - Reset rotation after rendering (@ahocevar)
- #7480 - Create a new image when loading tile after an error (@ahocevar)
- #7476 - Reset text measurements when available fonts change (@ahocevar)
- #7454 - Add text background rendering and text padding (@ahocevar)
- #7468 - Add new API-key for HERE example (@chrismayer)
- #7465 - Export ol.proj.Projection#getAxisOrientation function (@fredj)
- #7462 - Respect metersPerUnit in ScaleLine control (@ahocevar)
Additionally a number of updates where made to our dependencies:
- #7536 - Update fs-extra to the latest version 🚀 (@openlayers)
- #7533 - Update marked to the latest version 🚀 (@openlayers)
- #7527 - Update eslint to the latest version 🚀 (@openlayers)
- #7511 - Update rollup to the latest version 🚀 (@openlayers)
- #7512 - Update eslint to the latest version 🚀 (@openlayers)
- #7484 - Update closure-util to the latest version 🚀 (@openlayers)