ol 7.5.0 → 7.5.1-dev.1691774516632
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.
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/source/{Stamen.d.ts → StadiaMaps.d.ts} +17 -7
- package/source/StadiaMaps.d.ts.map +1 -0
- package/source/{Stamen.js → StadiaMaps.js} +85 -38
- package/source.d.ts +1 -1
- package/source.js +1 -1
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
- package/source/Stamen.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export default StadiaMaps;
|
|
2
2
|
export type Options = {
|
|
3
3
|
/**
|
|
4
4
|
* Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
|
|
@@ -10,7 +10,7 @@ export type Options = {
|
|
|
10
10
|
*/
|
|
11
11
|
interpolate?: boolean | undefined;
|
|
12
12
|
/**
|
|
13
|
-
* Layer name.
|
|
13
|
+
* Layer name. Valid values: `alidade_smooth`, `alidade_smooth_dark`, `stadia_outdoors`, `stamen_terrain`, `stamen_terrain_background`, `stamen_terrain_labels`, `stamen_terrain_lines`, `stamen_toner_background`, `stamen_toner`, `stamen_toner_labels`, `stamen_toner_lines`, `stamen_toner_lite`, `stamen_watercolor`, and `osm_bright`.
|
|
14
14
|
*/
|
|
15
15
|
layer: string;
|
|
16
16
|
/**
|
|
@@ -53,13 +53,21 @@ export type Options = {
|
|
|
53
53
|
* zoom levels. See {@link module :ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
54
54
|
*/
|
|
55
55
|
zDirection?: number | import("../array.js").NearestDirectionFunction | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Stadia Maps API key. Not required for localhost or most public web deployments. See https://docs.stadiamaps.com/authentication/ for details.
|
|
58
|
+
*/
|
|
59
|
+
apiKey: string;
|
|
60
|
+
/**
|
|
61
|
+
* Use retina tiles (if available; not available for Stamen Watercolor).
|
|
62
|
+
*/
|
|
63
|
+
retina: boolean;
|
|
56
64
|
};
|
|
57
65
|
/**
|
|
58
66
|
* @typedef {Object} Options
|
|
59
67
|
* @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
|
|
60
68
|
* @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
|
|
61
69
|
* linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
|
|
62
|
-
* @property {string} layer Layer name.
|
|
70
|
+
* @property {string} layer Layer name. Valid values: `alidade_smooth`, `alidade_smooth_dark`, `stadia_outdoors`, `stamen_terrain`, `stamen_terrain_background`, `stamen_terrain_labels`, `stamen_terrain_lines`, `stamen_toner_background`, `stamen_toner`, `stamen_toner_labels`, `stamen_toner_lines`, `stamen_toner_lite`, `stamen_watercolor`, and `osm_bright`.
|
|
63
71
|
* @property {number} [minZoom] Minimum zoom.
|
|
64
72
|
* @property {number} [maxZoom] Maximum zoom.
|
|
65
73
|
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
|
@@ -78,17 +86,19 @@ export type Options = {
|
|
|
78
86
|
* @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
|
|
79
87
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
80
88
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
89
|
+
* @property {string} apiKey Stadia Maps API key. Not required for localhost or most public web deployments. See https://docs.stadiamaps.com/authentication/ for details.
|
|
90
|
+
* @property {boolean} retina Use retina tiles (if available; not available for Stamen Watercolor).
|
|
81
91
|
*/
|
|
82
92
|
/**
|
|
83
93
|
* @classdesc
|
|
84
|
-
* Layer source for the
|
|
94
|
+
* Layer source for the Stadia Maps tile server.
|
|
85
95
|
* @api
|
|
86
96
|
*/
|
|
87
|
-
declare class
|
|
97
|
+
declare class StadiaMaps extends XYZ {
|
|
88
98
|
/**
|
|
89
|
-
* @param {Options} options
|
|
99
|
+
* @param {Options} options StadiaMaps options.
|
|
90
100
|
*/
|
|
91
101
|
constructor(options: Options);
|
|
92
102
|
}
|
|
93
103
|
import XYZ from './XYZ.js';
|
|
94
|
-
//# sourceMappingURL=
|
|
104
|
+
//# sourceMappingURL=StadiaMaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StadiaMaps.d.ts","sourceRoot":"","sources":["StadiaMaps.js"],"names":[],"mappings":";;;;;;;;;;;;;;WAoHc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmBN,MAAM;;;;YACN,OAAO;;AAzBrB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAsDjB;CACF;gBArMe,UAAU"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module ol/source/
|
|
2
|
+
* @module ol/source/StadiaMaps
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import XYZ from './XYZ.js';
|
|
@@ -7,80 +7,105 @@ import {ATTRIBUTION as OSM_ATTRIBUTION} from './OSM.js';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @const
|
|
10
|
-
* @type
|
|
10
|
+
* @type string
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
13
|
-
'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const STADIA_ATTRIBUTION =
|
|
13
|
+
'© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @const
|
|
17
|
+
* @type string
|
|
18
|
+
*/
|
|
19
|
+
const OMT_ATTRIBUTION =
|
|
20
|
+
'© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @const
|
|
24
|
+
* @type string
|
|
25
|
+
*/
|
|
26
|
+
const STAMEN_ATTRIBUTION =
|
|
27
|
+
'© <a href="https://stamen.com/" target="_blank">Stamen Design</a>';
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
30
|
* @type {Object<string, {extension: string, opaque: boolean}>}
|
|
21
31
|
*/
|
|
22
32
|
const LayerConfig = {
|
|
23
|
-
'
|
|
33
|
+
'stamen_terrain': {
|
|
24
34
|
extension: 'png',
|
|
25
35
|
opaque: true,
|
|
26
36
|
},
|
|
27
|
-
'
|
|
37
|
+
'stamen_terrain_background': {
|
|
28
38
|
extension: 'png',
|
|
29
39
|
opaque: true,
|
|
30
40
|
},
|
|
31
|
-
'
|
|
41
|
+
'stamen_terrain_labels': {
|
|
32
42
|
extension: 'png',
|
|
33
43
|
opaque: false,
|
|
34
44
|
},
|
|
35
|
-
'
|
|
45
|
+
'stamen_terrain_lines': {
|
|
36
46
|
extension: 'png',
|
|
37
47
|
opaque: false,
|
|
38
48
|
},
|
|
39
|
-
'
|
|
49
|
+
'stamen_toner_background': {
|
|
40
50
|
extension: 'png',
|
|
41
51
|
opaque: true,
|
|
42
52
|
},
|
|
43
|
-
'
|
|
53
|
+
'stamen_toner': {
|
|
44
54
|
extension: 'png',
|
|
45
55
|
opaque: true,
|
|
46
56
|
},
|
|
47
|
-
'
|
|
57
|
+
'stamen_toner_labels': {
|
|
48
58
|
extension: 'png',
|
|
49
59
|
opaque: false,
|
|
50
60
|
},
|
|
51
|
-
'
|
|
61
|
+
'stamen_toner_lines': {
|
|
52
62
|
extension: 'png',
|
|
53
63
|
opaque: false,
|
|
54
64
|
},
|
|
55
|
-
'
|
|
65
|
+
'stamen_toner_lite': {
|
|
56
66
|
extension: 'png',
|
|
57
|
-
opaque:
|
|
67
|
+
opaque: true,
|
|
68
|
+
},
|
|
69
|
+
'stamen_watercolor': {
|
|
70
|
+
extension: 'jpg',
|
|
71
|
+
opaque: true,
|
|
58
72
|
},
|
|
59
|
-
'
|
|
73
|
+
'alidade_smooth': {
|
|
60
74
|
extension: 'png',
|
|
61
75
|
opaque: true,
|
|
62
76
|
},
|
|
63
|
-
'
|
|
64
|
-
extension: '
|
|
77
|
+
'alidade_smooth_dark': {
|
|
78
|
+
extension: 'png',
|
|
79
|
+
opaque: true,
|
|
80
|
+
},
|
|
81
|
+
'stadia_outdoors': {
|
|
82
|
+
extension: 'png',
|
|
83
|
+
opaque: true,
|
|
84
|
+
},
|
|
85
|
+
'osm_bright': {
|
|
86
|
+
extension: 'png',
|
|
65
87
|
opaque: true,
|
|
66
88
|
},
|
|
67
89
|
};
|
|
68
90
|
|
|
69
91
|
/**
|
|
70
|
-
* @type {Object<string, {minZoom: number, maxZoom: number}>}
|
|
92
|
+
* @type {Object<string, {minZoom: number, maxZoom: number, retina: boolean}>}
|
|
71
93
|
*/
|
|
72
94
|
const ProviderConfig = {
|
|
73
|
-
'
|
|
95
|
+
'stamen_terrain': {
|
|
74
96
|
minZoom: 0,
|
|
75
97
|
maxZoom: 18,
|
|
98
|
+
retina: true,
|
|
76
99
|
},
|
|
77
|
-
'
|
|
100
|
+
'stamen_toner': {
|
|
78
101
|
minZoom: 0,
|
|
79
102
|
maxZoom: 20,
|
|
103
|
+
retina: true,
|
|
80
104
|
},
|
|
81
|
-
'
|
|
82
|
-
minZoom:
|
|
105
|
+
'stamen_watercolor': {
|
|
106
|
+
minZoom: 1,
|
|
83
107
|
maxZoom: 18,
|
|
108
|
+
retina: false,
|
|
84
109
|
},
|
|
85
110
|
};
|
|
86
111
|
|
|
@@ -89,7 +114,7 @@ const ProviderConfig = {
|
|
|
89
114
|
* @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
|
|
90
115
|
* @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
|
|
91
116
|
* linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
|
|
92
|
-
* @property {string} layer Layer name.
|
|
117
|
+
* @property {string} layer Layer name. Valid values: `alidade_smooth`, `alidade_smooth_dark`, `stadia_outdoors`, `stamen_terrain`, `stamen_terrain_background`, `stamen_terrain_labels`, `stamen_terrain_lines`, `stamen_toner_background`, `stamen_toner`, `stamen_toner_labels`, `stamen_toner_lines`, `stamen_toner_lite`, `stamen_watercolor`, and `osm_bright`.
|
|
93
118
|
* @property {number} [minZoom] Minimum zoom.
|
|
94
119
|
* @property {number} [maxZoom] Maximum zoom.
|
|
95
120
|
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
|
@@ -108,50 +133,72 @@ const ProviderConfig = {
|
|
|
108
133
|
* @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
|
|
109
134
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
110
135
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
136
|
+
* @property {string} apiKey Stadia Maps API key. Not required for localhost or most public web deployments. See https://docs.stadiamaps.com/authentication/ for details.
|
|
137
|
+
* @property {boolean} retina Use retina tiles (if available; not available for Stamen Watercolor).
|
|
111
138
|
*/
|
|
112
139
|
|
|
113
140
|
/**
|
|
114
141
|
* @classdesc
|
|
115
|
-
* Layer source for the
|
|
142
|
+
* Layer source for the Stadia Maps tile server.
|
|
116
143
|
* @api
|
|
117
144
|
*/
|
|
118
|
-
class
|
|
145
|
+
class StadiaMaps extends XYZ {
|
|
119
146
|
/**
|
|
120
|
-
* @param {Options} options
|
|
147
|
+
* @param {Options} options StadiaMaps options.
|
|
121
148
|
*/
|
|
122
149
|
constructor(options) {
|
|
123
150
|
const i = options.layer.indexOf('-');
|
|
124
151
|
const provider = i == -1 ? options.layer : options.layer.slice(0, i);
|
|
125
|
-
const providerConfig = ProviderConfig[provider]
|
|
152
|
+
const providerConfig = ProviderConfig[provider] || {
|
|
153
|
+
'minZoom': 0,
|
|
154
|
+
'maxZoom': 20,
|
|
155
|
+
'retina': true,
|
|
156
|
+
};
|
|
126
157
|
|
|
127
158
|
const layerConfig = LayerConfig[options.layer];
|
|
159
|
+
const query = options.apiKey ? '?api_key=' + options.apiKey : '';
|
|
160
|
+
const retina = providerConfig.retina && options.retina ? '@2x' : '';
|
|
128
161
|
|
|
129
162
|
const url =
|
|
130
163
|
options.url !== undefined
|
|
131
164
|
? options.url
|
|
132
|
-
: 'https://
|
|
165
|
+
: 'https://tiles.stadiamaps.com/tiles/' +
|
|
133
166
|
options.layer +
|
|
134
|
-
'/{z}/{x}/{y}
|
|
135
|
-
|
|
167
|
+
'/{z}/{x}/{y}' +
|
|
168
|
+
retina +
|
|
169
|
+
'.' +
|
|
170
|
+
layerConfig.extension +
|
|
171
|
+
query;
|
|
172
|
+
|
|
173
|
+
const attributions = [STADIA_ATTRIBUTION, OMT_ATTRIBUTION, OSM_ATTRIBUTION];
|
|
174
|
+
|
|
175
|
+
if (options.layer.startsWith('stamen_')) {
|
|
176
|
+
attributions.splice(1, 0, STAMEN_ATTRIBUTION);
|
|
177
|
+
}
|
|
136
178
|
|
|
137
179
|
super({
|
|
138
|
-
attributions:
|
|
180
|
+
attributions: attributions,
|
|
139
181
|
cacheSize: options.cacheSize,
|
|
140
182
|
crossOrigin: 'anonymous',
|
|
141
183
|
interpolate: options.interpolate,
|
|
142
184
|
maxZoom:
|
|
143
|
-
options.maxZoom
|
|
185
|
+
options.maxZoom !== undefined
|
|
186
|
+
? options.maxZoom
|
|
187
|
+
: providerConfig.maxZoom,
|
|
144
188
|
minZoom:
|
|
145
|
-
options.minZoom
|
|
189
|
+
options.minZoom !== undefined
|
|
190
|
+
? options.minZoom
|
|
191
|
+
: providerConfig.minZoom,
|
|
146
192
|
opaque: layerConfig.opaque,
|
|
147
193
|
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
|
148
194
|
tileLoadFunction: options.tileLoadFunction,
|
|
149
195
|
transition: options.transition,
|
|
150
196
|
url: url,
|
|
197
|
+
tilePixelRatio: retina ? 2 : 1,
|
|
151
198
|
wrapX: options.wrapX,
|
|
152
199
|
zDirection: options.zDirection,
|
|
153
200
|
});
|
|
154
201
|
}
|
|
155
202
|
}
|
|
156
203
|
|
|
157
|
-
export default
|
|
204
|
+
export default StadiaMaps;
|
package/source.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { default as OGCVectorTile } from "./source/OGCVectorTile.js";
|
|
|
28
28
|
export { default as OSM } from "./source/OSM.js";
|
|
29
29
|
export { default as Raster } from "./source/Raster.js";
|
|
30
30
|
export { default as Source } from "./source/Source.js";
|
|
31
|
-
export { default as
|
|
31
|
+
export { default as StadiaMaps } from "./source/StadiaMaps.js";
|
|
32
32
|
export { default as Tile } from "./source/Tile.js";
|
|
33
33
|
export { default as TileArcGISRest } from "./source/TileArcGISRest.js";
|
|
34
34
|
export { default as TileDebug } from "./source/TileDebug.js";
|
package/source.js
CHANGED
|
@@ -22,7 +22,7 @@ export {default as OGCVectorTile} from './source/OGCVectorTile.js';
|
|
|
22
22
|
export {default as OSM} from './source/OSM.js';
|
|
23
23
|
export {default as Raster} from './source/Raster.js';
|
|
24
24
|
export {default as Source} from './source/Source.js';
|
|
25
|
-
export {default as
|
|
25
|
+
export {default as StadiaMaps} from './source/StadiaMaps.js';
|
|
26
26
|
export {default as Tile} from './source/Tile.js';
|
|
27
27
|
export {default as TileArcGISRest} from './source/TileArcGISRest.js';
|
|
28
28
|
export {default as TileDebug} from './source/TileDebug.js';
|
package/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,4BAFY,KAAK,CAIhB;AASD;;;;;;;;GAQG;AACH,kCAHY,MAAM,CAKjB;AAED;;;GAGG;AACH,sBAFU,MAAM,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,4BAFY,KAAK,CAIhB;AASD;;;;;;;;GAQG;AACH,kCAHY,MAAM,CAKjB;AAED;;;GAGG;AACH,sBAFU,MAAM,CAEiC"}
|
package/util.js
CHANGED
package/source/Stamen.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Stamen.d.ts","sourceRoot":"","sources":["Stamen.js"],"names":[],"mappings":";;;;;;;;;;;;;;WA2Fc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALpB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAkCjB;CACF;gBAtJe,UAAU"}
|