ol 10.7.1 → 10.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/Collection.d.ts +1 -3
  2. package/Collection.d.ts.map +1 -1
  3. package/Feature.d.ts +6 -15
  4. package/Feature.d.ts.map +1 -1
  5. package/Feature.js +3 -6
  6. package/Geolocation.d.ts +1 -3
  7. package/Geolocation.d.ts.map +1 -1
  8. package/ImageTile.d.ts +2 -12
  9. package/ImageTile.d.ts.map +1 -1
  10. package/ImageTile.js +5 -32
  11. package/Map.d.ts +7 -27
  12. package/Map.d.ts.map +1 -1
  13. package/Map.js +3 -29
  14. package/Object.d.ts +18 -15
  15. package/Object.d.ts.map +1 -1
  16. package/Object.js +6 -9
  17. package/Overlay.d.ts +1 -3
  18. package/Overlay.d.ts.map +1 -1
  19. package/VectorRenderTile.d.ts +0 -4
  20. package/VectorRenderTile.d.ts.map +1 -1
  21. package/VectorRenderTile.js +0 -2
  22. package/View.d.ts +1 -40
  23. package/View.d.ts.map +1 -1
  24. package/View.js +0 -94
  25. package/colorlike.js +8 -4
  26. package/control/Control.d.ts +1 -3
  27. package/control/Control.d.ts.map +1 -1
  28. package/control/OverviewMap.d.ts +1 -5
  29. package/control/OverviewMap.d.ts.map +1 -1
  30. package/coordinate.d.ts +0 -8
  31. package/coordinate.d.ts.map +1 -1
  32. package/coordinate.js +1 -31
  33. package/dist/ol.d.ts +0 -24
  34. package/dist/ol.d.ts.map +1 -1
  35. package/dist/ol.js +1 -1
  36. package/dist/ol.js.map +1 -1
  37. package/dom.d.ts +0 -15
  38. package/dom.d.ts.map +1 -1
  39. package/dom.js +0 -6
  40. package/featureloader.d.ts +2 -6
  41. package/featureloader.d.ts.map +1 -1
  42. package/format/EsriJSON.d.ts +1 -3
  43. package/format/EsriJSON.d.ts.map +1 -1
  44. package/format/Feature.d.ts +1 -3
  45. package/format/Feature.d.ts.map +1 -1
  46. package/format/GeoJSON.d.ts +2 -6
  47. package/format/GeoJSON.d.ts.map +1 -1
  48. package/format/JSONFeature.d.ts +1 -3
  49. package/format/JSONFeature.d.ts.map +1 -1
  50. package/format/KML.d.ts +0 -9
  51. package/format/KML.d.ts.map +1 -1
  52. package/format/KML.js +0 -7
  53. package/format/TextFeature.d.ts +1 -3
  54. package/format/TextFeature.d.ts.map +1 -1
  55. package/format/TopoJSON.d.ts +1 -3
  56. package/format/TopoJSON.d.ts.map +1 -1
  57. package/format/WKB.d.ts +1 -3
  58. package/format/WKB.d.ts.map +1 -1
  59. package/format/XMLFeature.d.ts +1 -3
  60. package/format/XMLFeature.d.ts.map +1 -1
  61. package/geom/Geometry.d.ts +1 -3
  62. package/geom/Geometry.d.ts.map +1 -1
  63. package/interaction/DragAndDrop.d.ts +2 -6
  64. package/interaction/DragAndDrop.d.ts.map +1 -1
  65. package/interaction/Draw.d.ts +3 -9
  66. package/interaction/Draw.d.ts.map +1 -1
  67. package/interaction/Interaction.d.ts +1 -3
  68. package/interaction/Interaction.d.ts.map +1 -1
  69. package/interaction/Link.js +2 -2
  70. package/interaction/Modify.d.ts +28 -76
  71. package/interaction/Modify.d.ts.map +1 -1
  72. package/interaction/Modify.js +54 -248
  73. package/interaction/Select.d.ts +18 -10
  74. package/interaction/Select.d.ts.map +1 -1
  75. package/interaction/Select.js +89 -54
  76. package/interaction/Snap.d.ts +12 -18
  77. package/interaction/Snap.d.ts.map +1 -1
  78. package/interaction/Translate.d.ts +2 -6
  79. package/interaction/Translate.d.ts.map +1 -1
  80. package/layer/Base.d.ts +8 -19
  81. package/layer/Base.d.ts.map +1 -1
  82. package/layer/Base.js +3 -6
  83. package/layer/BaseImage.d.ts +1 -3
  84. package/layer/BaseImage.d.ts.map +1 -1
  85. package/layer/BaseTile.d.ts +1 -3
  86. package/layer/BaseTile.d.ts.map +1 -1
  87. package/layer/BaseVector.d.ts +1 -3
  88. package/layer/BaseVector.d.ts.map +1 -1
  89. package/layer/Flow.d.ts +2 -2
  90. package/layer/Graticule.d.ts +1 -5
  91. package/layer/Graticule.d.ts.map +1 -1
  92. package/layer/Group.d.ts +2 -8
  93. package/layer/Group.d.ts.map +1 -1
  94. package/layer/Heatmap.d.ts +2 -23
  95. package/layer/Heatmap.d.ts.map +1 -1
  96. package/layer/Heatmap.js +0 -29
  97. package/layer/Layer.d.ts +8 -17
  98. package/layer/Layer.d.ts.map +1 -1
  99. package/layer/Layer.js +2 -5
  100. package/layer/Tile.d.ts +1 -1
  101. package/layer/Vector.d.ts +2 -2
  102. package/layer/Vector.d.ts.map +1 -1
  103. package/layer/VectorImage.d.ts +2 -2
  104. package/layer/VectorImage.d.ts.map +1 -1
  105. package/layer/VectorTile.d.ts +2 -2
  106. package/layer/VectorTile.d.ts.map +1 -1
  107. package/layer/WebGLPoints.d.ts +1 -3
  108. package/layer/WebGLPoints.d.ts.map +1 -1
  109. package/layer/WebGLTile.d.ts +3 -3
  110. package/layer/WebGLTile.d.ts.map +1 -1
  111. package/layer/WebGLVector.d.ts +2 -4
  112. package/layer/WebGLVector.d.ts.map +1 -1
  113. package/layer/WebGLVectorTile.d.ts +2 -2
  114. package/layer/WebGLVectorTile.d.ts.map +1 -1
  115. package/package.json +3 -4
  116. package/proj/proj4.d.ts +6 -43
  117. package/proj/proj4.d.ts.map +1 -1
  118. package/proj/proj4.js +28 -89
  119. package/proj.js +2 -2
  120. package/render/canvas/Builder.d.ts.map +1 -1
  121. package/render/canvas/Builder.js +1 -8
  122. package/render/canvas/Executor.d.ts.map +1 -1
  123. package/render/canvas/Executor.js +3 -49
  124. package/render/canvas/ExecutorGroup.d.ts.map +1 -1
  125. package/render/canvas/ExecutorGroup.js +5 -41
  126. package/render/canvas/Immediate.d.ts +0 -2
  127. package/render/canvas/Immediate.d.ts.map +1 -1
  128. package/render/canvas/Immediate.js +4 -28
  129. package/render/canvas/LineStringBuilder.d.ts +0 -1
  130. package/render/canvas/LineStringBuilder.d.ts.map +1 -1
  131. package/render/canvas/LineStringBuilder.js +5 -15
  132. package/render/canvas/PolygonBuilder.d.ts +0 -2
  133. package/render/canvas/PolygonBuilder.d.ts.map +1 -1
  134. package/render/canvas/PolygonBuilder.js +6 -72
  135. package/render/canvas/style.d.ts.map +1 -1
  136. package/render/canvas/style.js +37 -118
  137. package/render/canvas.d.ts +2 -22
  138. package/render/canvas.d.ts.map +1 -1
  139. package/render/canvas.js +0 -9
  140. package/render/webgl/bufferUtil.d.ts.map +1 -1
  141. package/render/webgl/bufferUtil.js +31 -1
  142. package/renderer/Composite.js +4 -4
  143. package/renderer/canvas/ImageLayer.d.ts +1 -6
  144. package/renderer/canvas/ImageLayer.d.ts.map +1 -1
  145. package/renderer/canvas/ImageLayer.js +0 -14
  146. package/renderer/canvas/TileLayer.d.ts +1 -1
  147. package/renderer/canvas/VectorLayer.d.ts +1 -8
  148. package/renderer/canvas/VectorLayer.d.ts.map +1 -1
  149. package/renderer/canvas/VectorLayer.js +14 -55
  150. package/renderer/canvas/VectorTileLayer.d.ts +1 -1
  151. package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
  152. package/renderer/canvas/VectorTileLayer.js +0 -2
  153. package/renderer/webgl/TileLayerBase.js +1 -1
  154. package/reproj/Tile.d.ts +2 -7
  155. package/reproj/Tile.d.ts.map +1 -1
  156. package/reproj/Tile.js +6 -12
  157. package/source/Cluster.d.ts +2 -8
  158. package/source/Cluster.d.ts.map +1 -1
  159. package/source/DataTile.d.ts +0 -15
  160. package/source/DataTile.d.ts.map +1 -1
  161. package/source/DataTile.js +0 -9
  162. package/source/GeoTIFF.d.ts +2 -7
  163. package/source/GeoTIFF.d.ts.map +1 -1
  164. package/source/GeoTIFF.js +10 -15
  165. package/source/ImageArcGISRest.d.ts +0 -10
  166. package/source/ImageArcGISRest.d.ts.map +1 -1
  167. package/source/ImageArcGISRest.js +0 -8
  168. package/source/ImageMapGuide.d.ts +0 -10
  169. package/source/ImageMapGuide.d.ts.map +1 -1
  170. package/source/ImageMapGuide.js +0 -8
  171. package/source/ImageStatic.d.ts +0 -5
  172. package/source/ImageStatic.d.ts.map +1 -1
  173. package/source/ImageStatic.js +0 -2
  174. package/source/ImageTile.d.ts +1 -5
  175. package/source/ImageTile.d.ts.map +1 -1
  176. package/source/ImageTile.js +0 -5
  177. package/source/ImageWMS.d.ts +0 -10
  178. package/source/ImageWMS.d.ts.map +1 -1
  179. package/source/ImageWMS.js +0 -10
  180. package/source/OGCMapTile.d.ts +0 -5
  181. package/source/OGCMapTile.d.ts.map +1 -1
  182. package/source/OGCMapTile.js +0 -2
  183. package/source/OSM.d.ts +0 -5
  184. package/source/OSM.d.ts.map +1 -1
  185. package/source/OSM.js +19 -5
  186. package/source/SentinelHub.d.ts +0 -1
  187. package/source/SentinelHub.d.ts.map +1 -1
  188. package/source/SentinelHub.js +0 -5
  189. package/source/Source.d.ts +1 -3
  190. package/source/Source.d.ts.map +1 -1
  191. package/source/TileArcGISRest.d.ts +1 -6
  192. package/source/TileArcGISRest.d.ts.map +1 -1
  193. package/source/TileArcGISRest.js +0 -2
  194. package/source/TileDebug.d.ts +1 -1
  195. package/source/TileImage.d.ts +0 -10
  196. package/source/TileImage.d.ts.map +1 -1
  197. package/source/TileImage.js +3 -16
  198. package/source/TileWMS.d.ts +1 -1
  199. package/source/UrlTile.d.ts +1 -1
  200. package/source/Vector.d.ts +8 -18
  201. package/source/Vector.d.ts.map +1 -1
  202. package/source/Vector.js +3 -3
  203. package/source/WMTS.d.ts +0 -5
  204. package/source/WMTS.d.ts.map +1 -1
  205. package/source/WMTS.js +0 -2
  206. package/source/XYZ.d.ts +0 -5
  207. package/source/XYZ.d.ts.map +1 -1
  208. package/source/XYZ.js +0 -2
  209. package/source/Zoomify.d.ts +2 -7
  210. package/source/Zoomify.d.ts.map +1 -1
  211. package/source/Zoomify.js +3 -5
  212. package/source/arcgisRest.d.ts +0 -5
  213. package/source/arcgisRest.d.ts.map +1 -1
  214. package/source/arcgisRest.js +0 -5
  215. package/source/mapguide.d.ts +0 -4
  216. package/source/mapguide.d.ts.map +1 -1
  217. package/source/mapguide.js +0 -5
  218. package/source/mapserver.d.ts +1 -5
  219. package/source/mapserver.d.ts.map +1 -1
  220. package/source/mapserver.js +0 -4
  221. package/source/ogcTileUtil.d.ts +12 -20
  222. package/source/ogcTileUtil.d.ts.map +1 -1
  223. package/source/ogcTileUtil.js +15 -27
  224. package/source/static.d.ts +0 -5
  225. package/source/static.d.ts.map +1 -1
  226. package/source/static.js +0 -4
  227. package/source/wms.d.ts +0 -5
  228. package/source/wms.d.ts.map +1 -1
  229. package/source/wms.js +0 -5
  230. package/style/Circle.d.ts +14 -0
  231. package/style/Circle.d.ts.map +1 -1
  232. package/style/Circle.js +11 -0
  233. package/style/Fill.js +1 -1
  234. package/style/Icon.d.ts +0 -19
  235. package/style/Icon.d.ts.map +1 -1
  236. package/style/Icon.js +2 -55
  237. package/style/IconImage.d.ts +5 -14
  238. package/style/IconImage.d.ts.map +1 -1
  239. package/style/IconImage.js +18 -28
  240. package/style/IconImageCache.d.ts +8 -4
  241. package/style/IconImageCache.d.ts.map +1 -1
  242. package/style/IconImageCache.js +13 -11
  243. package/style/RegularShape.d.ts +0 -12
  244. package/style/RegularShape.d.ts.map +1 -1
  245. package/style/RegularShape.js +4 -36
  246. package/style/Stroke.d.ts +0 -25
  247. package/style/Stroke.d.ts.map +1 -1
  248. package/style/Stroke.js +0 -28
  249. package/style/Style.d.ts +1 -1
  250. package/style/flat.d.ts +2 -2
  251. package/style/flat.js +1 -1
  252. package/tilegrid/TileGrid.d.ts +0 -5
  253. package/tilegrid/TileGrid.d.ts.map +1 -1
  254. package/tilegrid/TileGrid.js +0 -8
  255. package/util.js +1 -1
  256. package/worker/webgl.js +1 -1
  257. package/geom/flat/lineoffset.d.ts +0 -45
  258. package/geom/flat/lineoffset.d.ts.map +0 -1
  259. package/geom/flat/lineoffset.js +0 -173
  260. package/source/GeoZarr.d.ts +0 -163
  261. package/source/GeoZarr.d.ts.map +0 -1
  262. package/source/GeoZarr.js +0 -472
  263. package/source/OGCMap.d.ts +0 -180
  264. package/source/OGCMap.d.ts.map +0 -1
  265. package/source/OGCMap.js +0 -227
  266. package/source/ogcMapUtil.d.ts +0 -88
  267. package/source/ogcMapUtil.d.ts.map +0 -1
  268. package/source/ogcMapUtil.js +0 -121
package/source/GeoZarr.js DELETED
@@ -1,472 +0,0 @@
1
- /**
2
- * @module ol/source/GeoZarr
3
- */
4
-
5
- import {FetchStore, get, open, slice} from 'zarrita';
6
- import {getCenter} from '../extent.js';
7
- import {get as getProjection, toUserCoordinate, toUserExtent} from '../proj.js';
8
- import {toSize} from '../size.js';
9
- import WMTSTileGrid from '../tilegrid/WMTS.js';
10
- import DataTileSource from './DataTile.js';
11
- import {parseTileMatrixSet} from './ogcTileUtil.js';
12
-
13
- const REQUIRED_ZARR_CONVENTIONS = [
14
- 'd35379db-88df-4056-af3a-620245f8e347', // multisacles
15
- 'f17cb550-5864-4468-aeb7-f3180cfb622f', // proj:
16
- '689b58e2-cf7b-45e0-9fff-9cfc0883d6b4', // spatial:
17
- ];
18
-
19
- /**
20
- * @typedef {'nearest'|'linear'} ResampleMethod
21
- */
22
-
23
- /**
24
- * @typedef {Object} Options
25
- * @property {string} url The Zarr URL.
26
- * @property {string} group The group with arrays to render.
27
- * @property {Array<string>} bands The band names to render.
28
- * @property {import("../proj.js").ProjectionLike} [projection] Source projection. If not provided, the GeoTIFF metadata
29
- * will be read for projection information.
30
- * @property {number} [transition=250] Duration of the opacity transition for rendering.
31
- * To disable the opacity transition, pass `transition: 0`.
32
- * @property {boolean} [wrapX=false] Render tiles beyond the tile grid extent.
33
- * @property {ResampleMethod} [resample='nearest'] Resamplilng method if bands are not available for all multi-scale levels.
34
- */
35
-
36
- export default class GeoZarr extends DataTileSource {
37
- /**
38
- * @param {Options} options The options.
39
- */
40
- constructor(options) {
41
- super({
42
- state: 'loading',
43
- tileGrid: null,
44
- projection: options.projection || null,
45
- transition: options.transition,
46
- wrapX: options.wrapX,
47
- });
48
-
49
- /**
50
- * @type {string}
51
- */
52
- this.url_ = options.url;
53
-
54
- /**
55
- * @type {string}
56
- */
57
- this.group_ = options.group;
58
-
59
- /**
60
- * @type {Error|null}
61
- */
62
- this.error_ = null;
63
-
64
- /**
65
- * @type {import('zarrita').Group<any>}
66
- */
67
- this.root_ = null;
68
-
69
- /**
70
- * @type {any|null}
71
- */
72
- this.consolidatedMetadata_ = null;
73
-
74
- /**
75
- * @type {Array<string>}
76
- */
77
- this.bands_ = options.bands;
78
-
79
- /**
80
- * @type {Object<string, Array<string>> | null}
81
- */
82
- this.bandsByLevel_ = null;
83
-
84
- /**
85
- * @type {number|undefined}
86
- */
87
- this.fillValue_;
88
-
89
- /**
90
- * @type {ResampleMethod}
91
- */
92
- this.resampleMethod_ = options.resample || 'linear';
93
-
94
- /**
95
- * @type {number} Number of bands.
96
- */
97
- this.bandCount = this.bands_.length;
98
-
99
- this.setLoader(this.loadTile_.bind(this));
100
-
101
- /**
102
- * @type {import("../tilegrid/WMTS.js").default}
103
- */
104
- this.tileGrid;
105
-
106
- this.configure_()
107
- .then(() => {
108
- this.setState('ready');
109
- })
110
- .catch((err) => {
111
- this.error_ = err;
112
- this.setState('error');
113
- });
114
- }
115
-
116
- async configure_() {
117
- const store = new FetchStore(this.url_);
118
-
119
- this.root_ = await open(store, {kind: 'group'});
120
-
121
- try {
122
- this.consolidatedMetadata_ = JSON.parse(
123
- new TextDecoder().decode(
124
- await store.get(this.root_.resolve('zarr.json').path),
125
- ),
126
- ).consolidated_metadata.metadata;
127
- } catch {
128
- // empty catch block
129
- }
130
-
131
- const group = await open(this.root_.resolve(this.group_), {kind: 'group'});
132
-
133
- const attributes =
134
- /** @type {LegacyDatasetAttributes | DatasetAttributes} */ (group.attrs);
135
-
136
- if (
137
- 'zarr_conventions' in attributes &&
138
- Array.isArray(attributes.zarr_conventions) &&
139
- REQUIRED_ZARR_CONVENTIONS.every((uuid) =>
140
- attributes.zarr_conventions.find((c) => c.uuid === uuid),
141
- ) &&
142
- 'layout' in attributes.multiscales
143
- ) {
144
- const {tileGrid, projection, bandsByLevel, fillValue} =
145
- getTileGridInfoFromAttributes(
146
- /** @type {DatasetAttributes} */ (attributes),
147
- this.consolidatedMetadata_,
148
- this.group_,
149
- this.bands_,
150
- );
151
- this.bandsByLevel_ = bandsByLevel;
152
- this.tileGrid = tileGrid;
153
- this.projection = projection;
154
- this.fillValue_ = fillValue;
155
- }
156
- if ('tile_matrix_set' in attributes.multiscales) {
157
- // If available, use tile_matrix_set (legacy attributes) to get a tile grid, because it
158
- // provides a better mapping of tiles to zarr chunks.
159
- const {tileGrid, projection} = getTileGridInfoFromLegacyAttributes(
160
- /** @type {LegacyDatasetAttributes} */ (attributes),
161
- );
162
- this.tileGrid = tileGrid;
163
- if (!this.projection) {
164
- // If there were no required zarr conventions, we don't have a projection yet
165
- this.projection = projection;
166
- }
167
- }
168
- if (!this.tileGrid) {
169
- throw new Error('Could not determine tile grid');
170
- }
171
-
172
- const extent = this.tileGrid.getExtent();
173
- setTimeout(() => {
174
- this.viewResolver({
175
- showFullExtent: true,
176
- projection: this.projection,
177
- resolutions: this.tileGrid.getResolutions(),
178
- center: toUserCoordinate(getCenter(extent), this.projection),
179
- extent: toUserExtent(extent, this.projection),
180
- zoom: 1,
181
- });
182
- });
183
- }
184
-
185
- /**
186
- * @param {number} z The z tile index.
187
- * @param {number} x The x tile index.
188
- * @param {number} y The y tile index.
189
- * @param {import('./DataTile.js').LoaderOptions} options The loader options.
190
- * @return {Promise} The composed tile data.
191
- * @private
192
- */
193
- async loadTile_(z, x, y, options) {
194
- const resolutions = this.tileGrid.getResolutions();
195
- const tileResolution = this.tileGrid.getResolution(z);
196
- const tileExtent = this.tileGrid.getTileCoordExtent([z, x, y]);
197
-
198
- const bandPromises = [];
199
- const bandResolutions = [];
200
- for (const band of this.bands_) {
201
- let bandMatrixId;
202
- let bandResolution;
203
- let bandZ = 0;
204
-
205
- if (!this.bandsByLevel_) {
206
- // TODO: remove this if we stop supporting legacy attributes
207
- bandMatrixId = this.tileGrid.getMatrixId(z);
208
- bandResolution = tileResolution;
209
- bandZ = z;
210
- } else {
211
- for (
212
- let candidateZ = 0;
213
- candidateZ < resolutions.length;
214
- candidateZ += 1
215
- ) {
216
- const candidateResolution = resolutions[candidateZ];
217
- if (bandMatrixId && candidateResolution < tileResolution) {
218
- break;
219
- }
220
- const candidateMatrixId = this.tileGrid.getMatrixId(candidateZ);
221
- if (this.bandsByLevel_[candidateMatrixId].includes(band)) {
222
- bandMatrixId = candidateMatrixId;
223
- bandResolution = this.tileGrid.getResolution(candidateZ);
224
- bandZ = candidateZ;
225
- }
226
- }
227
- }
228
-
229
- if (!bandMatrixId || !bandResolution) {
230
- throw new Error(`Could not find available resolution for band ${band}`);
231
- }
232
-
233
- const origin = this.tileGrid.getOrigin(bandZ);
234
- const minCol = Math.round((tileExtent[0] - origin[0]) / bandResolution);
235
- const maxCol = Math.round((tileExtent[2] - origin[0]) / bandResolution);
236
-
237
- const minRow = Math.round((origin[1] - tileExtent[3]) / bandResolution);
238
- const maxRow = Math.round((origin[1] - tileExtent[1]) / bandResolution);
239
-
240
- const path = `${this.group_}/${bandMatrixId}/${band}`;
241
- const array = await open(this.root_.resolve(path), {kind: 'array'});
242
- bandPromises.push(
243
- get(array, [slice(minRow, maxRow), slice(minCol, maxCol)]),
244
- );
245
- bandResolutions.push(bandResolution);
246
- }
247
-
248
- const bandChunks = await Promise.all(bandPromises);
249
- const [tileColCount, tileRowCount] = toSize(this.tileGrid.getTileSize(z));
250
- return composeData(
251
- bandChunks,
252
- bandResolutions,
253
- tileColCount,
254
- tileRowCount,
255
- tileResolution,
256
- this.resampleMethod_,
257
- this.fillValue_ || 0,
258
- );
259
- }
260
- }
261
-
262
- /**
263
- * @typedef {Object} DatasetAttributes
264
- * @property {Multiscales} multiscales The multiscales attribute.
265
- * @property {Array<{uuid: string}>} zarr_conventions The zarr conventions attribute.
266
- */
267
-
268
- /**
269
- * @typedef {Object} Multiscales
270
- * @property {Object} layout The layout.
271
- */
272
-
273
- /**
274
- * @typedef {Object} LegacyDatasetAttributes
275
- * @property {LegacyMultiscales} multiscales The multiscales attribute.
276
- */
277
-
278
- /**
279
- * @typedef {Object} LegacyMultiscales
280
- * @property {any} tile_matrix_limits The tile matrix limits.
281
- * @property {any} tile_matrix_set The tile matrix set.
282
- */
283
-
284
- /**
285
- * @typedef {Object} TileGridInfo
286
- * @property {WMTSTileGrid} tileGrid The tile grid.
287
- * @property {import("../proj/Projection.js").default} projection The projection.
288
- * @property {Object<string, Array<string>>} [bandsByLevel] Available bands by level.
289
- * @property {number} [fillValue] The fill value.
290
- */
291
-
292
- /**
293
- * @param {DatasetAttributes} attributes The dataset attributes.
294
- * @param {any} consolidatedMetadata The consolidated metadata.
295
- * @param {string} wantedGroup The path to the wanted group.
296
- * @param {Array<string>} wantedBands The wanted bands.
297
- * @return {TileGridInfo} The tile grid info.
298
- */
299
- function getTileGridInfoFromAttributes(
300
- attributes,
301
- consolidatedMetadata,
302
- wantedGroup,
303
- wantedBands,
304
- ) {
305
- const multiscales = attributes.multiscales;
306
- const extent = attributes['spatial:bbox'];
307
- const projection = getProjection(attributes['proj:code']);
308
- /** @type {Array<{matrixId: string, resolution: number, origin: import("ol/coordinate").Coordinate}>} */
309
- const groupInfo = [];
310
- const bandsByLevel = consolidatedMetadata ? {} : null;
311
- let fillValue;
312
- for (const groupMetadata of multiscales.layout) {
313
- //TODO Handle the complete transform (rotation and different x/y resolutions)
314
- const transform = groupMetadata['spatial:transform'];
315
- const resolution = transform[0];
316
- const origin = [transform[2], transform[5]];
317
- const matrixId = groupMetadata.asset;
318
- groupInfo.push({
319
- matrixId,
320
- resolution,
321
- origin,
322
- });
323
- if (consolidatedMetadata) {
324
- const availableBands = [];
325
- for (const band of wantedBands) {
326
- const bandArray =
327
- consolidatedMetadata[`${wantedGroup}/${matrixId}/${band}`];
328
- if (bandArray) {
329
- availableBands.push(band);
330
- if (fillValue === undefined) {
331
- fillValue = bandArray['fill_value'];
332
- }
333
- }
334
- }
335
- bandsByLevel[matrixId] = availableBands;
336
- }
337
- }
338
- groupInfo.sort((a, b) => b.resolution - a.resolution);
339
- const tileGrid = new WMTSTileGrid({
340
- extent: extent,
341
- origins: groupInfo.map((g) => g.origin),
342
- resolutions: groupInfo.map((g) => g.resolution),
343
- matrixIds: groupInfo.map((g) => g.matrixId),
344
- });
345
-
346
- return {tileGrid, projection, bandsByLevel, fillValue};
347
- }
348
-
349
- /**
350
- * @param {LegacyDatasetAttributes} attributes The dataset attributes.
351
- * @return {TileGridInfo} The tile grid info.
352
- */
353
- function getTileGridInfoFromLegacyAttributes(attributes) {
354
- const multiscales = attributes.multiscales;
355
- const tileMatrixSet = multiscales.tile_matrix_set;
356
- const tileMatrixLimitsObject = multiscales.tile_matrix_limits;
357
-
358
- const numMatrices = tileMatrixSet.tileMatrices.length;
359
- const tileMatrixLimits = new Array(numMatrices);
360
- let overrideTileSize = false;
361
- for (let i = 0; i < numMatrices; i += 1) {
362
- const tileMatrix = tileMatrixSet.tileMatrices[i];
363
- const tilematrixId = tileMatrix.id;
364
- if (tileMatrix.tileWidth > 512 || tileMatrix.tileHeight > 512) {
365
- // Avoid tile sizes that are too large for rendering
366
- overrideTileSize = true;
367
- }
368
- tileMatrixLimits[i] = tileMatrixLimitsObject[tilematrixId];
369
- }
370
-
371
- const info = parseTileMatrixSet(
372
- {},
373
- tileMatrixSet,
374
- undefined,
375
- tileMatrixLimits,
376
- );
377
-
378
- let tileGrid = info.grid;
379
-
380
- // Tile size sanity
381
- if (overrideTileSize) {
382
- tileGrid = new WMTSTileGrid({
383
- tileSize: 512,
384
- extent: tileGrid.getExtent(),
385
- origins: tileGrid.getOrigins(),
386
- resolutions: tileGrid.getResolutions(),
387
- matrixIds: tileGrid.getMatrixIds(),
388
- });
389
- }
390
- return {tileGrid, projection: info.projection};
391
- }
392
-
393
- /**
394
- * @param {Array<import("zarrita").Chunk<import("zarrita").DataType>>} chunks The input chunks.
395
- * @param {Array<number>} chunkResolutions The resolutions for each band.
396
- * @param {number} tileColCount The number of columns in the output data.
397
- * @param {number} tileRowCount The number of rows in the output data.
398
- * @param {number} tileResolution The tile resolution.
399
- * @param {ResampleMethod} resampleMethod The resampling method.
400
- * @param {number} fillValue The fill value.
401
- * @return {Float32Array} The tile data.
402
- */
403
- function composeData(
404
- chunks,
405
- chunkResolutions,
406
- tileColCount,
407
- tileRowCount,
408
- tileResolution,
409
- resampleMethod,
410
- fillValue,
411
- ) {
412
- const bandCount = chunks.length;
413
- const tileData = new Float32Array(tileColCount * tileRowCount * bandCount);
414
- for (let tileRow = 0; tileRow < tileRowCount; tileRow++) {
415
- for (let tileCol = 0; tileCol < tileColCount; tileCol++) {
416
- for (let band = 0; band < bandCount; ++band) {
417
- const chunk = chunks[band];
418
- const chunkRowCount = chunk.shape[0];
419
- const chunkColCount = chunk.shape[1];
420
- const scaleFactor = tileResolution / chunkResolutions[band];
421
- let value = fillValue;
422
- if (scaleFactor === 1) {
423
- if (tileRow < chunkRowCount && tileCol < chunkColCount) {
424
- value = chunk.data[tileRow * chunkColCount + tileCol];
425
- }
426
- } else {
427
- const chunkRow = tileRow * scaleFactor;
428
- const chunkCol = tileCol * scaleFactor;
429
- switch (resampleMethod) {
430
- case 'nearest': {
431
- const valueRow = Math.round(chunkRow);
432
- const valueCol = Math.round(chunkCol);
433
- if (valueRow < chunkRowCount && valueCol < chunkColCount) {
434
- value = chunk.data[valueRow * chunkColCount + valueCol];
435
- }
436
- break;
437
- }
438
- case 'linear': {
439
- const row0 = Math.floor(chunkRow);
440
- const col0 = Math.floor(chunkCol);
441
- if (row0 < chunkRowCount && col0 < chunkColCount) {
442
- const row1 = Math.min(row0 + 1, chunkRowCount - 1);
443
- const col1 = Math.min(col0 + 1, chunkColCount - 1);
444
-
445
- const v00 = chunk.data[row0 * chunkColCount + col0];
446
- const v01 = chunk.data[row0 * chunkColCount + col1];
447
- const v10 = chunk.data[row1 * chunkColCount + col0];
448
- const v11 = chunk.data[row1 * chunkColCount + col1];
449
-
450
- const dx = chunkCol - col0;
451
- const dy = chunkRow - row0;
452
-
453
- value =
454
- (1 - dy) * ((1 - dx) * v00 + dx * v01) +
455
- dy * ((1 - dx) * v10 + dx * v11);
456
- }
457
- break;
458
- }
459
- default: {
460
- throw new Error(`Unsupported resample method: ${resampleMethod}`);
461
- }
462
- }
463
- }
464
- if (isNaN(value)) {
465
- value = fillValue;
466
- }
467
- tileData[bandCount * (tileRow * tileColCount + tileCol) + band] = value;
468
- }
469
- }
470
- }
471
- return tileData;
472
- }
@@ -1,180 +0,0 @@
1
- export default OGCMap;
2
- export type Options = {
3
- /**
4
- * Attributions.
5
- */
6
- attributions?: import("./Source.js").AttributionLike | undefined;
7
- /**
8
- * The `crossOrigin` attribute for loaded images. Note that
9
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
10
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
11
- */
12
- crossOrigin?: string | null | undefined;
13
- /**
14
- * The `referrerPolicy` property for loaded images.
15
- */
16
- referrerPolicy?: ReferrerPolicy | undefined;
17
- /**
18
- * Use the `ol/Map#pixelRatio` value when requesting
19
- * the image from the remote server.
20
- */
21
- hidpi?: boolean | undefined;
22
- /**
23
- * Optional function to load an image given a URL.
24
- */
25
- imageLoadFunction?: import("../Image.js").LoadFunction | undefined;
26
- /**
27
- * Use interpolated values when resampling. By default,
28
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
29
- */
30
- interpolate?: boolean | undefined;
31
- /**
32
- * OGC Maps request parameters.
33
- * No param is required by default. `width`, `height`, `bbox`, `crs` and `bbox-crs` will be set dynamically.
34
- */
35
- params?: {
36
- [x: string]: any;
37
- } | undefined;
38
- /**
39
- * Projection. Default is the view projection.
40
- */
41
- projection?: import("../proj.js").ProjectionLike;
42
- /**
43
- * Ratio. `1` means image requests are the size of the map viewport, `2` means
44
- * twice the width and height of the map viewport, and so on. Must be `1` or higher.
45
- */
46
- ratio?: number | undefined;
47
- /**
48
- * Resolutions.
49
- * If specified, requests will be made for these resolutions only.
50
- */
51
- resolutions?: number[] | undefined;
52
- /**
53
- * OGC Maps service URL.
54
- */
55
- url?: string | undefined;
56
- };
57
- /**
58
- * @typedef {Object} Options
59
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
60
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
61
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
62
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
63
- * @property {ReferrerPolicy} [referrerPolicy] The `referrerPolicy` property for loaded images.
64
- * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
65
- * the image from the remote server.
66
- * @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
67
- * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
68
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
69
- * @property {Object<string,*>} [params] OGC Maps request parameters.
70
- * No param is required by default. `width`, `height`, `bbox`, `crs` and `bbox-crs` will be set dynamically.
71
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
72
- * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
73
- * twice the width and height of the map viewport, and so on. Must be `1` or higher.
74
- * @property {Array<number>} [resolutions] Resolutions.
75
- * If specified, requests will be made for these resolutions only.
76
- * @property {string} [url] OGC Maps service URL.
77
- */
78
- /**
79
- * @classdesc
80
- * Source for OGC Maps servers providing single, untiled images.
81
- *
82
- * @fires module:ol/source/Image.ImageSourceEvent
83
- * @api
84
- */
85
- declare class OGCMap extends ImageSource {
86
- /**
87
- * @param {Options} [options] OGCMapOptions options.
88
- */
89
- constructor(options?: Options);
90
- /**
91
- * @private
92
- * @type {?string}
93
- */
94
- private crossOrigin_;
95
- /**
96
- * @private
97
- * @type {ReferrerPolicy}
98
- */
99
- private referrerPolicy_;
100
- /**
101
- * @private
102
- * @type {string|undefined}
103
- */
104
- private url_;
105
- /**
106
- * @private
107
- * @type {import("../Image.js").LoadFunction}
108
- */
109
- private imageLoadFunction_;
110
- /**
111
- * @private
112
- * @type {!Object}
113
- */
114
- private params_;
115
- /**
116
- * @private
117
- * @type {boolean}
118
- */
119
- private hidpi_;
120
- /**
121
- * @private
122
- * @type {number}
123
- */
124
- private renderedRevision_;
125
- /**
126
- * @private
127
- * @type {number}
128
- */
129
- private ratio_;
130
- /**
131
- * @private
132
- * @type {import("../proj/Projection.js").default}
133
- */
134
- private loaderProjection_;
135
- /**
136
- * Get the user-provided params, i.e. those passed to the constructor through
137
- * the "params" option, and possibly updated using the updateParams method.
138
- * @return {Object} Params.
139
- * @api
140
- */
141
- getParams(): any;
142
- /**
143
- * Return the image load function of the source.
144
- * @return {import("../Image.js").LoadFunction} The image load function.
145
- * @api
146
- */
147
- getImageLoadFunction(): import("../Image.js").LoadFunction;
148
- /**
149
- * Return the URL used for this OGC Maps source.
150
- * @return {string|undefined} URL.
151
- * @api
152
- */
153
- getUrl(): string | undefined;
154
- /**
155
- * Set the image load function of the source.
156
- * @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
157
- * @api
158
- */
159
- setImageLoadFunction(imageLoadFunction: import("../Image.js").LoadFunction): void;
160
- /**
161
- * Set the URL to use for requests.
162
- * @param {string|undefined} url URL.
163
- * @api
164
- */
165
- setUrl(url: string | undefined): void;
166
- /**
167
- * Set the user-provided params.
168
- * @param {Object} params Params.
169
- * @api
170
- */
171
- setParams(params: any): void;
172
- /**
173
- * Update the user-provided params.
174
- * @param {Object} params Params.
175
- * @api
176
- */
177
- updateParams(params: any): void;
178
- }
179
- import ImageSource from './Image.js';
180
- //# sourceMappingURL=OGCMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OGCMap.d.ts","sourceRoot":"","sources":["OGCMap.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsBc,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;AAdjD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAqEjB;IAzDC;;;OAGG;IACH,qBACgE;IAEhE;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,aAAuB;IAEvB;;;OAGG;IACH,2BAG8B;IAE9B;;;OAGG;IACH,gBAAgD;IAEhD;;;OAGG;IACH,eAAgE;IAEhE;;;OAGG;IACH,0BAA0B;IAE1B;;;OAGG;IACH,eAA+D;IAE/D;;;OAGG;IACH,0BAA6B;IAG/B;;;;;OAKG;IACH,iBAEC;IAoCD;;;;OAIG;IACH,wBAHY,OAAO,aAAa,EAAE,YAAY,CAK7C;IAED;;;;OAIG;IACH,UAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,wCAHW,OAAO,aAAa,EAAE,YAAY,QAM5C;IAED;;;;OAIG;IACH,YAHW,MAAM,GAAC,SAAS,QAS1B;IAED;;;;OAIG;IACH,6BAKC;IAED;;;;OAIG;IACH,gCAGC;CASF;wBA3NmD,YAAY"}