ol 7.5.1 → 8.0.0-dev.1692053484481
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/DataTile.d.ts +2 -2
- package/DataTile.d.ts.map +1 -1
- package/DataTile.js +3 -2
- package/Image.d.ts +139 -40
- package/Image.d.ts.map +1 -1
- package/Image.js +194 -96
- package/ImageCanvas.d.ts +2 -2
- package/ImageCanvas.d.ts.map +1 -1
- package/ImageCanvas.js +2 -2
- package/Object.d.ts +7 -0
- package/Object.d.ts.map +1 -1
- package/Object.js +8 -0
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/expr/cpu.d.ts +71 -0
- package/expr/cpu.d.ts.map +1 -0
- package/expr/cpu.js +312 -0
- package/expr/expression.d.ts +97 -0
- package/expr/expression.d.ts.map +1 -0
- package/expr/expression.js +373 -0
- package/has.d.ts +5 -0
- package/has.d.ts.map +1 -1
- package/has.js +6 -0
- package/index.d.ts +1 -2
- package/index.js +1 -1
- package/layer/Base.d.ts +12 -8
- package/layer/Base.d.ts.map +1 -1
- package/layer/Base.js +12 -8
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/BaseVector.js +67 -33
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Heatmap.js +16 -55
- package/layer/Layer.d.ts +2 -2
- package/layer/Layer.d.ts.map +1 -1
- package/layer/Layer.js +1 -1
- package/layer/WebGLPoints.d.ts +7 -12
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLPoints.js +7 -12
- package/package.json +1 -1
- package/render/Feature.d.ts +8 -0
- package/render/Feature.d.ts.map +1 -1
- package/render/Feature.js +9 -0
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +5 -3
- package/render/canvas/TextBuilder.js +2 -2
- package/render/canvas/style.d.ts +69 -0
- package/render/canvas/style.d.ts.map +1 -0
- package/render/canvas/style.js +1192 -0
- package/render/canvas.js +1 -1
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +4 -0
- package/renderer/Layer.d.ts +2 -2
- package/renderer/Layer.d.ts.map +1 -1
- package/renderer/Layer.js +1 -1
- package/renderer/canvas/ImageLayer.d.ts +4 -4
- package/renderer/canvas/ImageLayer.d.ts.map +1 -1
- package/renderer/canvas/ImageLayer.js +17 -12
- package/renderer/canvas/Layer.d.ts +2 -2
- package/renderer/canvas/Layer.d.ts.map +1 -1
- package/renderer/canvas/Layer.js +1 -1
- package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorImageLayer.js +3 -2
- package/renderer/webgl/VectorLayer.d.ts +1 -2
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/reproj/Image.d.ts +5 -5
- package/reproj/Image.d.ts.map +1 -1
- package/reproj/Image.js +6 -6
- package/reproj.d.ts +2 -2
- package/reproj.d.ts.map +1 -1
- package/reproj.js +1 -1
- package/resolution.d.ts +13 -0
- package/resolution.d.ts.map +1 -0
- package/resolution.js +18 -0
- package/source/Image.d.ts +44 -7
- package/source/Image.d.ts.map +1 -1
- package/source/Image.js +97 -8
- package/source/ImageArcGISRest.d.ts +0 -23
- package/source/ImageArcGISRest.d.ts.map +1 -1
- package/source/ImageArcGISRest.js +18 -120
- package/source/ImageMapGuide.d.ts +0 -24
- package/source/ImageMapGuide.d.ts.map +1 -1
- package/source/ImageMapGuide.js +21 -113
- package/source/ImageStatic.d.ts +2 -27
- package/source/ImageStatic.d.ts.map +1 -1
- package/source/ImageStatic.js +20 -70
- package/source/ImageWMS.d.ts +2 -46
- package/source/ImageWMS.d.ts.map +1 -1
- package/source/ImageWMS.js +43 -201
- 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/TileArcGISRest.d.ts.map +1 -1
- package/source/TileArcGISRest.js +11 -22
- package/source/TileWMS.d.ts +0 -1
- package/source/TileWMS.d.ts.map +1 -1
- package/source/TileWMS.js +43 -106
- package/source/arcgisRest.d.ts +88 -0
- package/source/arcgisRest.d.ts.map +1 -0
- package/source/arcgisRest.js +131 -0
- package/source/common.d.ts +5 -0
- package/source/common.d.ts.map +1 -1
- package/source/common.js +6 -0
- package/source/mapguide.d.ts +52 -0
- package/source/mapguide.d.ts.map +1 -0
- package/source/mapguide.js +116 -0
- package/source/static.d.ts +45 -0
- package/source/static.d.ts.map +1 -0
- package/source/static.js +44 -0
- package/source/wms.d.ts +109 -1
- package/source/wms.d.ts.map +1 -1
- package/source/wms.js +170 -0
- package/source.d.ts +5 -1
- package/source.d.ts.map +1 -1
- package/source.js +5 -1
- package/style/flat.d.ts +332 -173
- package/style/flat.d.ts.map +1 -1
- package/style/flat.js +176 -248
- package/style/literal.d.ts +27 -72
- package/style/literal.d.ts.map +1 -1
- package/style/literal.js +14 -35
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
- package/webgl/Helper.d.ts +7 -2
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +16 -27
- package/webgl/ShaderBuilder.d.ts +4 -14
- package/webgl/ShaderBuilder.d.ts.map +1 -1
- package/webgl/ShaderBuilder.js +72 -72
- package/webgl/styleparser.d.ts +3 -9
- package/webgl/styleparser.d.ts.map +1 -1
- package/webgl/styleparser.js +503 -88
- package/ImageBase.d.ts +0 -65
- package/ImageBase.d.ts.map +0 -1
- package/ImageBase.js +0 -98
- package/source/Stamen.d.ts.map +0 -1
package/source/wms.js
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
* @module ol/source/wms
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import {DECIMALS} from './common.js';
|
|
6
|
+
import {appendParams} from '../uri.js';
|
|
7
|
+
import {assert} from '../asserts.js';
|
|
8
|
+
import {compareVersions} from '../string.js';
|
|
9
|
+
import {decode} from '../Image.js';
|
|
10
|
+
import {getHeight, getWidth} from '../extent.js';
|
|
11
|
+
import {get as getProjection} from '../proj.js';
|
|
12
|
+
import {getRequestExtent} from './Image.js';
|
|
13
|
+
import {round} from '../math.js';
|
|
14
|
+
|
|
5
15
|
/**
|
|
6
16
|
* Default WMS version.
|
|
7
17
|
* @type {string}
|
|
@@ -17,3 +27,163 @@ export const DEFAULT_VERSION = '1.3.0';
|
|
|
17
27
|
* - `'mapserver'`: HiDPI support for [MapServer](https://mapserver.org/)
|
|
18
28
|
* - `'qgis'`: HiDPI support for [QGIS](https://qgis.org/)
|
|
19
29
|
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} baseUrl Base URL.
|
|
33
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
34
|
+
* @param {import("../size.js").Size} size Size.
|
|
35
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
36
|
+
* @param {Object} params WMS params. Will be modified in place.
|
|
37
|
+
* @return {string} Request URL.
|
|
38
|
+
*/
|
|
39
|
+
export function getRequestUrl(baseUrl, extent, size, projection, params) {
|
|
40
|
+
params['WIDTH'] = size[0];
|
|
41
|
+
params['HEIGHT'] = size[1];
|
|
42
|
+
|
|
43
|
+
const axisOrientation = projection.getAxisOrientation();
|
|
44
|
+
let bbox;
|
|
45
|
+
const v13 = compareVersions(params['VERSION'], '1.3') >= 0;
|
|
46
|
+
params[v13 ? 'CRS' : 'SRS'] = projection.getCode();
|
|
47
|
+
if (v13 && axisOrientation.substr(0, 2) == 'ne') {
|
|
48
|
+
bbox = [extent[1], extent[0], extent[3], extent[2]];
|
|
49
|
+
} else {
|
|
50
|
+
bbox = extent;
|
|
51
|
+
}
|
|
52
|
+
params['BBOX'] = bbox.join(',');
|
|
53
|
+
|
|
54
|
+
return appendParams(/** @type {string} */ (baseUrl), params);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {import("../extent").Extent} extent Extent.
|
|
59
|
+
* @param {number} resolution Resolution.
|
|
60
|
+
* @param {number} pixelRatio pixel ratio.
|
|
61
|
+
* @param {import("../proj.js").Projection} projection Projection.
|
|
62
|
+
* @param {string} url WMS service url.
|
|
63
|
+
* @param {Object} params WMS params.
|
|
64
|
+
* @param {import("./wms.js").ServerType} serverType The type of the remote WMS server.
|
|
65
|
+
* @return {string} Image src.
|
|
66
|
+
*/
|
|
67
|
+
export function getImageSrc(
|
|
68
|
+
extent,
|
|
69
|
+
resolution,
|
|
70
|
+
pixelRatio,
|
|
71
|
+
projection,
|
|
72
|
+
url,
|
|
73
|
+
params,
|
|
74
|
+
serverType
|
|
75
|
+
) {
|
|
76
|
+
params = Object.assign({REQUEST: 'GetMap'}, params);
|
|
77
|
+
|
|
78
|
+
const imageResolution = resolution / pixelRatio;
|
|
79
|
+
|
|
80
|
+
const imageSize = [
|
|
81
|
+
round(getWidth(extent) / imageResolution, DECIMALS),
|
|
82
|
+
round(getHeight(extent) / imageResolution, DECIMALS),
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
if (pixelRatio != 1) {
|
|
86
|
+
switch (serverType) {
|
|
87
|
+
case 'geoserver':
|
|
88
|
+
const dpi = (90 * pixelRatio + 0.5) | 0;
|
|
89
|
+
if ('FORMAT_OPTIONS' in params) {
|
|
90
|
+
params['FORMAT_OPTIONS'] += ';dpi:' + dpi;
|
|
91
|
+
} else {
|
|
92
|
+
params['FORMAT_OPTIONS'] = 'dpi:' + dpi;
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
case 'mapserver':
|
|
96
|
+
params['MAP_RESOLUTION'] = 90 * pixelRatio;
|
|
97
|
+
break;
|
|
98
|
+
case 'carmentaserver':
|
|
99
|
+
case 'qgis':
|
|
100
|
+
params['DPI'] = 90 * pixelRatio;
|
|
101
|
+
break;
|
|
102
|
+
default: // Unknown `serverType` configured
|
|
103
|
+
assert(false, 8);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const src = getRequestUrl(url, extent, imageSize, projection, params);
|
|
109
|
+
return src;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @param {Object} params WMS params.
|
|
114
|
+
* @param {string} request WMS `REQUEST`.
|
|
115
|
+
* @return {Object} WMS params with required properties set.
|
|
116
|
+
*/
|
|
117
|
+
export function getRequestParams(params, request) {
|
|
118
|
+
return Object.assign(
|
|
119
|
+
{
|
|
120
|
+
'REQUEST': request,
|
|
121
|
+
'SERVICE': 'WMS',
|
|
122
|
+
'VERSION': DEFAULT_VERSION,
|
|
123
|
+
'FORMAT': 'image/png',
|
|
124
|
+
'STYLES': '',
|
|
125
|
+
'TRANSPARENT': true,
|
|
126
|
+
},
|
|
127
|
+
params
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @typedef {Object} LoaderOptions
|
|
133
|
+
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
|
134
|
+
* you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
|
|
135
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
|
136
|
+
* @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
|
|
137
|
+
* the image from the remote server.
|
|
138
|
+
* @property {Object<string,*>} [params] WMS request parameters.
|
|
139
|
+
* At least a `LAYERS` param is required. `STYLES` is
|
|
140
|
+
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT` and `BBOX` will be set
|
|
141
|
+
* dynamically. `CRS` (`SRS` for WMS version < 1.3.0) will is derived from the `proection` config.
|
|
142
|
+
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is 'EPSG:3857'.
|
|
143
|
+
* @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
|
|
144
|
+
* twice the width and height of the map viewport, and so on. Must be `1` or higher.
|
|
145
|
+
* @property {import("./wms.js").ServerType} [serverType] The type of
|
|
146
|
+
* the remote WMS server: `mapserver`, `geoserver`, `carmentaserver`, or `qgis`.
|
|
147
|
+
* Only needed if `hidpi` is `true`.
|
|
148
|
+
* @property {string} url WMS service URL.
|
|
149
|
+
* @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function
|
|
150
|
+
* to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and
|
|
151
|
+
* returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Creates a loader for WMS images.
|
|
156
|
+
* @param {LoaderOptions} options Loader options.
|
|
157
|
+
* @return {import("../Image.js").ImageObjectPromiseLoader} Loader.
|
|
158
|
+
* @api
|
|
159
|
+
*/
|
|
160
|
+
export function createLoader(options) {
|
|
161
|
+
const hidpi = options.hidpi === undefined ? true : options.hidpi;
|
|
162
|
+
const projection = getProjection(options.projection || 'EPSG:3857');
|
|
163
|
+
const ratio = options.ratio || 1.5;
|
|
164
|
+
const load = options.load || decode;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @type {import("../Image.js").Loader}
|
|
168
|
+
*/
|
|
169
|
+
return (extent, resolution, pixelRatio) => {
|
|
170
|
+
extent = getRequestExtent(extent, resolution, pixelRatio, ratio);
|
|
171
|
+
if (pixelRatio != 1 && (!hidpi || options.serverType === undefined)) {
|
|
172
|
+
pixelRatio = 1;
|
|
173
|
+
}
|
|
174
|
+
const src = getImageSrc(
|
|
175
|
+
extent,
|
|
176
|
+
resolution,
|
|
177
|
+
pixelRatio,
|
|
178
|
+
projection,
|
|
179
|
+
options.url,
|
|
180
|
+
getRequestParams(options.params, 'GetMap'),
|
|
181
|
+
options.serverType
|
|
182
|
+
);
|
|
183
|
+
const image = new Image();
|
|
184
|
+
if (options.crossOrigin !== null) {
|
|
185
|
+
image.crossOrigin = options.crossOrigin;
|
|
186
|
+
}
|
|
187
|
+
return load(image, src).then((image) => ({image, extent, pixelRatio}));
|
|
188
|
+
};
|
|
189
|
+
}
|
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";
|
|
@@ -42,4 +42,8 @@ export { default as VectorTile } from "./source/VectorTile.js";
|
|
|
42
42
|
export { default as WMTS } from "./source/WMTS.js";
|
|
43
43
|
export { default as XYZ } from "./source/XYZ.js";
|
|
44
44
|
export { default as Zoomify } from "./source/Zoomify.js";
|
|
45
|
+
export { createLoader as createWMSLoader } from "./source/wms.js";
|
|
46
|
+
export { createLoader as createArcGISRestLoader } from "./source/arcgisRest.js";
|
|
47
|
+
export { createLoader as creaetStaticLoader } from "./source/static.js";
|
|
48
|
+
export { createLoader as createMapGuideLoader } from "./source/mapguide.js";
|
|
45
49
|
//# sourceMappingURL=source.d.ts.map
|
package/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["source.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["source.js"],"names":[],"mappings":"AA2CA;;;;;;;;;;;GAWG;AACH,8CATW,OAAO,wBAAwB,EAAE,OAAO,kBAC/B,OAAO,gBAAgB,EAAE,SAAS,KAAG,OAAO,oBAAoB,EAAE,OAAO,UAKxE,OAAO,aAAa,EAAE,MAAM,QAAE,MAAM,KAAG,MAAM,OAAO,oBAAoB,EAAE,OAAO,CAAC,CAuBtG"}
|
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';
|
|
@@ -36,6 +36,10 @@ export {default as VectorTile} from './source/VectorTile.js';
|
|
|
36
36
|
export {default as WMTS} from './source/WMTS.js';
|
|
37
37
|
export {default as XYZ} from './source/XYZ.js';
|
|
38
38
|
export {default as Zoomify} from './source/Zoomify.js';
|
|
39
|
+
export {createLoader as createWMSLoader} from './source/wms.js';
|
|
40
|
+
export {createLoader as createArcGISRestLoader} from './source/arcgisRest.js';
|
|
41
|
+
export {createLoader as creaetStaticLoader} from './source/static.js';
|
|
42
|
+
export {createLoader as createMapGuideLoader} from './source/mapguide.js';
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* Creates a sources function from a tile grid. This function can be used as value for the
|