@loaders.gl/wms 4.3.0-alpha.2 → 4.3.0-alpha.3
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/csw-capabilities-loader.js +1 -1
- package/dist/csw-domain-loader.js +1 -1
- package/dist/csw-records-loader.js +1 -1
- package/dist/gml-loader.js +1 -1
- package/dist/index.cjs +124 -299
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -10
- package/dist/lib/deprecated/create-image-source.d.ts +21 -0
- package/dist/lib/deprecated/create-image-source.d.ts.map +1 -0
- package/dist/lib/deprecated/create-image-source.js +44 -0
- package/dist/lib/parsers/wfs/parse-wfs-capabilities.d.ts.map +1 -0
- package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs-capabilities.js +5 -2
- package/dist/lib/parsers/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/services/arcgis/arcgis-feature-server.d.ts +67 -0
- package/dist/services/arcgis/arcgis-feature-server.d.ts.map +1 -0
- package/dist/services/arcgis/arcgis-feature-server.js +446 -0
- package/dist/services/arcgis/{arcgis-image-service.d.ts → arcgis-image-server.d.ts} +25 -10
- package/dist/services/arcgis/arcgis-image-server.d.ts.map +1 -0
- package/dist/services/arcgis/{arcgis-image-service.js → arcgis-image-server.js} +28 -11
- package/dist/services/ogc/csw-service.d.ts +13 -13
- package/dist/services/ogc/csw-service.d.ts.map +1 -1
- package/dist/services/ogc/wfs-service.d.ts +279 -0
- package/dist/services/ogc/wfs-service.d.ts.map +1 -0
- package/dist/services/ogc/wfs-service.js +388 -0
- package/dist/services/ogc/wms-service.d.ts +42 -21
- package/dist/services/ogc/wms-service.d.ts.map +1 -1
- package/dist/services/ogc/wms-service.js +28 -13
- package/dist/{wip/wfs-capabilities-loader.d.ts → wfs-capabilities-loader.d.ts} +2 -1
- package/dist/wfs-capabilities-loader.d.ts.map +1 -0
- package/dist/{wip/wfs-capabilities-loader.js → wfs-capabilities-loader.js} +3 -2
- package/dist/wip/wcs-capabilities-loader.js +1 -1
- package/dist/wip/wmts-capabilities-loader.js +1 -1
- package/dist/wms-capabilities-loader.js +1 -1
- package/dist/wms-error-loader.js +1 -1
- package/package.json +6 -6
- package/src/index.ts +12 -24
- package/src/lib/{services/create-image-service.ts → deprecated/create-image-service.ts.disabled} +4 -4
- package/src/lib/deprecated/create-image-source.ts +70 -0
- package/src/{wip/lib → lib/parsers}/wfs/parse-wfs-capabilities.ts +8 -5
- package/src/services/arcgis/arcgis-feature-server.ts +506 -0
- package/src/services/arcgis/{arcgis-image-service.ts → arcgis-image-server.ts} +41 -18
- package/src/services/ogc/csw-service.ts +17 -15
- package/src/services/ogc/wfs-service.ts +624 -0
- package/src/services/ogc/wms-service.ts +53 -29
- package/src/{wip/wfs-capabilities-loader.ts → wfs-capabilities-loader.ts} +3 -2
- package/dist/lib/services/create-image-service.d.ts +0 -14
- package/dist/lib/services/create-image-service.d.ts.map +0 -1
- package/dist/lib/services/create-image-service.js +0 -39
- package/dist/lib/services/image-service.d.ts +0 -28
- package/dist/lib/services/image-service.d.ts.map +0 -1
- package/dist/lib/services/image-service.js +0 -45
- package/dist/services/arcgis/arcgis-image-service.d.ts.map +0 -1
- package/dist/services/create-image-source.d.ts +0 -18
- package/dist/services/create-image-source.d.ts.map +0 -1
- package/dist/services/create-image-source.js +0 -17
- package/dist/wip/lib/wfs/parse-wfs-capabilities.d.ts.map +0 -1
- package/dist/wip/lib/wfs/parse-wfs.d.ts.map +0 -1
- package/dist/wip/services/arcgis-feature-service.d.ts +0 -56
- package/dist/wip/services/arcgis-feature-service.d.ts.map +0 -1
- package/dist/wip/services/arcgis-feature-service.js +0 -27
- package/dist/wip/wfs-capabilities-loader.d.ts.map +0 -1
- package/src/services/create-image-source.ts +0 -33
- package/src/wip/services/arcgis-feature-service.ts +0 -89
- /package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs-capabilities.d.ts +0 -0
- /package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs.d.ts +0 -0
- /package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs.js +0 -0
- /package/src/lib/{services/image-service.ts → deprecated/template-image-service.ts.disabled} +0 -0
- /package/src/{wip/lib → lib/parsers}/wfs/parse-wfs.ts +0 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { VectorSource, mergeLoaderOptions } from '@loaders.gl/loader-utils';
|
|
5
|
+
import { WFSCapabilitiesLoader } from "../../wfs-capabilities-loader.js";
|
|
6
|
+
import { WMSErrorLoader } from "../../wms-error-loader.js";
|
|
7
|
+
/* eslint-disable camelcase */ // WFS XML parameters use snake_case
|
|
8
|
+
/**
|
|
9
|
+
* @ndeprecated This is a WIP, not fully implemented
|
|
10
|
+
* @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
|
|
11
|
+
*/
|
|
12
|
+
export const WFSSource = {
|
|
13
|
+
name: 'WFS',
|
|
14
|
+
id: 'wfs',
|
|
15
|
+
module: 'wms',
|
|
16
|
+
version: '0.0.0',
|
|
17
|
+
extensions: [],
|
|
18
|
+
mimeTypes: [],
|
|
19
|
+
options: {
|
|
20
|
+
url: undefined,
|
|
21
|
+
wfs: {
|
|
22
|
+
/** Tabular loaders, normally the GeoJSONLoader */
|
|
23
|
+
loaders: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
type: 'wfs',
|
|
27
|
+
fromUrl: true,
|
|
28
|
+
fromBlob: false,
|
|
29
|
+
testURL: (url) => url.toLowerCase().includes('wfs'),
|
|
30
|
+
createDataSource: (url, props) => new WFSVectorSource(props)
|
|
31
|
+
};
|
|
32
|
+
//
|
|
33
|
+
/**
|
|
34
|
+
* The WFSVectorSource class provides
|
|
35
|
+
* - provides type safe methods to form URLs to a WFS service
|
|
36
|
+
* - provides type safe methods to query and parse results (and errors) from a WFS service
|
|
37
|
+
* - implements the VectorSource interface
|
|
38
|
+
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
39
|
+
*/
|
|
40
|
+
export class WFSVectorSource extends VectorSource {
|
|
41
|
+
/** Base URL to the service */
|
|
42
|
+
url;
|
|
43
|
+
data;
|
|
44
|
+
// /** In WFS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */
|
|
45
|
+
// substituteCRS84: boolean;
|
|
46
|
+
// /** In WFS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */
|
|
47
|
+
// flipCRS: string[];
|
|
48
|
+
// /** Default static WFS parameters */
|
|
49
|
+
// wmsParameters: Required<WFSParameters>;
|
|
50
|
+
/** Default static vendor parameters */
|
|
51
|
+
vendorParameters;
|
|
52
|
+
capabilities = null;
|
|
53
|
+
/** Create a WFSVectorSource */
|
|
54
|
+
constructor(props) {
|
|
55
|
+
super(props);
|
|
56
|
+
// TODO - defaults such as version, layers etc could be extracted from a base URL with parameters
|
|
57
|
+
// This would make pasting in any WFS URL more likely to make this class just work.
|
|
58
|
+
// const {baseUrl, parameters} = this._parseWFSUrl(props.url);
|
|
59
|
+
this.url = props.url;
|
|
60
|
+
this.data = props.url;
|
|
61
|
+
// this.substituteCRS84 = props.substituteCRS84 ?? false;
|
|
62
|
+
// this.flipCRS = ['EPSG:4326'];
|
|
63
|
+
// this.wmsParameters = {
|
|
64
|
+
// layers: undefined!,
|
|
65
|
+
// query_layers: undefined!,
|
|
66
|
+
// styles: undefined,
|
|
67
|
+
// version: '1.3.0',
|
|
68
|
+
// crs: 'EPSG:4326',
|
|
69
|
+
// format: 'image/png',
|
|
70
|
+
// info_format: 'text/plain',
|
|
71
|
+
// transparent: undefined!,
|
|
72
|
+
// time: undefined!,
|
|
73
|
+
// elevation: undefined!,
|
|
74
|
+
// ...props.wmsParameters
|
|
75
|
+
// };
|
|
76
|
+
// this.vendorParameters = props.vendorParameters || {};
|
|
77
|
+
}
|
|
78
|
+
async getSchema() {
|
|
79
|
+
return { metadata: {}, fields: [] };
|
|
80
|
+
}
|
|
81
|
+
// VectorSource implementation
|
|
82
|
+
async getMetadata() {
|
|
83
|
+
const capabilities = await this.getCapabilities();
|
|
84
|
+
return this.normalizeMetadata(capabilities);
|
|
85
|
+
}
|
|
86
|
+
async getFeatures(parameters) {
|
|
87
|
+
// Replace the GetImage `boundingBox` parameter with the WFS flat `bbox` parameter.
|
|
88
|
+
// const {boundingBox, bbox, ...rest} = parameters;
|
|
89
|
+
// const wmsParameters: WFSGetMapParameters = {
|
|
90
|
+
// bbox: boundingBox ? [...boundingBox[0], ...boundingBox[1]] : bbox!,
|
|
91
|
+
// ...rest
|
|
92
|
+
// };
|
|
93
|
+
return { shape: 'geojson-table', type: 'FeatureCollection', features: [] };
|
|
94
|
+
}
|
|
95
|
+
normalizeMetadata(capabilities) {
|
|
96
|
+
return capabilities;
|
|
97
|
+
}
|
|
98
|
+
// WFS Service API Stubs
|
|
99
|
+
/** Get Capabilities */
|
|
100
|
+
async getCapabilities(wmsParameters, vendorParameters) {
|
|
101
|
+
const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
102
|
+
const response = await this.fetch(url);
|
|
103
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
104
|
+
this._checkResponse(response, arrayBuffer);
|
|
105
|
+
const capabilities = await WFSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);
|
|
106
|
+
this.capabilities = capabilities;
|
|
107
|
+
return capabilities;
|
|
108
|
+
}
|
|
109
|
+
/** Get a map image *
|
|
110
|
+
async getMap(
|
|
111
|
+
wmsParameters: WFSGetMapParameters,
|
|
112
|
+
vendorParameters?: Record<string, unknown>
|
|
113
|
+
): Promise<ImageType> {
|
|
114
|
+
const url = this.getMapURL(wmsParameters, vendorParameters);
|
|
115
|
+
const response = await this.fetch(url);
|
|
116
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
117
|
+
this._checkResponse(response, arrayBuffer);
|
|
118
|
+
try {
|
|
119
|
+
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
120
|
+
} catch {
|
|
121
|
+
throw this._parseError(arrayBuffer);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Get Feature Info for a coordinate *
|
|
126
|
+
async getFeatureInfo(
|
|
127
|
+
wmsParameters: WFSGetFeatureInfoParameters,
|
|
128
|
+
vendorParameters?: Record<string, unknown>
|
|
129
|
+
): Promise<WFSFeatureInfo> {
|
|
130
|
+
const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
|
|
131
|
+
const response = await this.fetch(url);
|
|
132
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
133
|
+
this._checkResponse(response, arrayBuffer);
|
|
134
|
+
return await WFSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Get Feature Info for a coordinate *
|
|
138
|
+
async getFeatureInfoText(
|
|
139
|
+
wmsParameters: WFSGetFeatureInfoParameters,
|
|
140
|
+
vendorParameters?: Record<string, unknown>
|
|
141
|
+
): Promise<string> {
|
|
142
|
+
const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
|
|
143
|
+
const response = await this.fetch(url);
|
|
144
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
145
|
+
this._checkResponse(response, arrayBuffer);
|
|
146
|
+
return new TextDecoder().decode(arrayBuffer);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Get more information about a layer *
|
|
150
|
+
async describeLayer(
|
|
151
|
+
wmsParameters: WFSDescribeLayerParameters,
|
|
152
|
+
vendorParameters?: Record<string, unknown>
|
|
153
|
+
): Promise<WFSLayerDescription> {
|
|
154
|
+
const url = this.describeLayerURL(wmsParameters, vendorParameters);
|
|
155
|
+
const response = await this.fetch(url);
|
|
156
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
157
|
+
this._checkResponse(response, arrayBuffer);
|
|
158
|
+
return await WFSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Get an image with a semantic legend *
|
|
162
|
+
async getLegendGraphic(
|
|
163
|
+
wmsParameters: WFSGetLegendGraphicParameters,
|
|
164
|
+
vendorParameters?: Record<string, unknown>
|
|
165
|
+
): Promise<ImageType> {
|
|
166
|
+
const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);
|
|
167
|
+
const response = await this.fetch(url);
|
|
168
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
169
|
+
this._checkResponse(response, arrayBuffer);
|
|
170
|
+
try {
|
|
171
|
+
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
172
|
+
} catch {
|
|
173
|
+
throw this._parseError(arrayBuffer);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
*/
|
|
177
|
+
// Typed URL creators
|
|
178
|
+
// For applications that want full control of fetching and parsing
|
|
179
|
+
/** Generate a URL for the GetCapabilities request */
|
|
180
|
+
getCapabilitiesURL(wmsParameters, vendorParameters) {
|
|
181
|
+
// @ts-expect-error
|
|
182
|
+
const options = {
|
|
183
|
+
// version: this.wmsParameters.version,
|
|
184
|
+
...wmsParameters
|
|
185
|
+
};
|
|
186
|
+
return this._getWFSUrl('GetCapabilities', options, vendorParameters);
|
|
187
|
+
}
|
|
188
|
+
/** Generate a URL for the GetMap request */
|
|
189
|
+
getMapURL(wmsParameters, vendorParameters) {
|
|
190
|
+
wmsParameters = this._getWFS130Parameters(wmsParameters);
|
|
191
|
+
// @ts-expect-error
|
|
192
|
+
const options = {
|
|
193
|
+
// version: this.wmsParameters.version,
|
|
194
|
+
// format: this.wmsParameters.format,
|
|
195
|
+
// transparent: this.wmsParameters.transparent,
|
|
196
|
+
// time: this.wmsParameters.time,
|
|
197
|
+
// elevation: this.wmsParameters.elevation,
|
|
198
|
+
// layers: this.wmsParameters.layers,
|
|
199
|
+
// styles: this.wmsParameters.styles,
|
|
200
|
+
// crs: this.wmsParameters.crs,
|
|
201
|
+
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
202
|
+
// width: 1200,
|
|
203
|
+
// height: 900,
|
|
204
|
+
...wmsParameters
|
|
205
|
+
};
|
|
206
|
+
return this._getWFSUrl('GetMap', options, vendorParameters);
|
|
207
|
+
}
|
|
208
|
+
/** Generate a URL for the GetFeatureInfo request */
|
|
209
|
+
getFeatureInfoURL(wmsParameters, vendorParameters) {
|
|
210
|
+
wmsParameters = this._getWFS130Parameters(wmsParameters);
|
|
211
|
+
// Replace the GetImage `boundingBox` parameter with the WFS flat `bbox` parameter.
|
|
212
|
+
const { boundingBox, bbox } = wmsParameters;
|
|
213
|
+
wmsParameters.bbox = boundingBox ? [...boundingBox[0], ...boundingBox[1]] : bbox;
|
|
214
|
+
// @ts-expect-error
|
|
215
|
+
const options = {
|
|
216
|
+
// version: this.wmsParameters.version,
|
|
217
|
+
// // query_layers: [],
|
|
218
|
+
// // format: this.wmsParameters.format,
|
|
219
|
+
// info_format: this.wmsParameters.info_format,
|
|
220
|
+
// layers: this.wmsParameters.layers,
|
|
221
|
+
// query_layers: this.wmsParameters.query_layers,
|
|
222
|
+
// styles: this.wmsParameters.styles,
|
|
223
|
+
// crs: this.wmsParameters.crs,
|
|
224
|
+
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
225
|
+
// width: 1200,
|
|
226
|
+
// height: 900,
|
|
227
|
+
// x: undefined!,
|
|
228
|
+
// y: undefined!,
|
|
229
|
+
...wmsParameters
|
|
230
|
+
};
|
|
231
|
+
return this._getWFSUrl('GetFeatureInfo', options, vendorParameters);
|
|
232
|
+
}
|
|
233
|
+
/** Generate a URL for the GetFeatureInfo request */
|
|
234
|
+
describeLayerURL(wmsParameters, vendorParameters) {
|
|
235
|
+
// @ts-expect-error
|
|
236
|
+
const options = {
|
|
237
|
+
// version: this.wmsParameters.version,
|
|
238
|
+
...wmsParameters
|
|
239
|
+
};
|
|
240
|
+
return this._getWFSUrl('DescribeLayer', options, vendorParameters);
|
|
241
|
+
}
|
|
242
|
+
getLegendGraphicURL(wmsParameters, vendorParameters) {
|
|
243
|
+
// @ts-expect-error
|
|
244
|
+
const options = {
|
|
245
|
+
// version: this.wmsParameters.version,
|
|
246
|
+
// format?
|
|
247
|
+
...wmsParameters
|
|
248
|
+
};
|
|
249
|
+
return this._getWFSUrl('GetLegendGraphic', options, vendorParameters);
|
|
250
|
+
}
|
|
251
|
+
// INTERNAL METHODS
|
|
252
|
+
_parseWFSUrl(url) {
|
|
253
|
+
const [baseUrl, search] = url.split('?');
|
|
254
|
+
const searchParams = search.split('&');
|
|
255
|
+
const parameters = {};
|
|
256
|
+
for (const parameter of searchParams) {
|
|
257
|
+
const [key, value] = parameter.split('=');
|
|
258
|
+
parameters[key] = value;
|
|
259
|
+
}
|
|
260
|
+
return { url: baseUrl, parameters };
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Generate a URL with parameters
|
|
264
|
+
* @note case _getWFSUrl may need to be overridden to handle certain backends?
|
|
265
|
+
* @note at the moment, only URLs with parameters are supported (no XML payloads)
|
|
266
|
+
* */
|
|
267
|
+
_getWFSUrl(request, wmsParameters, vendorParameters) {
|
|
268
|
+
let url = this.url;
|
|
269
|
+
let first = true;
|
|
270
|
+
// Add any vendor searchParams
|
|
271
|
+
const allParameters = {
|
|
272
|
+
service: 'WFS',
|
|
273
|
+
version: wmsParameters.version,
|
|
274
|
+
request,
|
|
275
|
+
...wmsParameters,
|
|
276
|
+
...this.vendorParameters,
|
|
277
|
+
...vendorParameters
|
|
278
|
+
};
|
|
279
|
+
// Encode the keys
|
|
280
|
+
const IGNORE_EMPTY_KEYS = ['transparent', 'time', 'elevation'];
|
|
281
|
+
for (const [key, value] of Object.entries(allParameters)) {
|
|
282
|
+
// hack to preserve test cases. Not super clear if keys should be included when values are undefined
|
|
283
|
+
if (!IGNORE_EMPTY_KEYS.includes(key) || value) {
|
|
284
|
+
url += first ? '?' : '&';
|
|
285
|
+
first = false;
|
|
286
|
+
url += this._getURLParameter(key, value, wmsParameters);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return encodeURI(url);
|
|
290
|
+
}
|
|
291
|
+
_getWFS130Parameters(wmsParameters) {
|
|
292
|
+
const newParameters = { ...wmsParameters };
|
|
293
|
+
if (newParameters.srs) {
|
|
294
|
+
newParameters.crs = newParameters.crs || newParameters.srs;
|
|
295
|
+
delete newParameters.srs;
|
|
296
|
+
}
|
|
297
|
+
return newParameters;
|
|
298
|
+
}
|
|
299
|
+
// eslint-disable-next-line complexity
|
|
300
|
+
_getURLParameter(key, value, wmsParameters) {
|
|
301
|
+
// Substitute by key
|
|
302
|
+
switch (key) {
|
|
303
|
+
case 'crs':
|
|
304
|
+
// CRS was called SRS before WFS 1.3.0
|
|
305
|
+
if (wmsParameters.version !== '1.3.0') {
|
|
306
|
+
key = 'srs';
|
|
307
|
+
// } else if (this.substituteCRS84 && value === 'EPSG:4326') {
|
|
308
|
+
// /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */
|
|
309
|
+
// // Substitute by value
|
|
310
|
+
// value = 'CRS:84';
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
case 'srs':
|
|
314
|
+
// CRS was called SRS before WFS 1.3.0
|
|
315
|
+
if (wmsParameters.version === '1.3.0') {
|
|
316
|
+
key = 'crs';
|
|
317
|
+
}
|
|
318
|
+
break;
|
|
319
|
+
case 'bbox':
|
|
320
|
+
// Coordinate order is flipped for certain CRS in WFS 1.3.0
|
|
321
|
+
const bbox = this._flipBoundingBox(value, wmsParameters);
|
|
322
|
+
if (bbox) {
|
|
323
|
+
value = bbox;
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case 'x':
|
|
327
|
+
// i is the parameter used in WFS 1.3
|
|
328
|
+
// TODO - change parameter to `i` and convert to `x` if not 1.3
|
|
329
|
+
if (wmsParameters.version === '1.3.0') {
|
|
330
|
+
key = 'i';
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
case 'y':
|
|
334
|
+
// j is the parameter used in WFS 1.3
|
|
335
|
+
// TODO - change parameter to `j` and convert to `y` if not 1.3
|
|
336
|
+
if (wmsParameters.version === '1.3.0') {
|
|
337
|
+
key = 'j';
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
default:
|
|
341
|
+
// do nothing
|
|
342
|
+
}
|
|
343
|
+
key = key.toUpperCase();
|
|
344
|
+
return Array.isArray(value)
|
|
345
|
+
? `${key}=${value.join(',')}`
|
|
346
|
+
: `${key}=${value ? String(value) : ''}`;
|
|
347
|
+
}
|
|
348
|
+
/** Coordinate order is flipped for certain CRS in WFS 1.3.0 */
|
|
349
|
+
_flipBoundingBox(bboxValue, wmsParameters) {
|
|
350
|
+
// Sanity checks
|
|
351
|
+
if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
const flipCoordinates = false;
|
|
355
|
+
// // Only affects WFS 1.3.0
|
|
356
|
+
// wmsParameters.version === '1.3.0' &&
|
|
357
|
+
// // Flip if we are dealing with a CRS that was flipped in 1.3.0
|
|
358
|
+
// this.flipCRS.includes(wmsParameters.crs || '') &&
|
|
359
|
+
// // Don't flip if we are substituting EPSG:4326 with CRS:84
|
|
360
|
+
// !(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');
|
|
361
|
+
const bbox = bboxValue;
|
|
362
|
+
return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;
|
|
363
|
+
}
|
|
364
|
+
/** Fetches an array buffer and checks the response (boilerplate reduction) */
|
|
365
|
+
async _fetchArrayBuffer(url) {
|
|
366
|
+
const response = await this.fetch(url);
|
|
367
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
368
|
+
this._checkResponse(response, arrayBuffer);
|
|
369
|
+
return arrayBuffer;
|
|
370
|
+
}
|
|
371
|
+
/** Checks for and parses a WFS XML formatted ServiceError and throws an exception */
|
|
372
|
+
_checkResponse(response, arrayBuffer) {
|
|
373
|
+
const contentType = response.headers['content-type'];
|
|
374
|
+
if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
375
|
+
// We want error responses to throw exceptions, the WMSErrorLoader can do this
|
|
376
|
+
const loadOptions = mergeLoaderOptions(this.loadOptions, {
|
|
377
|
+
wms: { throwOnError: true }
|
|
378
|
+
});
|
|
379
|
+
const error = WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);
|
|
380
|
+
throw new Error(error);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/** Error situation detected */
|
|
384
|
+
_parseError(arrayBuffer) {
|
|
385
|
+
const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);
|
|
386
|
+
return new Error(error);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
import type { ImageType } from '@loaders.gl/images';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ImageSourceMetadata, GetImageParameters } from '@loaders.gl/loader-utils';
|
|
3
|
+
import type { ImageSourceProps } from '@loaders.gl/loader-utils';
|
|
3
4
|
import { ImageSource } from '@loaders.gl/loader-utils';
|
|
4
|
-
import type { ImageServiceProps } from "../../lib/services/image-service.js";
|
|
5
5
|
import type { WMSCapabilities } from "../../wms-capabilities-loader.js";
|
|
6
6
|
import type { WMSFeatureInfo } from "../../wip/wms-feature-info-loader.js";
|
|
7
7
|
import type { WMSLayerDescription } from "../../wip/wms-layer-description-loader.js";
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const WMSSource: {
|
|
9
|
+
readonly name: "Web Map Service (OGC WMS)";
|
|
10
|
+
readonly id: "wms";
|
|
11
|
+
readonly module: "wms";
|
|
12
|
+
readonly version: "0.0.0";
|
|
13
|
+
readonly extensions: [];
|
|
14
|
+
readonly mimeTypes: [];
|
|
15
|
+
readonly options: {
|
|
16
|
+
readonly wms: {};
|
|
17
|
+
};
|
|
18
|
+
readonly type: "wms";
|
|
19
|
+
readonly fromUrl: true;
|
|
20
|
+
readonly fromBlob: false;
|
|
21
|
+
readonly testURL: (url: string) => boolean;
|
|
22
|
+
readonly createDataSource: (url: string | Blob, props: WMSImageSourceProps) => WMSImageSource;
|
|
23
|
+
};
|
|
24
|
+
/** Properties for creating a enw WMS service */
|
|
25
|
+
export type WMSImageSourceProps = ImageSourceProps & {
|
|
26
|
+
/** @deprecated Use props.wms.substituteCRS84 */
|
|
27
|
+
substituteCRS84?: boolean;
|
|
28
|
+
/** @deprecated Use props.wms.wmsParameters */
|
|
29
|
+
wmsParameters?: WMSParameters;
|
|
30
|
+
/** @deprecated Use props.wms.vendorParameters */
|
|
31
|
+
vendorParameters?: Record<string, unknown>;
|
|
32
|
+
wms?: {
|
|
33
|
+
/** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */
|
|
34
|
+
substituteCRS84?: boolean;
|
|
35
|
+
/** Default WMS parameters. If not provided here, must be provided in the various request */
|
|
36
|
+
wmsParameters?: WMSParameters;
|
|
37
|
+
/** Any additional service specific parameters */
|
|
38
|
+
vendorParameters?: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
9
41
|
/**
|
|
10
42
|
* "Static" WMS parameters (not viewport or selected pixel dependent)
|
|
11
|
-
* These can be provided as defaults in the
|
|
43
|
+
* These can be provided as defaults in the WMSImageSource constructor
|
|
12
44
|
*/
|
|
13
45
|
export type WMSParameters = {
|
|
14
46
|
/** WMS version (all requests) */
|
|
@@ -25,7 +57,7 @@ export type WMSParameters = {
|
|
|
25
57
|
info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';
|
|
26
58
|
/** Styling - Not yet supported */
|
|
27
59
|
styles?: unknown;
|
|
28
|
-
/** Any additional parameters specific to this
|
|
60
|
+
/** Any additional parameters specific to this WMSImageSource (GetMap) */
|
|
29
61
|
transparent?: boolean;
|
|
30
62
|
/** If layer supports time dimension */
|
|
31
63
|
time?: string;
|
|
@@ -116,25 +148,14 @@ export type WMSGetLegendGraphicParameters = {
|
|
|
116
148
|
/** In case the endpoint supports multiple WMS versions */
|
|
117
149
|
version?: '1.3.0' | '1.1.1';
|
|
118
150
|
};
|
|
119
|
-
/** Properties for creating a enw WMS service */
|
|
120
|
-
export type WMSSourceProps = ImageServiceProps & {
|
|
121
|
-
/** Base URL to the service */
|
|
122
|
-
url: string;
|
|
123
|
-
/** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */
|
|
124
|
-
substituteCRS84?: boolean;
|
|
125
|
-
/** Default WMS parameters. If not provided here, must be provided in the various request */
|
|
126
|
-
wmsParameters?: WMSParameters;
|
|
127
|
-
/** Any additional service specific parameters */
|
|
128
|
-
vendorParameters?: Record<string, unknown>;
|
|
129
|
-
};
|
|
130
151
|
/**
|
|
131
|
-
* The
|
|
152
|
+
* The WMSImageSource class provides
|
|
132
153
|
* - provides type safe methods to form URLs to a WMS service
|
|
133
154
|
* - provides type safe methods to query and parse results (and errors) from a WMS service
|
|
134
|
-
* - implements the
|
|
155
|
+
* - implements the ImageSource interface
|
|
135
156
|
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
136
157
|
*/
|
|
137
|
-
export declare class
|
|
158
|
+
export declare class WMSImageSource extends ImageSource<WMSImageSourceProps> {
|
|
138
159
|
/** Base URL to the service */
|
|
139
160
|
readonly url: string;
|
|
140
161
|
readonly data: string;
|
|
@@ -147,8 +168,8 @@ export declare class WMSSource extends ImageSource<WMSSourceProps> {
|
|
|
147
168
|
/** Default static vendor parameters */
|
|
148
169
|
vendorParameters?: Record<string, unknown>;
|
|
149
170
|
capabilities: WMSCapabilities | null;
|
|
150
|
-
/** Create a
|
|
151
|
-
constructor(props:
|
|
171
|
+
/** Create a WMSImageSource */
|
|
172
|
+
constructor(url: string, props: WMSImageSourceProps);
|
|
152
173
|
getMetadata(): Promise<ImageSourceMetadata>;
|
|
153
174
|
getImage(parameters: GetImageParameters): Promise<ImageType>;
|
|
154
175
|
normalizeMetadata(capabilities: WMSCapabilities): ImageSourceMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wms-service.d.ts","sourceRoot":"","sources":["../../../src/services/ogc/wms-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAIlD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"wms-service.d.ts","sourceRoot":"","sources":["../../../src/services/ogc/wms-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAIlD,OAAO,KAAK,EAAS,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC9F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAC,eAAe,EAAC,yCAAsC;AACnE,OAAO,KAAK,EAAC,cAAc,EAAC,6CAA0C;AACtE,OAAO,KAAK,EAAC,mBAAmB,EAAC,kDAA+C;AAShF,eAAO,MAAM,SAAS;;;;;;;;;;;;;4BAgBL,MAAM,KAAG,OAAO;2DACA,mBAAmB;CACY,CAAC;AAEjE,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG;IACnD,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8CAA8C;IAC9C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,GAAG,CAAC,EAAE;QAEJ,6DAA6D;QAC7D,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,4FAA4F;QAC5F,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,iDAAiD;QACjD,gBAAgB,CAAC,EAAE,MAAM,CA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ities-loader.js";
|
|
|
8
8
|
import { WMSFeatureInfoLoader } from "../../wip/wms-feature-info-loader.js";
|
|
9
9
|
import { WMSLayerDescriptionLoader } from "../../wip/wms-layer-description-loader.js";
|
|
10
10
|
import { WMSErrorLoader } from "../../wms-error-loader.js";
|
|
11
|
-
export const
|
|
11
|
+
export const WMSSource = {
|
|
12
|
+
name: 'Web Map Service (OGC WMS)',
|
|
13
|
+
id: 'wms',
|
|
14
|
+
module: 'wms',
|
|
15
|
+
version: '0.0.0',
|
|
16
|
+
extensions: [],
|
|
17
|
+
mimeTypes: [],
|
|
18
|
+
options: {
|
|
19
|
+
wms: {
|
|
20
|
+
// TODO - add options here
|
|
21
|
+
}
|
|
22
|
+
},
|
|
12
23
|
type: 'wms',
|
|
24
|
+
fromUrl: true,
|
|
25
|
+
fromBlob: false,
|
|
13
26
|
testURL: (url) => url.toLowerCase().includes('wms'),
|
|
14
|
-
|
|
27
|
+
createDataSource: (url, props) => new WMSImageSource(url, props)
|
|
15
28
|
};
|
|
29
|
+
//
|
|
16
30
|
/**
|
|
17
|
-
* The
|
|
31
|
+
* The WMSImageSource class provides
|
|
18
32
|
* - provides type safe methods to form URLs to a WMS service
|
|
19
33
|
* - provides type safe methods to query and parse results (and errors) from a WMS service
|
|
20
|
-
* - implements the
|
|
34
|
+
* - implements the ImageSource interface
|
|
21
35
|
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
22
36
|
*/
|
|
23
|
-
export class
|
|
37
|
+
export class WMSImageSource extends ImageSource {
|
|
24
38
|
/** Base URL to the service */
|
|
25
39
|
url;
|
|
26
40
|
data;
|
|
@@ -33,15 +47,15 @@ export class WMSSource extends ImageSource {
|
|
|
33
47
|
/** Default static vendor parameters */
|
|
34
48
|
vendorParameters;
|
|
35
49
|
capabilities = null;
|
|
36
|
-
/** Create a
|
|
37
|
-
constructor(props) {
|
|
50
|
+
/** Create a WMSImageSource */
|
|
51
|
+
constructor(url, props) {
|
|
38
52
|
super(props);
|
|
39
53
|
// TODO - defaults such as version, layers etc could be extracted from a base URL with parameters
|
|
40
54
|
// This would make pasting in any WMS URL more likely to make this class just work.
|
|
41
55
|
// const {baseUrl, parameters} = this._parseWMSUrl(props.url);
|
|
42
|
-
this.url =
|
|
43
|
-
this.data =
|
|
44
|
-
this.substituteCRS84 = props.substituteCRS84 ?? false;
|
|
56
|
+
this.url = url;
|
|
57
|
+
this.data = url;
|
|
58
|
+
this.substituteCRS84 = props.wms?.substituteCRS84 ?? props.substituteCRS84 ?? false;
|
|
45
59
|
this.flipCRS = ['EPSG:4326'];
|
|
46
60
|
this.wmsParameters = {
|
|
47
61
|
layers: undefined,
|
|
@@ -54,11 +68,12 @@ export class WMSSource extends ImageSource {
|
|
|
54
68
|
transparent: undefined,
|
|
55
69
|
time: undefined,
|
|
56
70
|
elevation: undefined,
|
|
57
|
-
...props.wmsParameters
|
|
71
|
+
...props.wmsParameters, // deprecated
|
|
72
|
+
...props.wms?.wmsParameters
|
|
58
73
|
};
|
|
59
|
-
this.vendorParameters = props.vendorParameters || {};
|
|
74
|
+
this.vendorParameters = props.wms?.vendorParameters || props.vendorParameters || {};
|
|
60
75
|
}
|
|
61
|
-
//
|
|
76
|
+
// ImageSource implementation
|
|
62
77
|
async getMetadata() {
|
|
63
78
|
const capabilities = await this.getCapabilities();
|
|
64
79
|
return this.normalizeMetadata(capabilities);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
-
import type { WFSCapabilities } from "./lib/wfs/parse-wfs-capabilities.js";
|
|
2
|
+
import type { WFSCapabilities } from "./lib/parsers/wfs/parse-wfs-capabilities.js";
|
|
3
3
|
export type { WFSCapabilities };
|
|
4
4
|
export type WFSLoaderOptions = LoaderOptions & {
|
|
5
5
|
wfs?: {};
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Loader for the response to the WFS GetCapability request
|
|
9
|
+
* @deprecated Warning: this loader is still experimental and incomplete
|
|
9
10
|
*/
|
|
10
11
|
export declare const WFSCapabilitiesLoader: {
|
|
11
12
|
readonly dataType: WFSCapabilities;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfs-capabilities-loader.d.ts","sourceRoot":"","sources":["../src/wfs-capabilities-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAC,eAAe,EAAC,oDAAiD;AAO9E,YAAY,EAAC,eAAe,EAAC,CAAC;AAE9B,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,EAAE,CAAC;CACV,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;kCAgBL,WAAW,YAAY,gBAAgB;mCAE5C,MAAM,YAAY,gBAAgB;CACqB,CAAC;AAEhF,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG1C;AAED,eAAO,MAAM,+BAA+B,EAAE,gBAAwC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// loaders.gl, MIT license
|
|
2
|
-
import { parseWFSCapabilities } from "./lib/wfs/parse-wfs-capabilities.js";
|
|
2
|
+
import { parseWFSCapabilities } from "./lib/parsers/wfs/parse-wfs-capabilities.js";
|
|
3
3
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
4
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
5
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
5
|
+
const VERSION = typeof "4.3.0-alpha.2" !== 'undefined' ? "4.3.0-alpha.2" : 'latest';
|
|
6
6
|
/**
|
|
7
7
|
* Loader for the response to the WFS GetCapability request
|
|
8
|
+
* @deprecated Warning: this loader is still experimental and incomplete
|
|
8
9
|
*/
|
|
9
10
|
export const WFSCapabilitiesLoader = {
|
|
10
11
|
dataType: null,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { parseWCSCapabilities } from "./lib/wcs/parse-wcs-capabilities.js";
|
|
3
3
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
4
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
5
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
5
|
+
const VERSION = typeof "4.3.0-alpha.2" !== 'undefined' ? "4.3.0-alpha.2" : 'latest';
|
|
6
6
|
/**
|
|
7
7
|
* Loader for the response to the WCS GetCapability request
|
|
8
8
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { parseWMTSCapabilities } from "./lib/wmts/parse-wmts-capabilities.js";
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
6
|
+
const VERSION = typeof "4.3.0-alpha.2" !== 'undefined' ? "4.3.0-alpha.2" : 'latest';
|
|
7
7
|
/**
|
|
8
8
|
* Loader for the response to the WMTS GetCapability request
|
|
9
9
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { parseWMSCapabilities } from "./lib/parsers/wms/parse-wms-capabilities.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.3.0-alpha.2" !== 'undefined' ? "4.3.0-alpha.2" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Loader for the response to the WMS GetCapability request
|
|
10
10
|
*/
|
package/dist/wms-error-loader.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { parseWMSError } from "./lib/parsers/wms/parse-wms-error.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.3.0-alpha.2" !== 'undefined' ? "4.3.0-alpha.2" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Loader for the response to the WMS GetCapability request
|
|
10
10
|
*/
|