From e2883fb658b08cdb1292e48e15579ebea286ef00 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 27 Dec 2021 12:25:11 -0700 Subject: [PATCH] Deprecate the imageSmoothing option for sources --- changelog/upgrade-notes.md | 24 ++++++++++ ...-image-smoothing.css => interpolation.css} | 0 ...mage-smoothing.html => interpolation.html} | 23 ++++----- ...le-image-smoothing.js => interpolation.js} | 48 +++---------------- examples/reprojection-image.html | 4 +- examples/reprojection-image.js | 6 +-- src/ol/renderer/canvas/ImageLayer.js | 6 ++- src/ol/renderer/canvas/TileLayer.js | 6 ++- src/ol/renderer/canvas/common.js | 12 +++++ src/ol/reproj.js | 21 ++++---- src/ol/reproj/Image.js | 10 ++-- src/ol/reproj/Tile.js | 15 ++---- src/ol/source/BingMaps.js | 12 ++++- src/ol/source/DataTile.js | 6 --- src/ol/source/IIIF.js | 12 ++++- src/ol/source/Image.js | 28 +++++------ src/ol/source/ImageArcGISRest.js | 12 ++++- src/ol/source/ImageCanvas.js | 12 ++++- src/ol/source/ImageMapGuide.js | 12 ++++- src/ol/source/ImageStatic.js | 17 +++++-- src/ol/source/ImageWMS.js | 12 ++++- src/ol/source/OGCMapTile.js | 12 ++++- src/ol/source/OSM.js | 12 ++++- src/ol/source/Source.js | 14 ++++-- src/ol/source/Stamen.js | 12 ++++- src/ol/source/Tile.js | 1 + src/ol/source/TileArcGISRest.js | 12 ++++- src/ol/source/TileImage.js | 38 +++++++-------- src/ol/source/TileJSON.js | 12 ++++- src/ol/source/TileWMS.js | 12 ++++- src/ol/source/WMTS.js | 12 ++++- src/ol/source/XYZ.js | 13 ++++- src/ol/source/Zoomify.js | 12 ++++- src/ol/source/common.js | 9 ---- .../{bingmaps.test.js => BingMaps.test.js} | 19 +++++++- .../{datatile.test.js => DataTile.test.js} | 14 +++++- .../ol/source/{iiif.test.js => IIIF.test.js} | 19 +++++++- ...isrest.test.js => ImageArcGISRest.test.js} | 23 ++++++++- ...magestatic.test.js => ImageStatic.test.js} | 19 +++++++- .../source/{source.test.js => Source.test.js} | 14 +++++- .../ol/source/{tile.test.js => Tile.test.js} | 14 +++++- .../{tileimage.test.js => TileImage.test.js} | 19 +++++++- .../{tilejson.test.js => TileJSON.test.js} | 25 +++++++++- .../{tilewms.test.js => TileWMS.test.js} | 19 +++++++- .../{urltile.test.js => UrlTile.test.js} | 14 +++++- .../ol/source/{wmts.test.js => WMTS.test.js} | 19 +++++++- .../ol/source/{xyz.test.js => XYZ.test.js} | 19 +++++++- .../{zoomify.test.js => Zoomify.test.js} | 23 ++++++++- 48 files changed, 538 insertions(+), 191 deletions(-) rename examples/{disable-image-smoothing.css => interpolation.css} (100%) rename examples/{disable-image-smoothing.html => interpolation.html} (52%) rename examples/{disable-image-smoothing.js => interpolation.js} (62%) create mode 100644 src/ol/renderer/canvas/common.js rename test/browser/spec/ol/source/{bingmaps.test.js => BingMaps.test.js} (81%) rename test/browser/spec/ol/source/{datatile.test.js => DataTile.test.js} (73%) rename test/browser/spec/ol/source/{iiif.test.js => IIIF.test.js} (96%) rename test/browser/spec/ol/source/{imagearcgisrest.test.js => ImageArcGISRest.test.js} (89%) rename test/browser/spec/ol/source/{imagestatic.test.js => ImageStatic.test.js} (83%) rename test/browser/spec/ol/source/{source.test.js => Source.test.js} (90%) rename test/browser/spec/ol/source/{tile.test.js => Tile.test.js} (96%) rename test/browser/spec/ol/source/{tileimage.test.js => TileImage.test.js} (93%) rename test/browser/spec/ol/source/{tilejson.test.js => TileJSON.test.js} (90%) rename test/browser/spec/ol/source/{tilewms.test.js => TileWMS.test.js} (96%) rename test/browser/spec/ol/source/{urltile.test.js => UrlTile.test.js} (93%) rename test/browser/spec/ol/source/{wmts.test.js => WMTS.test.js} (97%) rename test/browser/spec/ol/source/{xyz.test.js => XYZ.test.js} (92%) rename test/browser/spec/ol/source/{zoomify.test.js => Zoomify.test.js} (93%) diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index 50a571b98f..9a5195e351 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -1,5 +1,29 @@ ## Upgrade notes +### Next + +#### New `interpolate` option for sources + +Sources now have an `interpolate` option. This option controls whether data from the source is interpolated when resampling. + +For `ol/source/DataTile` sources, the default is `interpolate: false`. This means that when a data tile source is used with a WebGL tile layer renderer, your style expression will have access to pixel values in the data tiles without interpolation. If this option is set to true, linear interpolation will be used when over- or under-sampling the data. + +#### Deprecation of the `imageSmoothing` option for sources + +The `imageSmoothing` option for sources has been deprecated and will be removed in the next major release. Use the `interpolate` option instead. + +```js +// if you were using `imageSmoothing` +const before = new TileSource({ + imageSmoothing: false +}); + +// use the `interpolate` option instead +const after = new TileSource({ + interpolate: false +}); +``` + ### v6.9.0 There should be nothing special required when upgrading from v6.8 to v6.9. diff --git a/examples/disable-image-smoothing.css b/examples/interpolation.css similarity index 100% rename from examples/disable-image-smoothing.css rename to examples/interpolation.css diff --git a/examples/disable-image-smoothing.html b/examples/interpolation.html similarity index 52% rename from examples/disable-image-smoothing.html rename to examples/interpolation.html index 39a452daa6..65ff446f6a 100644 --- a/examples/disable-image-smoothing.html +++ b/examples/interpolation.html @@ -1,22 +1,22 @@ --- layout: example.html -title: Disable Image Smoothing -shortdesc: Example of disabling image smoothing +title: Interpolation +shortdesc: Example of data interpolation docs: > - Example of disabling image smoothing when using raster DEM (digital elevation model) data. - The imageSmoothing: false setting is used to disable canvas image smoothing during + Example of data resampling when using raster DEM (digital elevation model) data. + The interpolate: false setting is used to disable interpolation of data values during reprojection and rendering. Elevation data is calculated from the pixel value returned by forEachLayerAtPixel. For comparison a second map - with smoothing enabled returns inaccuate elevations which are very noticeable close to 3107 meters + with interpolation enabled returns inaccuate elevations which are very noticeable close to 3107 meters due to how elevation is calculated from the pixel value. -tags: "disable image smoothing, xyz, maptiler, reprojection" +tags: "disable image interpolation, xyz, maptiler, reprojection" cloak: - key: get_your_own_D6rA4zTHduk6KOKTXzGB value: Get your own API key at https://www.maptiler.com/cloud/ ---
-

Smoothing Disabled

+

Not Interpolated

-
- -
-

Uncorrected Comparison

+

Interpolated