ol 9.2.5-dev.1718652616882 → 9.2.5-dev.1718925536936

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 (143) hide show
  1. package/DataTile.d.ts +14 -0
  2. package/DataTile.d.ts.map +1 -1
  3. package/DataTile.js +24 -1
  4. package/Map.d.ts +1 -1
  5. package/Map.d.ts.map +1 -1
  6. package/Map.js +9 -10
  7. package/Tile.d.ts +2 -22
  8. package/Tile.d.ts.map +1 -1
  9. package/Tile.js +2 -77
  10. package/TileQueue.d.ts.map +1 -1
  11. package/TileQueue.js +6 -4
  12. package/VectorRenderTile.d.ts +8 -13
  13. package/VectorRenderTile.d.ts.map +1 -1
  14. package/VectorRenderTile.js +17 -24
  15. package/VectorTile.d.ts +5 -5
  16. package/VectorTile.d.ts.map +1 -1
  17. package/VectorTile.js +3 -3
  18. package/dist/ol.d.ts +10 -2
  19. package/dist/ol.d.ts.map +1 -1
  20. package/dist/ol.js +2 -2
  21. package/dist/ol.js.map +1 -1
  22. package/featureloader.d.ts +4 -4
  23. package/featureloader.d.ts.map +1 -1
  24. package/featureloader.js +2 -2
  25. package/format/EsriJSON.d.ts +1 -1
  26. package/format/Feature.d.ts +8 -8
  27. package/format/Feature.d.ts.map +1 -1
  28. package/format/Feature.js +7 -5
  29. package/format/GeoJSON.d.ts +9 -9
  30. package/format/GeoJSON.d.ts.map +1 -1
  31. package/format/GeoJSON.js +10 -14
  32. package/format/JSONFeature.d.ts +7 -7
  33. package/format/JSONFeature.d.ts.map +1 -1
  34. package/format/JSONFeature.js +9 -11
  35. package/format/MVT.d.ts +12 -12
  36. package/format/MVT.d.ts.map +1 -1
  37. package/format/MVT.js +12 -14
  38. package/format/TextFeature.d.ts +1 -1
  39. package/format/TopoJSON.d.ts +1 -1
  40. package/format/WKB.d.ts +1 -1
  41. package/format/XMLFeature.d.ts +1 -1
  42. package/interaction/DragAndDrop.d.ts +1 -1
  43. package/layer/BaseTile.d.ts +23 -6
  44. package/layer/BaseTile.d.ts.map +1 -1
  45. package/layer/BaseTile.js +22 -3
  46. package/layer/Tile.d.ts +1 -1
  47. package/layer/Tile.d.ts.map +1 -1
  48. package/layer/Tile.js +3 -1
  49. package/layer/VectorTile.d.ts +19 -6
  50. package/layer/VectorTile.d.ts.map +1 -1
  51. package/layer/VectorTile.js +20 -8
  52. package/layer/WebGLTile.d.ts +5 -10
  53. package/layer/WebGLTile.d.ts.map +1 -1
  54. package/layer/WebGLTile.js +3 -12
  55. package/package.json +1 -1
  56. package/renderer/Layer.d.ts +22 -25
  57. package/renderer/Layer.d.ts.map +1 -1
  58. package/renderer/Layer.js +36 -36
  59. package/renderer/canvas/TileLayer.d.ts +100 -38
  60. package/renderer/canvas/TileLayer.d.ts.map +1 -1
  61. package/renderer/canvas/TileLayer.js +542 -329
  62. package/renderer/canvas/VectorTileLayer.d.ts +11 -11
  63. package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
  64. package/renderer/canvas/VectorTileLayer.js +33 -46
  65. package/renderer/webgl/TileLayerBase.d.ts +0 -6
  66. package/renderer/webgl/TileLayerBase.d.ts.map +1 -1
  67. package/renderer/webgl/TileLayerBase.js +61 -78
  68. package/reproj/DataTile.d.ts.map +1 -1
  69. package/reproj/DataTile.js +103 -100
  70. package/source/BingMaps.d.ts +2 -2
  71. package/source/BingMaps.d.ts.map +1 -1
  72. package/source/BingMaps.js +1 -2
  73. package/source/CartoDB.d.ts +2 -2
  74. package/source/CartoDB.js +1 -1
  75. package/source/DataTile.d.ts +49 -20
  76. package/source/DataTile.d.ts.map +1 -1
  77. package/source/DataTile.js +56 -9
  78. package/source/GeoTIFF.d.ts +2 -6
  79. package/source/GeoTIFF.d.ts.map +1 -1
  80. package/source/GeoTIFF.js +3 -3
  81. package/source/Google.d.ts.map +1 -1
  82. package/source/Google.js +0 -2
  83. package/source/IIIF.d.ts +1 -1
  84. package/source/IIIF.js +1 -1
  85. package/source/ImageTile.d.ts +102 -0
  86. package/source/ImageTile.d.ts.map +1 -0
  87. package/source/ImageTile.js +208 -0
  88. package/source/OGCMapTile.d.ts +2 -2
  89. package/source/OGCMapTile.js +1 -1
  90. package/source/OGCVectorTile.d.ts +4 -4
  91. package/source/OGCVectorTile.js +2 -2
  92. package/source/OSM.d.ts +2 -7
  93. package/source/OSM.d.ts.map +1 -1
  94. package/source/OSM.js +1 -3
  95. package/source/StadiaMaps.d.ts +2 -2
  96. package/source/StadiaMaps.d.ts.map +1 -1
  97. package/source/StadiaMaps.js +2 -18
  98. package/source/Tile.d.ts +7 -36
  99. package/source/Tile.d.ts.map +1 -1
  100. package/source/Tile.js +5 -69
  101. package/source/TileArcGISRest.d.ts +2 -2
  102. package/source/TileArcGISRest.js +1 -1
  103. package/source/TileDebug.d.ts.map +1 -1
  104. package/source/TileDebug.js +0 -1
  105. package/source/TileImage.d.ts +7 -11
  106. package/source/TileImage.d.ts.map +1 -1
  107. package/source/TileImage.js +11 -43
  108. package/source/TileJSON.d.ts +2 -2
  109. package/source/TileJSON.js +1 -1
  110. package/source/TileWMS.d.ts +2 -2
  111. package/source/TileWMS.d.ts.map +1 -1
  112. package/source/TileWMS.js +1 -4
  113. package/source/UTFGrid.d.ts +1 -1
  114. package/source/UrlTile.d.ts +14 -12
  115. package/source/UrlTile.d.ts.map +1 -1
  116. package/source/UrlTile.js +12 -7
  117. package/source/Vector.d.ts +5 -5
  118. package/source/Vector.d.ts.map +1 -1
  119. package/source/Vector.js +3 -3
  120. package/source/VectorTile.d.ts +4 -17
  121. package/source/VectorTile.d.ts.map +1 -1
  122. package/source/VectorTile.js +10 -85
  123. package/source/WMTS.d.ts +2 -2
  124. package/source/WMTS.js +3 -3
  125. package/source/XYZ.d.ts +14 -17
  126. package/source/XYZ.d.ts.map +1 -1
  127. package/source/XYZ.js +7 -8
  128. package/source/Zoomify.d.ts +2 -2
  129. package/source/Zoomify.d.ts.map +1 -1
  130. package/source/Zoomify.js +3 -2
  131. package/source.d.ts +1 -0
  132. package/source.d.ts.map +1 -1
  133. package/source.js +1 -0
  134. package/tilecoord.d.ts +7 -0
  135. package/tilecoord.d.ts.map +1 -1
  136. package/tilecoord.js +11 -1
  137. package/tileurlfunction.d.ts +3 -7
  138. package/tileurlfunction.d.ts.map +1 -1
  139. package/tileurlfunction.js +14 -47
  140. package/uri.d.ts +23 -3
  141. package/uri.d.ts.map +1 -1
  142. package/uri.js +75 -0
  143. package/util.js +1 -1
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @param {string} template Template.
3
- * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
3
+ * @param {import("./tilegrid/TileGrid.js").default|null} tileGrid Tile grid.
4
4
  * @return {import("./Tile.js").UrlFunction} Tile URL function.
5
5
  */
6
- export function createFromTemplate(template: string, tileGrid: import("./tilegrid/TileGrid.js").default): import("./Tile.js").UrlFunction;
6
+ export function createFromTemplate(template: string, tileGrid: import("./tilegrid/TileGrid.js").default | null): import("./Tile.js").UrlFunction;
7
7
  /**
8
8
  * @param {Array<string>} templates Templates.
9
9
  * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
@@ -22,9 +22,5 @@ export function createFromTileUrlFunctions(tileUrlFunctions: Array<import("./Til
22
22
  * @return {string|undefined} Tile URL.
23
23
  */
24
24
  export function nullTileUrlFunction(tileCoord: import("./tilecoord.js").TileCoord, pixelRatio: number, projection: import("./proj/Projection.js").default): string | undefined;
25
- /**
26
- * @param {string} url URL.
27
- * @return {Array<string>} Array of urls.
28
- */
29
- export function expandUrl(url: string): Array<string>;
25
+ export { expandUrl } from "./uri.js";
30
26
  //# sourceMappingURL=tileurlfunction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tileurlfunction.d.ts","sourceRoot":"","sources":["tileurlfunction.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,6CAJW,MAAM,YACN,OAAO,wBAAwB,EAAE,OAAO,GACvC,OAAO,WAAW,EAAE,WAAW,CAmC1C;AAED;;;;GAIG;AACH,+CAJW,MAAM,MAAM,CAAC,YACb,OAAO,wBAAwB,EAAE,OAAO,GACvC,OAAO,WAAW,EAAE,WAAW,CAS1C;AAED;;;GAGG;AACH,6DAHW,MAAM,OAAO,WAAW,EAAE,WAAW,CAAC,GACrC,OAAO,WAAW,EAAE,WAAW,CAsB1C;AAED;;;;;GAKG;AACH,+CALW,OAAO,gBAAgB,EAAE,SAAS,cAClC,MAAM,cACN,OAAO,sBAAsB,EAAE,OAAO,GACrC,MAAM,GAAC,SAAS,CAI3B;AAED;;;GAGG;AACH,+BAHW,MAAM,GACL,MAAM,MAAM,CAAC,CA0BxB"}
1
+ {"version":3,"file":"tileurlfunction.d.ts","sourceRoot":"","sources":["tileurlfunction.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,6CAJW,MAAM,YACN,OAAO,wBAAwB,EAAE,OAAO,GAAC,IAAI,GAC5C,OAAO,WAAW,EAAE,WAAW,CA0B1C;AAED;;;;GAIG;AACH,+CAJW,MAAM,MAAM,CAAC,YACb,OAAO,wBAAwB,EAAE,OAAO,GACvC,OAAO,WAAW,EAAE,WAAW,CAS1C;AAED;;;GAGG;AACH,6DAHW,MAAM,OAAO,WAAW,EAAE,WAAW,CAAC,GACrC,OAAO,WAAW,EAAE,WAAW,CAsB1C;AAED;;;;;GAKG;AACH,+CALW,OAAO,gBAAgB,EAAE,SAAS,cAClC,MAAM,cACN,OAAO,sBAAsB,EAAE,OAAO,GACrC,MAAM,GAAC,SAAS,CAI3B"}
@@ -2,18 +2,15 @@
2
2
  * @module ol/tileurlfunction
3
3
  */
4
4
  import {modulo} from './math.js';
5
+ import {renderXYZTemplate} from './uri.js';
5
6
  import {hash as tileCoordHash} from './tilecoord.js';
6
7
 
7
8
  /**
8
9
  * @param {string} template Template.
9
- * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
10
+ * @param {import("./tilegrid/TileGrid.js").default|null} tileGrid Tile grid.
10
11
  * @return {import("./Tile.js").UrlFunction} Tile URL function.
11
12
  */
12
13
  export function createFromTemplate(template, tileGrid) {
13
- const zRegEx = /\{z\}/g;
14
- const xRegEx = /\{x\}/g;
15
- const yRegEx = /\{y\}/g;
16
- const dashYRegEx = /\{-y\}/g;
17
14
  return (
18
15
  /**
19
16
  * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
@@ -25,21 +22,16 @@ export function createFromTemplate(template, tileGrid) {
25
22
  if (!tileCoord) {
26
23
  return undefined;
27
24
  }
28
- return template
29
- .replace(zRegEx, tileCoord[0].toString())
30
- .replace(xRegEx, tileCoord[1].toString())
31
- .replace(yRegEx, tileCoord[2].toString())
32
- .replace(dashYRegEx, function () {
33
- const z = tileCoord[0];
34
- const range = tileGrid.getFullTileRange(z);
35
- if (!range) {
36
- throw new Error(
37
- 'The {-y} placeholder requires a tile grid with extent',
38
- );
39
- }
40
- const y = range.getHeight() - tileCoord[2] - 1;
41
- return y.toString();
42
- });
25
+ let maxY;
26
+ const z = tileCoord[0];
27
+ if (tileGrid) {
28
+ // The `{-y}` placeholder only works for sources that have a tile grid at construction
29
+ const range = tileGrid.getFullTileRange(z);
30
+ if (range) {
31
+ maxY = range.getHeight() - 1;
32
+ }
33
+ }
34
+ return renderXYZTemplate(template, z, tileCoord[1], tileCoord[2], maxY);
43
35
  }
44
36
  );
45
37
  }
@@ -95,31 +87,6 @@ export function nullTileUrlFunction(tileCoord, pixelRatio, projection) {
95
87
  }
96
88
 
97
89
  /**
98
- * @param {string} url URL.
99
- * @return {Array<string>} Array of urls.
90
+ * TODO: Update ol-mapbox-style to import this from the uri.js module.
100
91
  */
101
- export function expandUrl(url) {
102
- const urls = [];
103
- let match = /\{([a-z])-([a-z])\}/.exec(url);
104
- if (match) {
105
- // char range
106
- const startCharCode = match[1].charCodeAt(0);
107
- const stopCharCode = match[2].charCodeAt(0);
108
- let charCode;
109
- for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {
110
- urls.push(url.replace(match[0], String.fromCharCode(charCode)));
111
- }
112
- return urls;
113
- }
114
- match = /\{(\d+)-(\d+)\}/.exec(url);
115
- if (match) {
116
- // number range
117
- const stop = parseInt(match[2], 10);
118
- for (let i = parseInt(match[1], 10); i <= stop; i++) {
119
- urls.push(url.replace(match[0], i.toString()));
120
- }
121
- return urls;
122
- }
123
- urls.push(url);
124
- return urls;
125
- }
92
+ export {expandUrl} from './uri.js';
package/uri.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * @module ol/uri
3
- */
4
1
  /**
5
2
  * Appends query parameters to a URI.
6
3
  *
@@ -10,4 +7,27 @@
10
7
  * @return {string} The new URI.
11
8
  */
12
9
  export function appendParams(uri: string, params: any): string;
10
+ /**
11
+ * @param {string} template The URL template. Should have `{x}`, `{y}`, and `{z}` placeholders. If
12
+ * the template has a `{-y}` placeholder, the `maxY` parameter must be supplied.
13
+ * @param {number} z The tile z coordinate.
14
+ * @param {number} x The tile x coordinate.
15
+ * @param {number} y The tile y coordinate.
16
+ * @param {number} [maxY] The maximum y coordinate at the given z level.
17
+ * @return {string} The URL.
18
+ */
19
+ export function renderXYZTemplate(template: string, z: number, x: number, y: number, maxY?: number | undefined): string;
20
+ /**
21
+ * @param {Array<string>} urls List of URLs.
22
+ * @param {number} z The tile z coordinate.
23
+ * @param {number} x The tile x coordinate.
24
+ * @param {number} y The tile y coordinate.
25
+ * @return {string} The chosen URL.
26
+ */
27
+ export function pickUrl(urls: Array<string>, z: number, x: number, y: number): string;
28
+ /**
29
+ * @param {string} url URL.
30
+ * @return {Array<string>} Array of urls.
31
+ */
32
+ export function expandUrl(url: string): Array<string>;
13
33
  //# sourceMappingURL=uri.d.ts.map
package/uri.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["uri.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AACH,kCALW,MAAM,gBAGL,MAAM,CAiBjB"}
1
+ {"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["uri.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,kCALW,MAAM,gBAGL,MAAM,CAiBjB;AAOD;;;;;;;;GAQG;AACH,4CARW,MAAM,KAEN,MAAM,KACN,MAAM,KACN,MAAM,8BAEL,MAAM,CAejB;AAED;;;;;;GAMG;AACH,8BANW,MAAM,MAAM,CAAC,KACb,MAAM,KACN,MAAM,KACN,MAAM,GACL,MAAM,CAMjB;AAED;;;GAGG;AACH,+BAHW,MAAM,GACL,MAAM,MAAM,CAAC,CA0BxB"}
package/uri.js CHANGED
@@ -2,6 +2,9 @@
2
2
  * @module ol/uri
3
3
  */
4
4
 
5
+ import {hashZXY} from './tilecoord.js';
6
+ import {modulo} from './math.js';
7
+
5
8
  /**
6
9
  * Appends query parameters to a URI.
7
10
  *
@@ -26,3 +29,75 @@ export function appendParams(uri, params) {
26
29
  uri += uri.includes('?') ? '&' : '?';
27
30
  return uri + qs;
28
31
  }
32
+
33
+ const zRegEx = /\{z\}/g;
34
+ const xRegEx = /\{x\}/g;
35
+ const yRegEx = /\{y\}/g;
36
+ const dashYRegEx = /\{-y\}/g;
37
+
38
+ /**
39
+ * @param {string} template The URL template. Should have `{x}`, `{y}`, and `{z}` placeholders. If
40
+ * the template has a `{-y}` placeholder, the `maxY` parameter must be supplied.
41
+ * @param {number} z The tile z coordinate.
42
+ * @param {number} x The tile x coordinate.
43
+ * @param {number} y The tile y coordinate.
44
+ * @param {number} [maxY] The maximum y coordinate at the given z level.
45
+ * @return {string} The URL.
46
+ */
47
+ export function renderXYZTemplate(template, z, x, y, maxY) {
48
+ return template
49
+ .replace(zRegEx, z.toString())
50
+ .replace(xRegEx, x.toString())
51
+ .replace(yRegEx, y.toString())
52
+ .replace(dashYRegEx, function () {
53
+ if (maxY === undefined) {
54
+ throw new Error(
55
+ 'If the URL template has a {-y} placeholder, the grid extent must be known',
56
+ );
57
+ }
58
+ return (maxY - y).toString();
59
+ });
60
+ }
61
+
62
+ /**
63
+ * @param {Array<string>} urls List of URLs.
64
+ * @param {number} z The tile z coordinate.
65
+ * @param {number} x The tile x coordinate.
66
+ * @param {number} y The tile y coordinate.
67
+ * @return {string} The chosen URL.
68
+ */
69
+ export function pickUrl(urls, z, x, y) {
70
+ const hash = hashZXY(z, x, y);
71
+ const index = modulo(hash, urls.length);
72
+ return urls[index];
73
+ }
74
+
75
+ /**
76
+ * @param {string} url URL.
77
+ * @return {Array<string>} Array of urls.
78
+ */
79
+ export function expandUrl(url) {
80
+ const urls = [];
81
+ let match = /\{([a-z])-([a-z])\}/.exec(url);
82
+ if (match) {
83
+ // char range
84
+ const startCharCode = match[1].charCodeAt(0);
85
+ const stopCharCode = match[2].charCodeAt(0);
86
+ let charCode;
87
+ for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {
88
+ urls.push(url.replace(match[0], String.fromCharCode(charCode)));
89
+ }
90
+ return urls;
91
+ }
92
+ match = /\{(\d+)-(\d+)\}/.exec(url);
93
+ if (match) {
94
+ // number range
95
+ const stop = parseInt(match[2], 10);
96
+ for (let i = parseInt(match[1], 10); i <= stop; i++) {
97
+ urls.push(url.replace(match[0], i.toString()));
98
+ }
99
+ return urls;
100
+ }
101
+ urls.push(url);
102
+ return urls;
103
+ }
package/util.js CHANGED
@@ -33,4 +33,4 @@ export function getUid(obj) {
33
33
  * OpenLayers version.
34
34
  * @type {string}
35
35
  */
36
- export const VERSION = '9.2.5-dev.1718652616882';
36
+ export const VERSION = '9.2.5-dev.1718925536936';