ol 9.1.1-dev.1715087016979 → 9.1.1-dev.1715102817264
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.d.ts +2 -0
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/source/OGCMapTile.d.ts +10 -1
- package/source/OGCMapTile.d.ts.map +1 -1
- package/source/OGCMapTile.js +6 -1
- package/source/OGCVectorTile.d.ts +10 -1
- package/source/OGCVectorTile.d.ts.map +1 -1
- package/source/OGCVectorTile.js +6 -1
- package/source/ogcTileUtil.d.ts +15 -2
- package/source/ogcTileUtil.d.ts.map +1 -1
- package/source/ogcTileUtil.js +50 -1
- package/util.js +1 -1
package/package.json
CHANGED
package/source/OGCMapTile.d.ts
CHANGED
|
@@ -62,6 +62,11 @@ export type Options = {
|
|
|
62
62
|
* To disable the opacity transition, pass `transition: 0`.
|
|
63
63
|
*/
|
|
64
64
|
transition?: number | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* A list of geospatial data sub-resources to include. If not provided, the entire dataset will
|
|
67
|
+
* be included. This option is not applicable when requesting the tileset for a single collection.
|
|
68
|
+
*/
|
|
69
|
+
collections?: string[] | undefined;
|
|
65
70
|
};
|
|
66
71
|
/**
|
|
67
72
|
* @typedef {Object} Options
|
|
@@ -91,12 +96,16 @@ export type Options = {
|
|
|
91
96
|
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
|
|
92
97
|
* @property {number} [transition] Duration of the opacity transition for rendering.
|
|
93
98
|
* To disable the opacity transition, pass `transition: 0`.
|
|
99
|
+
* @property {Array<string>} [collections] A list of geospatial data sub-resources to include. If not provided, the entire dataset will
|
|
100
|
+
* be included. This option is not applicable when requesting the tileset for a single collection.
|
|
94
101
|
*/
|
|
95
102
|
/**
|
|
96
103
|
* @classdesc
|
|
97
104
|
* Layer source for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) service that provides "map" type tiles.
|
|
98
105
|
* The service must conform to at least the core (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)
|
|
99
|
-
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes.
|
|
106
|
+
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes. For supporting the `collections`
|
|
107
|
+
* option, the service must conform to the collections selection
|
|
108
|
+
* (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection) conformance class.
|
|
100
109
|
* @api
|
|
101
110
|
*/
|
|
102
111
|
declare class OGCMapTile extends TileImage {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OGCMapTile.d.ts","sourceRoot":"","sources":["OGCMapTile.js"],"names":[],"mappings":";;;;;SASc,MAAM;;;;;;;;;;;;;;;;iBAKN,OAAO,YAAY,EAAE,cAAc
|
|
1
|
+
{"version":3,"file":"OGCMapTile.d.ts","sourceRoot":"","sources":["OGCMapTile.js"],"names":[],"mappings":";;;;;SASc,MAAM;;;;;;;;;;;;;;;;iBAKN,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAPjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA2BjB;IAED;;;OAGG;IACH,2BAIC;IAED;;;OAGG;IACH,qBAGC;CACF;sBA9FqB,gBAAgB"}
|
package/source/OGCMapTile.js
CHANGED
|
@@ -33,13 +33,17 @@ import {error as logError} from '../console.js';
|
|
|
33
33
|
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
|
|
34
34
|
* @property {number} [transition] Duration of the opacity transition for rendering.
|
|
35
35
|
* To disable the opacity transition, pass `transition: 0`.
|
|
36
|
+
* @property {Array<string>} [collections] A list of geospatial data sub-resources to include. If not provided, the entire dataset will
|
|
37
|
+
* be included. This option is not applicable when requesting the tileset for a single collection.
|
|
36
38
|
*/
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* @classdesc
|
|
40
42
|
* Layer source for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) service that provides "map" type tiles.
|
|
41
43
|
* The service must conform to at least the core (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)
|
|
42
|
-
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes.
|
|
44
|
+
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes. For supporting the `collections`
|
|
45
|
+
* option, the service must conform to the collections selection
|
|
46
|
+
* (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection) conformance class.
|
|
43
47
|
* @api
|
|
44
48
|
*/
|
|
45
49
|
class OGCMapTile extends TileImage {
|
|
@@ -65,6 +69,7 @@ class OGCMapTile extends TileImage {
|
|
|
65
69
|
projection: this.getProjection(),
|
|
66
70
|
mediaType: options.mediaType,
|
|
67
71
|
context: options.context || null,
|
|
72
|
+
collections: options.collections,
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
getTileSetInfo(sourceInfo)
|
|
@@ -63,6 +63,11 @@ export type Options = {
|
|
|
63
63
|
* zoom levels. See {@link module :ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
64
64
|
*/
|
|
65
65
|
zDirection?: number | import("../array.js").NearestDirectionFunction | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* A list of geospatial data sub-resources to include. If not provided, the entire dataset will
|
|
68
|
+
* be included. This option is not applicable when requesting the tileset for a single collection.
|
|
69
|
+
*/
|
|
70
|
+
collections?: string[] | undefined;
|
|
66
71
|
};
|
|
67
72
|
/**
|
|
68
73
|
* @typedef {Object} Options
|
|
@@ -91,12 +96,16 @@ export type Options = {
|
|
|
91
96
|
* @property {number|import("../array.js").NearestDirectionFunction} [zDirection=1]
|
|
92
97
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
93
98
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
99
|
+
* @property {Array<string>} [collections] A list of geospatial data sub-resources to include. If not provided, the entire dataset will
|
|
100
|
+
* be included. This option is not applicable when requesting the tileset for a single collection.
|
|
94
101
|
*/
|
|
95
102
|
/**
|
|
96
103
|
* @classdesc
|
|
97
104
|
* Layer source for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) service that provides "vector" type tiles.
|
|
98
105
|
* The service must conform to at least the core (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)
|
|
99
|
-
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes.
|
|
106
|
+
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes. For supporting the `collections`
|
|
107
|
+
* option, the service must conform to the collections selection
|
|
108
|
+
* (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection) conformance class.
|
|
100
109
|
*
|
|
101
110
|
* Vector tile sets may come in a variety of formats (e.g. GeoJSON, MVT). The `format` option is used to determine
|
|
102
111
|
* which of the advertised media types is used. If you need to force the use of a particular media type, you can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OGCVectorTile.d.ts","sourceRoot":"","sources":["OGCVectorTile.js"],"names":[],"mappings":";;;;;SAUc,MAAM;;;;;;;;;YAGN,OAAO,sBAAsB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUtC,OAAO,YAAY,EAAE,cAAc
|
|
1
|
+
{"version":3,"file":"OGCVectorTile.d.ts","sourceRoot":"","sources":["OGCVectorTile.js"],"names":[],"mappings":";;;;;SAUc,MAAM;;;;;;;;;YAGN,OAAO,sBAAsB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUtC,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAfjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA6BjB;IAED;;;OAGG;IACH,2BAIC;IAED;;;OAGG;IACH,qBAGC;CACF;6BAnG4B,iBAAiB"}
|
package/source/OGCVectorTile.js
CHANGED
|
@@ -33,13 +33,17 @@ import {error as logError} from '../console.js';
|
|
|
33
33
|
* @property {number|import("../array.js").NearestDirectionFunction} [zDirection=1]
|
|
34
34
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
35
35
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
36
|
+
* @property {Array<string>} [collections] A list of geospatial data sub-resources to include. If not provided, the entire dataset will
|
|
37
|
+
* be included. This option is not applicable when requesting the tileset for a single collection.
|
|
36
38
|
*/
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* @classdesc
|
|
40
42
|
* Layer source for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) service that provides "vector" type tiles.
|
|
41
43
|
* The service must conform to at least the core (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)
|
|
42
|
-
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes.
|
|
44
|
+
* and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes. For supporting the `collections`
|
|
45
|
+
* option, the service must conform to the collections selection
|
|
46
|
+
* (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection) conformance class.
|
|
43
47
|
*
|
|
44
48
|
* Vector tile sets may come in a variety of formats (e.g. GeoJSON, MVT). The `format` option is used to determine
|
|
45
49
|
* which of the advertised media types is used. If you need to force the use of a particular media type, you can
|
|
@@ -71,6 +75,7 @@ class OGCVectorTile extends VectorTileSource {
|
|
|
71
75
|
mediaType: options.mediaType,
|
|
72
76
|
supportedMediaTypes: options.format.supportedMediaTypes,
|
|
73
77
|
context: options.context || null,
|
|
78
|
+
collections: options.collections,
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
getTileSetInfo(sourceInfo)
|
package/source/ogcTileUtil.d.ts
CHANGED
|
@@ -11,20 +11,29 @@
|
|
|
11
11
|
* @property {Array<string>} [supportedMediaTypes] The supported media types.
|
|
12
12
|
* @property {import("../proj/Projection.js").default} projection The source projection.
|
|
13
13
|
* @property {Object} [context] Optional context for constructing the URL.
|
|
14
|
+
* @property {Array<string>} [collections] Optional collections to append the URL with.
|
|
14
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} tileUrlTemplate Tile URL template.
|
|
18
|
+
* @param {Array<string>} collections List of collections to include as query parameter.
|
|
19
|
+
* @return {string} The tile URL template with appended collections query parameter.
|
|
20
|
+
*/
|
|
21
|
+
export function appendCollectionsQueryParam(tileUrlTemplate: string, collections: Array<string>): string;
|
|
15
22
|
/**
|
|
16
23
|
* @param {Array<Link>} links Tileset links.
|
|
17
24
|
* @param {string} [mediaType] The preferred media type.
|
|
25
|
+
* @param {Array<string>} [collections] Optional collections to append the URL with.
|
|
18
26
|
* @return {string} The tile URL template.
|
|
19
27
|
*/
|
|
20
|
-
export function getMapTileUrlTemplate(links: Array<Link>, mediaType?: string | undefined): string;
|
|
28
|
+
export function getMapTileUrlTemplate(links: Array<Link>, mediaType?: string | undefined, collections?: string[] | undefined): string;
|
|
21
29
|
/**
|
|
22
30
|
* @param {Array<Link>} links Tileset links.
|
|
23
31
|
* @param {string} [mediaType] The preferred media type.
|
|
24
32
|
* @param {Array<string>} [supportedMediaTypes] The media types supported by the parser.
|
|
33
|
+
* @param {Array<string>} [collections] Optional collections to append the URL with.
|
|
25
34
|
* @return {string} The tile URL template.
|
|
26
35
|
*/
|
|
27
|
-
export function getVectorTileUrlTemplate(links: Array<Link>, mediaType?: string | undefined, supportedMediaTypes?: string[] | undefined): string;
|
|
36
|
+
export function getVectorTileUrlTemplate(links: Array<Link>, mediaType?: string | undefined, supportedMediaTypes?: string[] | undefined, collections?: string[] | undefined): string;
|
|
28
37
|
/**
|
|
29
38
|
* @param {SourceInfo} sourceInfo Source info.
|
|
30
39
|
* @return {Promise<TileSetInfo>} Tile set info.
|
|
@@ -65,6 +74,10 @@ export type SourceInfo = {
|
|
|
65
74
|
* Optional context for constructing the URL.
|
|
66
75
|
*/
|
|
67
76
|
context?: any;
|
|
77
|
+
/**
|
|
78
|
+
* Optional collections to append the URL with.
|
|
79
|
+
*/
|
|
80
|
+
collections?: string[] | undefined;
|
|
68
81
|
};
|
|
69
82
|
export type TileType = 'map' | 'vector';
|
|
70
83
|
export type CornerOfOrigin = 'topLeft' | 'bottomLeft';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ogcTileUtil.d.ts","sourceRoot":"","sources":["ogcTileUtil.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ogcTileUtil.d.ts","sourceRoot":"","sources":["ogcTileUtil.js"],"names":[],"mappings":"AAqFA;;;;;GAKG;AAEH;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,6DAJW,MAAM,eACN,MAAM,MAAM,CAAC,GACZ,MAAM,CA6BjB;AAED;;;;;GAKG;AACH,6CALW,MAAM,IAAI,CAAC,uEAGV,MAAM,CAiCjB;AAED;;;;;;GAMG;AACH,gDANW,MAAM,IAAI,CAAC,mHAIV,MAAM,CAsDjB;AA6ND;;;GAGG;AACH,2CAHW,UAAU,GACT,QAAQ,WAAW,CAAC,CAM/B;;;;;iBAxXa,MAAM;;;;UACN,OAAO,yBAAyB,EAAE,OAAO;;;;iBACzC,OAAO,YAAY,EAAE,WAAW;;;;;;SAKhC,MAAM;;;;eACN,MAAM;;;;;;;;gBAEN,OAAO,uBAAuB,EAAE,OAAO;;;;;;;;;;uBAlFxC,KAAK,GAAG,QAAQ;6BAIhB,SAAS,GAAG,YAAY;;;;;cAKvB,QAAQ;;;;;;;;;;;;;;;;WAIR,MAAM,IAAI,CAAC;;;;;;SAKX,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;;;gBAKN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;;;QAKN,MAAM;;;;SACN,MAAM;;;;;;;;kBAEN,MAAM,UAAU,CAAC;;;;;;QAKjB,MAAM;;;;cACN,MAAM;;;;mBACN,MAAM,MAAM,CAAC;;;;;;;;iBAEb,MAAM;;;;kBACN,MAAM;;;;eACN,MAAM;;;;gBACN,MAAM"}
|
package/source/ogcTileUtil.js
CHANGED
|
@@ -6,6 +6,7 @@ import TileGrid from '../tilegrid/TileGrid.js';
|
|
|
6
6
|
import {getJSON, resolveUrl} from '../net.js';
|
|
7
7
|
import {get as getProjection} from '../proj.js';
|
|
8
8
|
import {getIntersection as intersectExtents} from '../extent.js';
|
|
9
|
+
import {error as logError} from '../console.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* See https://ogcapi.ogc.org/tiles/.
|
|
@@ -96,14 +97,50 @@ const knownVectorMediaTypes = {
|
|
|
96
97
|
* @property {Array<string>} [supportedMediaTypes] The supported media types.
|
|
97
98
|
* @property {import("../proj/Projection.js").default} projection The source projection.
|
|
98
99
|
* @property {Object} [context] Optional context for constructing the URL.
|
|
100
|
+
* @property {Array<string>} [collections] Optional collections to append the URL with.
|
|
99
101
|
*/
|
|
100
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @param {string} tileUrlTemplate Tile URL template.
|
|
105
|
+
* @param {Array<string>} collections List of collections to include as query parameter.
|
|
106
|
+
* @return {string} The tile URL template with appended collections query parameter.
|
|
107
|
+
*/
|
|
108
|
+
export function appendCollectionsQueryParam(tileUrlTemplate, collections) {
|
|
109
|
+
if (!collections.length) {
|
|
110
|
+
return tileUrlTemplate;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// making sure we can always construct a URL instance.
|
|
114
|
+
const url = new URL(tileUrlTemplate, 'file://');
|
|
115
|
+
|
|
116
|
+
if (url.pathname.split('/').includes('collections')) {
|
|
117
|
+
logError(
|
|
118
|
+
'The "collections" query parameter cannot be added to collection endpoints',
|
|
119
|
+
);
|
|
120
|
+
return tileUrlTemplate;
|
|
121
|
+
}
|
|
122
|
+
// According to conformance class
|
|
123
|
+
// http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection
|
|
124
|
+
// commata in the identifiers of the `collections` query parameter
|
|
125
|
+
// need to be URLEncoded, while the commata separating the identifiers
|
|
126
|
+
// should not.
|
|
127
|
+
const encodedCollections = collections
|
|
128
|
+
.map((c) => encodeURIComponent(c))
|
|
129
|
+
.join(',');
|
|
130
|
+
|
|
131
|
+
url.searchParams.append('collections', encodedCollections);
|
|
132
|
+
const baseUrl = tileUrlTemplate.split('?')[0];
|
|
133
|
+
const queryParams = decodeURIComponent(url.searchParams.toString());
|
|
134
|
+
return `${baseUrl}?${queryParams}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
101
137
|
/**
|
|
102
138
|
* @param {Array<Link>} links Tileset links.
|
|
103
139
|
* @param {string} [mediaType] The preferred media type.
|
|
140
|
+
* @param {Array<string>} [collections] Optional collections to append the URL with.
|
|
104
141
|
* @return {string} The tile URL template.
|
|
105
142
|
*/
|
|
106
|
-
export function getMapTileUrlTemplate(links, mediaType) {
|
|
143
|
+
export function getMapTileUrlTemplate(links, mediaType, collections) {
|
|
107
144
|
let tileUrlTemplate;
|
|
108
145
|
let fallbackUrlTemplate;
|
|
109
146
|
for (let i = 0; i < links.length; ++i) {
|
|
@@ -129,6 +166,10 @@ export function getMapTileUrlTemplate(links, mediaType) {
|
|
|
129
166
|
}
|
|
130
167
|
}
|
|
131
168
|
|
|
169
|
+
if (collections) {
|
|
170
|
+
tileUrlTemplate = appendCollectionsQueryParam(tileUrlTemplate, collections);
|
|
171
|
+
}
|
|
172
|
+
|
|
132
173
|
return tileUrlTemplate;
|
|
133
174
|
}
|
|
134
175
|
|
|
@@ -136,12 +177,14 @@ export function getMapTileUrlTemplate(links, mediaType) {
|
|
|
136
177
|
* @param {Array<Link>} links Tileset links.
|
|
137
178
|
* @param {string} [mediaType] The preferred media type.
|
|
138
179
|
* @param {Array<string>} [supportedMediaTypes] The media types supported by the parser.
|
|
180
|
+
* @param {Array<string>} [collections] Optional collections to append the URL with.
|
|
139
181
|
* @return {string} The tile URL template.
|
|
140
182
|
*/
|
|
141
183
|
export function getVectorTileUrlTemplate(
|
|
142
184
|
links,
|
|
143
185
|
mediaType,
|
|
144
186
|
supportedMediaTypes,
|
|
187
|
+
collections,
|
|
145
188
|
) {
|
|
146
189
|
let tileUrlTemplate;
|
|
147
190
|
let fallbackUrlTemplate;
|
|
@@ -184,6 +227,10 @@ export function getVectorTileUrlTemplate(
|
|
|
184
227
|
}
|
|
185
228
|
}
|
|
186
229
|
|
|
230
|
+
if (collections) {
|
|
231
|
+
tileUrlTemplate = appendCollectionsQueryParam(tileUrlTemplate, collections);
|
|
232
|
+
}
|
|
233
|
+
|
|
187
234
|
return tileUrlTemplate;
|
|
188
235
|
}
|
|
189
236
|
|
|
@@ -362,12 +409,14 @@ function parseTileSetMetadata(sourceInfo, tileSet) {
|
|
|
362
409
|
tileUrlTemplate = getMapTileUrlTemplate(
|
|
363
410
|
tileSet.links,
|
|
364
411
|
sourceInfo.mediaType,
|
|
412
|
+
sourceInfo.collections,
|
|
365
413
|
);
|
|
366
414
|
} else if (tileSet.dataType === 'vector') {
|
|
367
415
|
tileUrlTemplate = getVectorTileUrlTemplate(
|
|
368
416
|
tileSet.links,
|
|
369
417
|
sourceInfo.mediaType,
|
|
370
418
|
sourceInfo.supportedMediaTypes,
|
|
419
|
+
sourceInfo.collections,
|
|
371
420
|
);
|
|
372
421
|
} else {
|
|
373
422
|
throw new Error('Expected tileset data type to be "map" or "vector"');
|
package/util.js
CHANGED