UNPKG

12 kBMarkdownView Raw
1# v3.7.0
2
3## Summary
4
5The 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.
6
7## Upgrade notes
8
9#### Removal of `ol.FeatureOverlay`
10
11Instead of an `ol.FeatureOverlay`, we now use an `ol.layer.Vector` with an
12`ol.source.Vector`. If you previously had:
13```js
14var featureOverlay = new ol.FeatureOverlay({
15 map: map,
16 style: overlayStyle
17});
18featureOverlay.addFeature(feature);
19featureOverlay.removeFeature(feature);
20var collection = featureOverlay.getFeatures();
21```
22you will have to change this to:
23```js
24var collection = new ol.Collection();
25var featureOverlay = new ol.layer.Vector({
26 map: map,
27 source: new ol.source.Vector({
28 features: collection,
29 useSpatialIndex: false // optional, might improve performance
30 }),
31 style: overlayStyle,
32 updateWhileAnimating: true, // optional, for instant visual feedback
33 updateWhileInteracting: true // optional, for instant visual feedback
34});
35featureOverlay.getSource().addFeature(feature);
36featureOverlay.getSource().removeFeature(feature);
37```
38
39With 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.
40
41Note that `ol.FeatureOverlay#getFeatures()` returned an `{ol.Collection.<ol.Feature>}`, whereas `ol.source.Vector#getFeatures()` returns an `{Array.<ol.Feature>}`.
42
43#### `ol.TileCoord` changes
44
45Until 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.
46
47Previously, 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.
48
49This 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`:
50```js
51function tileUrlFunction = function(tileCoord, pixelRatio, projection) {
52 var urlTemplate = '{z}/{x}/{y}';
53 return urlTemplate
54 .replace('{z}', tileCoord[0].toString())
55 .replace('{x}', tileCoord[1].toString())
56 .replace('{y}', (-tileCoord[2] - 1).toString());
57}
58```
59
60The `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.
61
62The code snippets below show how your application code needs to be changed:
63
64Old application code (with `ol.tilegrid.TileGrid#createTileCoordTransform()`):
65```js
66var transform = source.getTileGrid().createTileCoordTransform();
67var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
68 tileCoord = transform(tileCoord, projection);
69 return 'http://mytiles.com/' +
70 tileCoord[0] + '/' + tileCoord[1] + '/' + tileCoord[2] + '.png';
71};
72```
73Old application code (with custom `y` transform):
74```js
75var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
76 var z = tileCoord[0];
77 var yFromBottom = tileCoord[2];
78 var resolution = tileGrid.getResolution(z);
79 var tileHeight = ol.size.toSize(tileSize)[1];
80 var matrixHeight =
81 Math.floor(ol.extent.getHeight(extent) / tileHeight / resolution);
82 return 'http://mytiles.com/' +
83 tileCoord[0] + '/' + tileCoord[1] + '/' +
84 (matrixHeight - yFromBottom - 1) + '.png';
85
86};
87```
88New application code (simple -y - 1 transform):
89```js
90var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
91 return 'http://mytiles.com/' +
92 tileCoord[0] + '/' + tileCoord[1] + '/' + (-tileCoord[2] - 1) + '.png';
93};
94```
95
96#### Removal of `ol.tilegrid.Zoomify`
97
98The 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]`.
99
100#### Replace `ol.View.fitExtent()` and `ol.View.fitGeometry()` with `ol.View.fit()`
101* This combines two previously distinct functions into one more flexible call which takes either a geometry or an extent.
102* Rename all calls to `fitExtent` and `fitGeometry` to `fit`.
103
104#### Change to `ol.interaction.Modify`
105
106When single clicking a line or boundary within the `pixelTolerance`, a vertex is now created.
107
108## New features and fixes
109
110 * [#3867](https://github.com/openlayers/openlayers/pull/3867) - Do not require projection extent for x-wrapping tile sources ([@ahocevar](https://github.com/ahocevar))
111 * [#3635](https://github.com/openlayers/openlayers/pull/3635) - Create vertex on boundary single click ([@bjornharrtell](https://github.com/bjornharrtell))
112 * [#3806](https://github.com/openlayers/openlayers/pull/3806) - Do not clip canvas for vector layers when wrapping the world ([@ahocevar](https://github.com/ahocevar))
113 * [#3461](https://github.com/openlayers/openlayers/pull/3461) - High level Modify interaction events ([@bjornharrtell](https://github.com/bjornharrtell))
114 * [#3865](https://github.com/openlayers/openlayers/pull/3865) - ol.View#fit() ([@bartvde](https://github.com/bartvde))
115 * [#3864](https://github.com/openlayers/openlayers/pull/3864) - Check projection.canWrapX() before wrapping tiles ([@klokantech](https://github.com/klokantech))
116 * [#3863](https://github.com/openlayers/openlayers/pull/3863) - Handle CDATA in attribute parsing for GML format ([@nhambletCCRI](https://github.com/nhambletCCRI))
117 * [#3860](https://github.com/openlayers/openlayers/pull/3860) - Update example layout. ([@tschaub](https://github.com/tschaub))
118 * [#3861](https://github.com/openlayers/openlayers/pull/3861) - Don't force 'dom' renderer ([@openlayers](https://github.com/openlayers))
119 * [#3855](https://github.com/openlayers/openlayers/pull/3855) - Adding an example with WMTS tiles from IGN Geoportail ([@pgiraud](https://github.com/pgiraud))
120 * [#3856](https://github.com/openlayers/openlayers/pull/3856) - ol.source.TileVector(): bind success function of tileLoadFunction to source ([@plepe](https://github.com/plepe))
121 * [#3848](https://github.com/openlayers/openlayers/pull/3848) - Check for exports before define. ([@tschaub](https://github.com/tschaub))
122 * [#3845](https://github.com/openlayers/openlayers/pull/3845) - Prevent null array to be passed to an ol.Collection ([@fredj](https://github.com/fredj))
123 * [#3849](https://github.com/openlayers/openlayers/pull/3849) - Pad min. and sec. with leading zeros in DMS notation ([@pgiraud](https://github.com/pgiraud))
124 * [#3842](https://github.com/openlayers/openlayers/pull/3842) - Adding a feature-animation example ([@pgiraud](https://github.com/pgiraud))
125 * [#3833](https://github.com/openlayers/openlayers/pull/3833) - Enable use of custom XHR loader for TileVector sources ([@bjornharrtell](https://github.com/bjornharrtell))
126 * [#3834](https://github.com/openlayers/openlayers/pull/3834) - ArcGIS tiled example broken in Chrome ([@bartvde](https://github.com/bartvde))
127 * [#3829](https://github.com/openlayers/openlayers/pull/3829) - incorrect assert message ([@kzr-pzr](https://github.com/kzr-pzr))
128 * [#3828](https://github.com/openlayers/openlayers/pull/3828) - Fix typo in upgrade notes ([@ahocevar](https://github.com/ahocevar))
129 * [#3826](https://github.com/openlayers/openlayers/pull/3826) - Allow custom tileGrid in ol.source.XYZ ([@klokantech](https://github.com/klokantech))
130 * [#3815](https://github.com/openlayers/openlayers/pull/3815) - Simplify tilegrid API and internals ([@ahocevar](https://github.com/ahocevar))
131 * [#3820](https://github.com/openlayers/openlayers/pull/3820) - Make unmanaged vector layers behave more like ol.FeatureOverlay ([@ahocevar](https://github.com/ahocevar))
132 * [#3822](https://github.com/openlayers/openlayers/pull/3822) - Correct docs for updateWhileInteracting ([@probins](https://github.com/probins))
133 * [#3818](https://github.com/openlayers/openlayers/pull/3818) - Make geometry.transform api stable again. ([@probins](https://github.com/probins))
134 * [#3801](https://github.com/openlayers/openlayers/pull/3801) - Respect the tile grid's extent in ol.source.TileVector ([@ahocevar](https://github.com/ahocevar))
135 * [#3810](https://github.com/openlayers/openlayers/pull/3810) - Improve TileGrid documentation and examples ([@ahocevar](https://github.com/ahocevar))
136 * [#3808](https://github.com/openlayers/openlayers/pull/3808) - Correct typo in OverlayOptions ([@probins](https://github.com/probins))
137 * [#3766](https://github.com/openlayers/openlayers/pull/3766) - Add a clickTolerance option to the Draw interaction ([@elemoine](https://github.com/elemoine))
138 * [#3804](https://github.com/openlayers/openlayers/pull/3804) - Remove sentence that was only meant for WMTS tile grids ([@ahocevar](https://github.com/ahocevar))
139 * [#3800](https://github.com/openlayers/openlayers/pull/3800) - Remove further references to FeatureOverlay ([@probins](https://github.com/probins))
140 * [#3780](https://github.com/openlayers/openlayers/pull/3780) - Only expose transformed tile coordinates to the API ([@ahocevar](https://github.com/ahocevar))
141 * [#3793](https://github.com/openlayers/openlayers/pull/3793) - Use 'managed' instead of 'unmanaged' in LayerState ([@ahocevar](https://github.com/ahocevar))
142 * [#3792](https://github.com/openlayers/openlayers/pull/3792) - Link to correct layer base class ([@marcjansen](https://github.com/marcjansen))
143 * [#3791](https://github.com/openlayers/openlayers/pull/3791) - Remove docs referring to removed feature overlay ([@marcjansen](https://github.com/marcjansen))
144 * [#3790](https://github.com/openlayers/openlayers/pull/3790) - Remove unnecessary quotes around object keys ([@fredj](https://github.com/fredj))
145 * [#3787](https://github.com/openlayers/openlayers/pull/3787) - Add 'unmanaged' to ol.layer.LayerState ([@ahocevar](https://github.com/ahocevar))
146 * [#3784](https://github.com/openlayers/openlayers/pull/3784) - Always write the GeoJSONFeature geometry property ([@fredj](https://github.com/fredj))
147 * [#3783](https://github.com/openlayers/openlayers/pull/3783) - Fix broken wmts-hidpi example ([@ahocevar](https://github.com/ahocevar))
148 * [#3782](https://github.com/openlayers/openlayers/pull/3782) - Fix assert documentation typo ([@gberaudo](https://github.com/gberaudo))
149 * [#3758](https://github.com/openlayers/openlayers/pull/3758) - Removal of ol.FeatureOverlay ([@ahocevar](https://github.com/ahocevar))
150 * [#3775](https://github.com/openlayers/openlayers/pull/3775) - Add ol-touch but keep ol-viewport className. ([@pgiraud](https://github.com/pgiraud))
151 * [#3713](https://github.com/openlayers/openlayers/pull/3713) - Add missing propertyNames member for olx.format.WFSWriteGetFeatureOptions ([@bartvde](https://github.com/bartvde))
152 * [#3763](https://github.com/openlayers/openlayers/pull/3763) - Standardise draw/modify descriptions ([@probins](https://github.com/probins))