@loaders.gl/wms 3.4.0-alpha.3 → 4.0.0-alpha.6
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/dist.min.js +133 -80
- package/dist/es5/csw-capabilities-loader.js +1 -1
- package/dist/es5/csw-capabilities-loader.js.map +1 -1
- package/dist/es5/csw-domain-loader.js +1 -1
- package/dist/es5/csw-domain-loader.js.map +1 -1
- package/dist/es5/csw-records-loader.js +1 -1
- package/dist/es5/csw-records-loader.js.map +1 -1
- package/dist/es5/gml-loader.js +1 -1
- package/dist/es5/gml-loader.js.map +1 -1
- package/dist/es5/lerc-loader.js +1 -1
- package/dist/es5/lerc-loader.js.map +1 -1
- package/dist/es5/lib/create-image-source.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js +2 -1
- package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-domain.js +2 -1
- package/dist/es5/lib/parsers/csw/parse-csw-domain.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-records.js +6 -5
- package/dist/es5/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/es5/lib/parsers/gml/deep-strict-equal.js.map +1 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js +2 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js +2 -1
- package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-features.js +2 -2
- package/dist/es5/lib/parsers/wms/parse-wms-features.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js +2 -1
- package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
- package/dist/es5/lib/parsers/xml/parse-xml-helpers.js.map +1 -1
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js +1 -6
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/es5/lib/services/arcgis/arcgis-server.js.map +1 -1
- package/dist/es5/lib/services/generic/image-service.js +1 -6
- package/dist/es5/lib/services/generic/image-service.js.map +1 -1
- package/dist/es5/lib/services/ogc/csw-service.js +0 -2
- package/dist/es5/lib/services/ogc/csw-service.js.map +1 -1
- package/dist/es5/lib/services/ogc/wms-service.js +62 -20
- package/dist/es5/lib/services/ogc/wms-service.js.map +1 -1
- package/dist/es5/lib/sources/data-source.js +36 -8
- package/dist/es5/lib/sources/data-source.js.map +1 -1
- package/dist/es5/lib/sources/image-source.js.map +1 -1
- package/dist/es5/lib/sources/tile-source.js.map +1 -1
- package/dist/es5/lib/wfs/parse-wfs.js +41 -0
- package/dist/es5/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/es5/lib/wmts/parse-wmts.js +41 -0
- package/dist/es5/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/es5/wip/arcgis-feature-service.js.map +1 -1
- package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js +2 -1
- package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
- package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js +2 -1
- package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
- package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js +2 -1
- package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -1
- package/dist/es5/wip/wms-feature-info-loader.js.map +1 -1
- package/dist/es5/wip/wms-layer-description-loader.js.map +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-capabilities-loader.js +1 -1
- package/dist/es5/wms-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-error-loader.js +1 -1
- package/dist/es5/wms-error-loader.js.map +1 -1
- package/dist/esm/csw-capabilities-loader.js +1 -1
- package/dist/esm/csw-capabilities-loader.js.map +1 -1
- package/dist/esm/csw-domain-loader.js +1 -1
- package/dist/esm/csw-domain-loader.js.map +1 -1
- package/dist/esm/csw-records-loader.js +1 -1
- package/dist/esm/csw-records-loader.js.map +1 -1
- package/dist/esm/gml-loader.js +1 -1
- package/dist/esm/gml-loader.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -1
- package/dist/esm/lerc-loader.js.map +1 -1
- package/dist/esm/lib/create-image-source.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js +2 -1
- package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-domain.js +2 -1
- package/dist/esm/lib/parsers/csw/parse-csw-domain.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-records.js +7 -6
- package/dist/esm/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/esm/lib/parsers/gml/deep-strict-equal.js.map +1 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js +2 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js +2 -1
- package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-features.js +2 -2
- package/dist/esm/lib/parsers/wms/parse-wms-features.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js +2 -1
- package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
- package/dist/esm/lib/parsers/xml/parse-xml-helpers.js.map +1 -1
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js +0 -2
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/esm/lib/services/arcgis/arcgis-server.js.map +1 -1
- package/dist/esm/lib/services/generic/image-service.js +0 -2
- package/dist/esm/lib/services/generic/image-service.js.map +1 -1
- package/dist/esm/lib/services/ogc/csw-service.js +0 -2
- package/dist/esm/lib/services/ogc/csw-service.js.map +1 -1
- package/dist/esm/lib/services/ogc/wms-service.js +54 -14
- package/dist/esm/lib/services/ogc/wms-service.js.map +1 -1
- package/dist/esm/lib/sources/data-source.js +20 -0
- package/dist/esm/lib/sources/data-source.js.map +1 -1
- package/dist/esm/lib/sources/image-source.js.map +1 -1
- package/dist/esm/lib/sources/tile-source.js.map +1 -1
- package/dist/esm/lib/wfs/parse-wfs.js +28 -0
- package/dist/esm/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/esm/lib/wmts/parse-wmts.js +28 -0
- package/dist/esm/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js +2 -1
- package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
- package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js +2 -1
- package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
- package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js +2 -1
- package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -1
- package/dist/esm/wip/wms-feature-info-loader.js.map +1 -1
- package/dist/esm/wip/wms-layer-description-loader.js.map +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-capabilities-loader.js +1 -1
- package/dist/esm/wms-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-error-loader.js +1 -1
- package/dist/esm/wms-error-loader.js.map +1 -1
- package/dist/lib/create-image-source.d.ts +1 -1
- package/dist/lib/create-image-source.d.ts.map +1 -1
- package/dist/lib/parsers/csw/parse-csw-capabilities.js +1 -1
- package/dist/lib/parsers/csw/parse-csw-domain.js +1 -1
- package/dist/lib/parsers/csw/parse-csw-records.js +6 -6
- package/dist/lib/parsers/csw/parse-exception-report.js +1 -1
- package/dist/lib/parsers/gml/parse-gml.js +1 -1
- package/dist/lib/parsers/wms/parse-wms-capabilities.js +2 -1
- package/dist/lib/parsers/wms/parse-wms-features.js +1 -1
- package/dist/lib/parsers/wms/parse-wms-layer-description.js +1 -1
- package/dist/lib/services/arcgis/arcgis-image-service.d.ts +1 -2
- package/dist/lib/services/arcgis/arcgis-image-service.d.ts.map +1 -1
- package/dist/lib/services/arcgis/arcgis-image-service.js +0 -1
- package/dist/lib/services/generic/image-service.d.ts +2 -3
- package/dist/lib/services/generic/image-service.d.ts.map +1 -1
- package/dist/lib/services/generic/image-service.js +0 -1
- package/dist/lib/services/ogc/csw-service.d.ts +1 -2
- package/dist/lib/services/ogc/csw-service.d.ts.map +1 -1
- package/dist/lib/services/ogc/csw-service.js +0 -1
- package/dist/lib/services/ogc/wms-service.d.ts +84 -43
- package/dist/lib/services/ogc/wms-service.d.ts.map +1 -1
- package/dist/lib/services/ogc/wms-service.js +73 -27
- package/dist/lib/sources/data-source.d.ts +12 -2
- package/dist/lib/sources/data-source.d.ts.map +1 -1
- package/dist/lib/sources/data-source.js +22 -0
- package/dist/lib/sources/image-source.d.ts +6 -6
- package/dist/lib/sources/image-source.d.ts.map +1 -1
- package/dist/lib/sources/tile-source.d.ts +4 -2
- package/dist/lib/sources/tile-source.d.ts.map +1 -1
- package/dist/lib/wfs/parse-wfs.d.ts +7 -0
- package/dist/lib/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/lib/wfs/parse-wfs.js +32 -0
- package/dist/lib/wmts/parse-wmts.d.ts +7 -0
- package/dist/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/lib/wmts/parse-wmts.js +35 -0
- package/dist/wip/lib/wcs/parse-wcs-capabilities.js +1 -1
- package/dist/wip/lib/wfs/parse-wfs-capabilities.js +1 -1
- package/dist/wip/lib/wmts/parse-wmts-capabilities.js +1 -1
- package/package.json +6 -6
- package/src/lib/create-image-source.ts +1 -1
- package/src/lib/parsers/csw/parse-csw-capabilities.ts +1 -1
- package/src/lib/parsers/csw/parse-csw-domain.ts +1 -1
- package/src/lib/parsers/csw/parse-csw-records.ts +6 -6
- package/src/lib/parsers/csw/parse-exception-report.ts +1 -1
- package/src/lib/parsers/gml/parse-gml.ts +1 -1
- package/src/lib/parsers/wms/parse-wms-capabilities.ts +2 -1
- package/src/lib/parsers/wms/parse-wms-features.ts +1 -1
- package/src/lib/parsers/wms/parse-wms-layer-description.ts +1 -1
- package/src/lib/services/arcgis/arcgis-image-service.ts +1 -4
- package/src/lib/services/generic/image-service.ts +2 -5
- package/src/lib/services/ogc/csw-service.ts +1 -3
- package/src/lib/services/ogc/wms-service.ts +165 -60
- package/src/lib/sources/data-source.ts +29 -2
- package/src/lib/sources/image-source.ts +6 -6
- package/src/lib/sources/tile-source.ts +4 -2
- package/src/lib/wfs/parse-wfs.ts +34 -0
- package/src/lib/wmts/parse-wmts.ts +37 -0
- package/src/wip/lib/wcs/parse-wcs-capabilities.ts +1 -1
- package/src/wip/lib/wfs/parse-wfs-capabilities.ts +1 -1
- package/src/wip/lib/wmts/parse-wmts-capabilities.ts +1 -1
- package/dist/es5/lib/services/generic/tile-service.js +0 -2
- package/dist/es5/lib/services/generic/tile-service.js.map +0 -1
- package/dist/esm/lib/services/generic/tile-service.js +0 -2
- package/dist/esm/lib/services/generic/tile-service.js.map +0 -1
- package/dist/lib/services/generic/tile-service.d.ts +0 -1
- package/dist/lib/services/generic/tile-service.d.ts.map +0 -1
- package/dist/lib/services/generic/tile-service.js +0 -1
- package/src/lib/services/generic/tile-service.ts +0 -0
|
@@ -33,8 +33,11 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
33
33
|
// This would make pasting in any WMS URL more likely to make this class just work.
|
|
34
34
|
// const {baseUrl, parameters} = this._parseWMSUrl(props.url);
|
|
35
35
|
this.url = props.url;
|
|
36
|
+
this.substituteCRS84 = props.substituteCRS84 ?? false;
|
|
37
|
+
this.flipCRS = ['EPSG:4326'];
|
|
36
38
|
this.wmsParameters = {
|
|
37
39
|
layers: undefined,
|
|
40
|
+
query_layers: undefined,
|
|
38
41
|
styles: undefined,
|
|
39
42
|
version: '1.3.0',
|
|
40
43
|
crs: 'EPSG:4326',
|
|
@@ -51,10 +54,7 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
51
54
|
return this.normalizeMetadata(capabilities);
|
|
52
55
|
}
|
|
53
56
|
async getImage(parameters) {
|
|
54
|
-
|
|
55
|
-
const wmsParameters = { ...parameters, crs: parameters.srs };
|
|
56
|
-
delete wmsParameters.srs;
|
|
57
|
-
return await this.getMap(wmsParameters);
|
|
57
|
+
return await this.getMap(parameters);
|
|
58
58
|
}
|
|
59
59
|
normalizeMetadata(capabilities) {
|
|
60
60
|
return capabilities;
|
|
@@ -132,16 +132,17 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
132
132
|
}
|
|
133
133
|
/** Generate a URL for the GetMap request */
|
|
134
134
|
getMapURL(wmsParameters, vendorParameters) {
|
|
135
|
+
wmsParameters = this._getWMS130Parameters(wmsParameters);
|
|
135
136
|
const options = {
|
|
136
137
|
version: this.wmsParameters.version,
|
|
137
|
-
|
|
138
|
+
format: this.wmsParameters.format,
|
|
139
|
+
transparent: this.wmsParameters.transparent,
|
|
140
|
+
layers: this.wmsParameters.layers,
|
|
141
|
+
styles: this.wmsParameters.styles,
|
|
142
|
+
crs: this.wmsParameters.crs,
|
|
138
143
|
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
139
144
|
// width: 1200,
|
|
140
145
|
// height: 900,
|
|
141
|
-
styles: this.wmsParameters.styles,
|
|
142
|
-
crs: this.wmsParameters.crs,
|
|
143
|
-
format: this.wmsParameters.format,
|
|
144
|
-
transparent: this.wmsParameters.transparent,
|
|
145
146
|
...wmsParameters
|
|
146
147
|
};
|
|
147
148
|
return this._getWMSUrl('GetMap', options, vendorParameters);
|
|
@@ -150,17 +151,18 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
150
151
|
getFeatureInfoURL(wmsParameters, vendorParameters) {
|
|
151
152
|
const options = {
|
|
152
153
|
version: this.wmsParameters.version,
|
|
153
|
-
//
|
|
154
|
+
// query_layers: [],
|
|
155
|
+
// format: this.wmsParameters.format,
|
|
156
|
+
info_format: this.wmsParameters.info_format,
|
|
157
|
+
layers: this.wmsParameters.layers,
|
|
158
|
+
query_layers: this.wmsParameters.query_layers,
|
|
159
|
+
styles: this.wmsParameters.styles,
|
|
160
|
+
crs: this.wmsParameters.crs,
|
|
154
161
|
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
155
162
|
// width: 1200,
|
|
156
163
|
// height: 900,
|
|
157
164
|
// x: undefined!,
|
|
158
165
|
// y: undefined!,
|
|
159
|
-
// query_layers: [],
|
|
160
|
-
srs: this.wmsParameters.crs,
|
|
161
|
-
format: this.wmsParameters.format,
|
|
162
|
-
info_format: this.wmsParameters.info_format,
|
|
163
|
-
styles: this.wmsParameters.styles,
|
|
164
166
|
...wmsParameters
|
|
165
167
|
};
|
|
166
168
|
return this._getWMSUrl('GetFeatureInfo', options, vendorParameters);
|
|
@@ -215,28 +217,72 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
215
217
|
if (key !== 'transparent' || value) {
|
|
216
218
|
url += first ? '?' : '&';
|
|
217
219
|
first = false;
|
|
218
|
-
url += this.
|
|
220
|
+
url += this._getURLParameter(key, value, wmsParameters);
|
|
219
221
|
}
|
|
220
222
|
}
|
|
221
223
|
return encodeURI(url);
|
|
222
224
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
|
|
225
|
+
_getWMS130Parameters(wmsParameters) {
|
|
226
|
+
const newParameters = { ...wmsParameters };
|
|
227
|
+
if (newParameters.srs) {
|
|
228
|
+
newParameters.crs = newParameters.crs || newParameters.srs;
|
|
229
|
+
delete newParameters.srs;
|
|
230
|
+
}
|
|
231
|
+
return newParameters;
|
|
232
|
+
}
|
|
233
|
+
// eslint-disable-complexity
|
|
234
|
+
_getURLParameter(key, value, wmsParameters) {
|
|
235
|
+
// Substitute by key
|
|
236
|
+
switch (key) {
|
|
237
|
+
case 'crs':
|
|
238
|
+
// CRS was called SRS before WMS 1.3.0
|
|
239
|
+
if (wmsParameters.version !== '1.3.0') {
|
|
240
|
+
key = 'srs';
|
|
241
|
+
}
|
|
242
|
+
else if (this.substituteCRS84 && value === 'EPSG:4326') {
|
|
243
|
+
/** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */
|
|
244
|
+
// Substitute by value
|
|
245
|
+
value = 'CRS:84';
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case 'srs':
|
|
249
|
+
// CRS was called SRS before WMS 1.3.0
|
|
250
|
+
if (wmsParameters.version === '1.3.0') {
|
|
251
|
+
key = 'crs';
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
case 'bbox':
|
|
255
|
+
// Coordinate order is flipped for certain CRS in WMS 1.3.0
|
|
256
|
+
const bbox = this._flipBoundingBox(value, wmsParameters);
|
|
257
|
+
if (bbox) {
|
|
258
|
+
value = bbox;
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
default:
|
|
262
|
+
// do nothing
|
|
227
263
|
}
|
|
228
264
|
key = key.toUpperCase();
|
|
229
|
-
// TODO - in v1.3.0 only, the order of parameters for BBOX depends on whether the CRS definition has flipped axes
|
|
230
|
-
// You will see this in the GetCapabilities request at 1.3.0 - the response should show the flipped axes.
|
|
231
|
-
// BBOX=xmin,ymin,xmax,ymax NON-FLIPPED
|
|
232
|
-
// BBOX=ymin,xmin,ymax,xmax FLIPPED
|
|
233
|
-
// / EPSG:4326 needs to have flipped axes. 4326 1 WGS 84 Latitude North Longitude East
|
|
234
|
-
// In WMS 1.1.1 EPSG:4326 is wrongly defined as having long/lat coordinate axes. In WMS 1.3.0 the correct axes lat/long are used. CRS:84 is defined by OGC as having the same datum as EPSG:4326 (that is the World Geodetic System 1984 datum ~ EPSG::6326) but axis order of long/lat.
|
|
235
|
-
// CRS:84 was introduced with the publication of the WMS 1.3.0 specification, to overcome this issue.
|
|
236
265
|
return Array.isArray(value)
|
|
237
266
|
? `${key}=${value.join(',')}`
|
|
238
267
|
: `${key}=${value ? String(value) : ''}`;
|
|
239
268
|
}
|
|
269
|
+
/** Coordinate order is flipped for certain CRS in WMS 1.3.0 */
|
|
270
|
+
_flipBoundingBox(bboxValue, wmsParameters) {
|
|
271
|
+
// Sanity checks
|
|
272
|
+
if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
const flipCoordinates =
|
|
276
|
+
// Only affects WMS 1.3.0
|
|
277
|
+
wmsParameters.version === '1.3.0' &&
|
|
278
|
+
// Flip if we are dealing with a CRS that was flipped in 1.3.0
|
|
279
|
+
this.flipCRS.includes(wmsParameters.crs || '') &&
|
|
280
|
+
// Don't flip if we are subsituting EPSG:4326 with CRS:84
|
|
281
|
+
!(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');
|
|
282
|
+
const bbox = bboxValue;
|
|
283
|
+
return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;
|
|
284
|
+
}
|
|
285
|
+
/** Fetches an array buffer and checks the response (boilerplate reduction) */
|
|
240
286
|
async _fetchArrayBuffer(url) {
|
|
241
287
|
const response = await this.fetch(url);
|
|
242
288
|
const arrayBuffer = await response.arrayBuffer();
|
|
@@ -4,12 +4,22 @@ export type DataSourceProps = {
|
|
|
4
4
|
loadOptions?: LoaderOptions;
|
|
5
5
|
};
|
|
6
6
|
/** base class of all data sources */
|
|
7
|
-
export declare abstract class DataSource {
|
|
7
|
+
export declare abstract class DataSource<PropsT extends DataSourceProps> {
|
|
8
8
|
/** A resolved fetch function extracted from loadOptions prop */
|
|
9
9
|
fetch: (url: string, options?: RequestInit) => Promise<Response>;
|
|
10
10
|
/** The actual load options, if calling a loaders.gl loader */
|
|
11
11
|
loadOptions: LoaderOptions;
|
|
12
|
-
|
|
12
|
+
_needsRefresh: boolean;
|
|
13
|
+
props: PropsT;
|
|
14
|
+
constructor(props: PropsT);
|
|
15
|
+
setProps(props: PropsT): void;
|
|
16
|
+
/** Mark this data source as needing a refresh (redraw) */
|
|
17
|
+
setNeedsRefresh(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Does this data source need refreshing?
|
|
20
|
+
* @note The specifics of the refresh mechanism depends on type of data source
|
|
21
|
+
*/
|
|
22
|
+
getNeedsRefresh(clear?: boolean): boolean;
|
|
13
23
|
}
|
|
14
24
|
/**
|
|
15
25
|
* Gets the current fetch function from options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,kGAAkG;IAClG,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,CAAC;AAEF,qCAAqC;AACrC,8BAAsB,UAAU;
|
|
1
|
+
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,kGAAkG;IAClG,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,CAAC;AAEF,qCAAqC;AACrC,8BAAsB,UAAU,CAAC,MAAM,SAAS,eAAe;IAC7D,gEAAgE;IAChE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjE,8DAA8D;IAC9D,WAAW,EAAE,aAAa,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAQ;IAE9B,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,MAAM;IAMzB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAMtB,0DAA0D;IAC1D,eAAe,IAAI,IAAI;IAIvB;;;OAGG;IACH,eAAe,CAAC,KAAK,GAAE,OAAc;CAOtC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,aAAa,SAKvC,MAAM,iBAAiB,WAAW,uBAWlD"}
|
|
@@ -5,9 +5,31 @@ exports.getFetchFunction = exports.DataSource = void 0;
|
|
|
5
5
|
/** base class of all data sources */
|
|
6
6
|
class DataSource {
|
|
7
7
|
constructor(props) {
|
|
8
|
+
this._needsRefresh = true;
|
|
9
|
+
this.props = { ...props };
|
|
8
10
|
this.loadOptions = { ...props.loadOptions };
|
|
9
11
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
10
12
|
}
|
|
13
|
+
setProps(props) {
|
|
14
|
+
this.props = Object.assign(this.props, props);
|
|
15
|
+
// TODO - add a shallow compare to avoid setting refresh if no change?
|
|
16
|
+
this.setNeedsRefresh();
|
|
17
|
+
}
|
|
18
|
+
/** Mark this data source as needing a refresh (redraw) */
|
|
19
|
+
setNeedsRefresh() {
|
|
20
|
+
this._needsRefresh = true;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Does this data source need refreshing?
|
|
24
|
+
* @note The specifics of the refresh mechanism depends on type of data source
|
|
25
|
+
*/
|
|
26
|
+
getNeedsRefresh(clear = true) {
|
|
27
|
+
const needsRefresh = this._needsRefresh;
|
|
28
|
+
if (clear) {
|
|
29
|
+
this._needsRefresh = false;
|
|
30
|
+
}
|
|
31
|
+
return needsRefresh;
|
|
32
|
+
}
|
|
11
33
|
}
|
|
12
34
|
exports.DataSource = DataSource;
|
|
13
35
|
/**
|
|
@@ -17,7 +17,7 @@ export type ImageSourceMetadata = {
|
|
|
17
17
|
export type ImageSourceLayer = {
|
|
18
18
|
name?: string;
|
|
19
19
|
title?: string;
|
|
20
|
-
|
|
20
|
+
crs?: string[];
|
|
21
21
|
boundingBox?: [number, number, number, number];
|
|
22
22
|
layers?: ImageSourceLayer[];
|
|
23
23
|
};
|
|
@@ -32,8 +32,8 @@ export type GetImageParameters = {
|
|
|
32
32
|
width: number;
|
|
33
33
|
/** pixels */
|
|
34
34
|
height: number;
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/** crs for the image (not the bounding box) */
|
|
36
|
+
crs?: string;
|
|
37
37
|
/** requested format for the return image */
|
|
38
38
|
format?: 'image/png';
|
|
39
39
|
};
|
|
@@ -52,8 +52,8 @@ export type ImageFormat = {
|
|
|
52
52
|
width: number;
|
|
53
53
|
/** pixels */
|
|
54
54
|
height: number;
|
|
55
|
-
/**
|
|
56
|
-
|
|
55
|
+
/** crs for the image (not the bounding box) */
|
|
56
|
+
crs?: string;
|
|
57
57
|
/** requested format for the return image */
|
|
58
58
|
format?: 'image/png';
|
|
59
59
|
};
|
|
@@ -63,7 +63,7 @@ export type ImageSourceProps = DataSourceProps;
|
|
|
63
63
|
* @note
|
|
64
64
|
* - If geospatial, bounding box is expected to be in web mercator coordinates
|
|
65
65
|
*/
|
|
66
|
-
export declare abstract class ImageSource extends DataSource {
|
|
66
|
+
export declare abstract class ImageSource<PropsT extends ImageSourceProps> extends DataSource<PropsT> {
|
|
67
67
|
abstract getMetadata(): Promise<ImageSourceMetadata>;
|
|
68
68
|
abstract getImage(parameters: GetImageParameters): Promise<ImageType>;
|
|
69
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image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CAAC;IACpD,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;CACtE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImageType } from '@loaders.gl/images';
|
|
2
|
-
import { DataSource } from './data-source';
|
|
2
|
+
import { DataSource, DataSourceProps } from './data-source';
|
|
3
3
|
/**
|
|
4
4
|
* Normalized capabilities of an Image service
|
|
5
5
|
* @example
|
|
@@ -42,13 +42,15 @@ export type GetTileParameters = {
|
|
|
42
42
|
/** requested format for the return image */
|
|
43
43
|
format?: 'image/png';
|
|
44
44
|
};
|
|
45
|
+
type TileSourceProps = DataSourceProps;
|
|
45
46
|
/**
|
|
46
47
|
* MapTileSource - data sources that allow data to be queried by (geospatial) extents
|
|
47
48
|
* @note
|
|
48
49
|
* - If geospatial, bounding box is expected to be in web mercator coordinates
|
|
49
50
|
*/
|
|
50
|
-
export declare abstract class TileSource extends DataSource {
|
|
51
|
+
export declare abstract class TileSource<PropsT extends TileSourceProps> extends DataSource<PropsT> {
|
|
51
52
|
abstract getMetadata(): Promise<TileSourceMetadata>;
|
|
52
53
|
abstract getTile(parameters: GetTileParameters): Promise<ImageType>;
|
|
53
54
|
}
|
|
55
|
+
export {};
|
|
54
56
|
//# sourceMappingURL=tile-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,M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AE,SAAQ,UAAU,CAAC,MAAM,CAAC;IACzF,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CACpE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type WFSCapabilities = {};
|
|
2
|
+
/**
|
|
3
|
+
* Parses a typed data structure from raw XML for `GetCapabilities` response
|
|
4
|
+
* @note Error handlings is fairly weak
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseWFSCapabilities(text: string, options: any): WFSCapabilities;
|
|
7
|
+
//# sourceMappingURL=parse-wfs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-wfs.d.ts","sourceRoot":"","sources":["../../../src/lib/wfs/parse-wfs.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAEjC;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,KAAA,GAAG,eAAe,CAM3E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.parseWFSCapabilities = void 0;
|
|
5
|
+
const xml_1 = require("@loaders.gl/xml");
|
|
6
|
+
/**
|
|
7
|
+
* Parses a typed data structure from raw XML for `GetCapabilities` response
|
|
8
|
+
* @note Error handlings is fairly weak
|
|
9
|
+
*/
|
|
10
|
+
function parseWFSCapabilities(text, options) {
|
|
11
|
+
// Remove namespaces in XML
|
|
12
|
+
options = { ...options, xml: { ...options?.xml, removeNSPrefix: true } };
|
|
13
|
+
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, options);
|
|
14
|
+
const xmlCapabilities = parsedXML.Capabilities || parsedXML;
|
|
15
|
+
return uncapitalizeKeys(xmlCapabilities);
|
|
16
|
+
}
|
|
17
|
+
exports.parseWFSCapabilities = parseWFSCapabilities;
|
|
18
|
+
/** Uncapitalize all keys of an object */
|
|
19
|
+
function uncapitalizeKeys(object) {
|
|
20
|
+
if (object && typeof object === 'object') {
|
|
21
|
+
const newObject = {};
|
|
22
|
+
for (const [key, value] of Object.entries(object)) {
|
|
23
|
+
newObject[uncapitalize(key)] = uncapitalizeKeys(value);
|
|
24
|
+
}
|
|
25
|
+
return newObject;
|
|
26
|
+
}
|
|
27
|
+
return object;
|
|
28
|
+
}
|
|
29
|
+
/** Uncapitalize first letter of a string */
|
|
30
|
+
function uncapitalize(str) {
|
|
31
|
+
return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type WMTSCapabilities = {};
|
|
2
|
+
/**
|
|
3
|
+
* Parses a typed data structure from raw XML for `GetCapabilities` response
|
|
4
|
+
* @note Error handlings is fairly weak
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseWMTSCapabilities(text: string, options: any): WMTSCapabilities;
|
|
7
|
+
//# sourceMappingURL=parse-wmts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-wmts.d.ts","sourceRoot":"","sources":["../../../src/lib/wmts/parse-wmts.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,KAAA,GAAG,gBAAgB,CAM7E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.parseWMTSCapabilities = void 0;
|
|
5
|
+
const xml_1 = require("@loaders.gl/xml");
|
|
6
|
+
/**
|
|
7
|
+
* Parses a typed data structure from raw XML for `GetCapabilities` response
|
|
8
|
+
* @note Error handlings is fairly weak
|
|
9
|
+
*/
|
|
10
|
+
function parseWMTSCapabilities(text, options) {
|
|
11
|
+
// Remove namespaces in XML
|
|
12
|
+
options = { ...options, xml: { ...options?.xml, removeNSPrefix: true } };
|
|
13
|
+
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, options);
|
|
14
|
+
const xmlCapabilities = parsedXML.Capabilities || parsedXML;
|
|
15
|
+
return uncapitalizeKeys(xmlCapabilities);
|
|
16
|
+
}
|
|
17
|
+
exports.parseWMTSCapabilities = parseWMTSCapabilities;
|
|
18
|
+
function uncapitalizeKeys(object) {
|
|
19
|
+
if (object && typeof object === 'object') {
|
|
20
|
+
const newObject = {};
|
|
21
|
+
for (const [key, value] of Object.entries(object)) {
|
|
22
|
+
newObject[uncapitalize(key)] = uncapitalizeKeys(value);
|
|
23
|
+
}
|
|
24
|
+
return newObject;
|
|
25
|
+
}
|
|
26
|
+
return object;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Uncapitalize first letter of a string
|
|
30
|
+
* @param {string} str
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
function uncapitalize(str) {
|
|
34
|
+
return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;
|
|
35
|
+
}
|
|
@@ -8,7 +8,7 @@ const xml_1 = require("@loaders.gl/xml");
|
|
|
8
8
|
* @note Error handlings is fairly weak
|
|
9
9
|
*/
|
|
10
10
|
function parseWCSCapabilities(text, options) {
|
|
11
|
-
const parsedXML = xml_1.XMLLoader.parseTextSync(text, { ...options, xml: { ...options?.xml, removeNSPrefix: true } });
|
|
11
|
+
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, { ...options, xml: { ...options?.xml, removeNSPrefix: true } });
|
|
12
12
|
const xmlCapabilities = parsedXML.Capabilities || parsedXML;
|
|
13
13
|
return xmlCapabilities;
|
|
14
14
|
}
|
|
@@ -8,7 +8,7 @@ const xml_1 = require("@loaders.gl/xml");
|
|
|
8
8
|
* @note Error handlings is fairly weak
|
|
9
9
|
*/
|
|
10
10
|
function parseWFSCapabilities(text, options) {
|
|
11
|
-
const parsedXML = xml_1.XMLLoader.parseTextSync(text, { ...options, xml: {
|
|
11
|
+
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, { ...options, xml: {
|
|
12
12
|
...options?.xml,
|
|
13
13
|
removeNSPrefix: true,
|
|
14
14
|
uncapitalizeKeys: true
|
|
@@ -8,7 +8,7 @@ const xml_1 = require("@loaders.gl/xml");
|
|
|
8
8
|
* @note Error handlings is fairly weak
|
|
9
9
|
*/
|
|
10
10
|
function parseWMTSCapabilities(text, options) {
|
|
11
|
-
const parsedXML = xml_1.XMLLoader.parseTextSync(text, { ...options, xml: {
|
|
11
|
+
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, { ...options, xml: {
|
|
12
12
|
...options?.xml,
|
|
13
13
|
removeNSPrefix: true,
|
|
14
14
|
uncapitalizeKeys: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/wms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
4
4
|
"description": "Framework-independent loaders for the WMS (Web Map Service) standard",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime": "^7.3.1",
|
|
42
|
-
"@loaders.gl/images": "
|
|
43
|
-
"@loaders.gl/loader-utils": "
|
|
44
|
-
"@loaders.gl/schema": "
|
|
45
|
-
"@loaders.gl/xml": "
|
|
42
|
+
"@loaders.gl/images": "4.0.0-alpha.6",
|
|
43
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.6",
|
|
44
|
+
"@loaders.gl/schema": "4.0.0-alpha.6",
|
|
45
|
+
"@loaders.gl/xml": "4.0.0-alpha.6",
|
|
46
46
|
"@turf/rewind": "^5.1.5",
|
|
47
47
|
"deep-strict-equal": "^0.2.0",
|
|
48
48
|
"lerc": "^4.0.1"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"xmldom": "0.6.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "acc1985050dfaa0f1f0c066f8da5bce7454a046c"
|
|
54
54
|
}
|
|
@@ -22,7 +22,7 @@ type ImageSourceProps = ImageServiceProps &
|
|
|
22
22
|
* @param type type of source. if not known, set to 'auto'
|
|
23
23
|
* @returns an ImageSource instance
|
|
24
24
|
*/
|
|
25
|
-
export function createImageSource(props: ImageSourceProps): ImageSource {
|
|
25
|
+
export function createImageSource(props: ImageSourceProps): ImageSource<ImageSourceProps> {
|
|
26
26
|
const {type = 'auto'} = props;
|
|
27
27
|
const serviceType = type === 'auto' ? guessServiceType(props.url) : type;
|
|
28
28
|
switch (serviceType) {
|
|
@@ -87,7 +87,7 @@ export type CSWCapabilities = {
|
|
|
87
87
|
* @note Error handlings is fairly weak
|
|
88
88
|
*/
|
|
89
89
|
export function parseCSWCapabilities(text: string, options?: XMLLoaderOptions): CSWCapabilities {
|
|
90
|
-
const parsedXML = XMLLoader.parseTextSync(text, {
|
|
90
|
+
const parsedXML = XMLLoader.parseTextSync?.(text, {
|
|
91
91
|
...options,
|
|
92
92
|
xml: {
|
|
93
93
|
...options?.xml,
|
|
@@ -20,7 +20,7 @@ export type CSWDomain = {
|
|
|
20
20
|
* @note Error handlings is fairly weak
|
|
21
21
|
*/
|
|
22
22
|
export function parseCSWDomain(text: string, options?: XMLLoaderOptions): CSWDomain {
|
|
23
|
-
const parsedXML = XMLLoader.parseTextSync(text, {
|
|
23
|
+
const parsedXML = XMLLoader.parseTextSync?.(text, {
|
|
24
24
|
...options,
|
|
25
25
|
xml: {
|
|
26
26
|
...options?.xml,
|
|
@@ -35,17 +35,17 @@ export type CSWRecords = {
|
|
|
35
35
|
* @note Error handlings is fairly weak
|
|
36
36
|
*/
|
|
37
37
|
export function parseCSWRecords(text: string, options?: XMLLoaderOptions): CSWRecords {
|
|
38
|
-
const parsedXML = XMLLoader.parseTextSync(text, {
|
|
38
|
+
const parsedXML = XMLLoader.parseTextSync?.(text, {
|
|
39
39
|
...options,
|
|
40
40
|
xml: {
|
|
41
41
|
...options?.xml,
|
|
42
42
|
removeNSPrefix: true,
|
|
43
43
|
uncapitalizeKeys: true,
|
|
44
|
-
arrayPaths: []
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
arrayPaths: [],
|
|
45
|
+
_fastXML: {
|
|
46
|
+
...options?.xml?._fastXML,
|
|
47
|
+
parseAttributeValue: true
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @note Error handlings is fairly weak
|
|
9
9
|
*/
|
|
10
10
|
export function parseExceptionReport(parsedXML: any): void {
|
|
11
|
-
// const parsedXML = XMLLoader.parseTextSync(text, {
|
|
11
|
+
// const parsedXML = XMLLoader.parseTextSync?.(text, {
|
|
12
12
|
// ...options,
|
|
13
13
|
// xml: {
|
|
14
14
|
// ...options?.xml,
|
|
@@ -45,7 +45,7 @@ export type ParseGMLContext = {
|
|
|
45
45
|
*/
|
|
46
46
|
export function parseGML(text: string, options) {
|
|
47
47
|
// GeoJSON | null {
|
|
48
|
-
const parsedXML = XMLLoader.parseTextSync(text, options);
|
|
48
|
+
const parsedXML = XMLLoader.parseTextSync?.(text, options);
|
|
49
49
|
|
|
50
50
|
options = {transformCoords: noTransform, stride: 2, ...options};
|
|
51
51
|
const context = createChildContext(parsedXML, options, {});
|
|
@@ -137,7 +137,7 @@ export function parseWMSCapabilities(
|
|
|
137
137
|
xmlText: string,
|
|
138
138
|
options?: parseWMSCapabilitiesOptions
|
|
139
139
|
): WMSCapabilities {
|
|
140
|
-
const parsedXML = XMLLoader.parseTextSync(xmlText, options);
|
|
140
|
+
const parsedXML = XMLLoader.parseTextSync?.(xmlText, options);
|
|
141
141
|
const xmlCapabilities: any =
|
|
142
142
|
parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;
|
|
143
143
|
const capabilities = extractCapabilities(xmlCapabilities);
|
|
@@ -340,6 +340,7 @@ function extractWMSBoundingBox(xmlBoundingBox: any): WMSBoundingBox {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
/** Traverse layers and inject missing props from parents */
|
|
343
|
+
// eslint-disable-next-line complexity
|
|
343
344
|
function addInheritedLayerProps(layer: WMSLayer, parent: WMSLayer | null): void {
|
|
344
345
|
if (parent && parent.geographicBoundingBox && !layer.geographicBoundingBox) {
|
|
345
346
|
layer.geographicBoundingBox = [...parent.geographicBoundingBox];
|
|
@@ -18,7 +18,7 @@ export type WMSFeature = {
|
|
|
18
18
|
* @note Error handlings is fairly weak
|
|
19
19
|
*/
|
|
20
20
|
export function parseWMSFeatureInfo(text: string, options): WMSFeatureInfo {
|
|
21
|
-
const parsedXML = XMLLoader.parseTextSync(text, options);
|
|
21
|
+
const parsedXML = XMLLoader.parseTextSync?.(text, options);
|
|
22
22
|
const xmlFeatureInfo: any = parsedXML.FeatureInfoResponse?.FIELDS || [];
|
|
23
23
|
|
|
24
24
|
const xmlFeatures = Array.isArray(xmlFeatureInfo) ? xmlFeatureInfo : [xmlFeatureInfo];
|
|
@@ -12,7 +12,7 @@ export type WMSLayerDescription = {
|
|
|
12
12
|
* @note Error handlings is fairly weak
|
|
13
13
|
*/
|
|
14
14
|
export function parseWMSLayerDescription(text: string, options): WMSLayerDescription {
|
|
15
|
-
const parsedXML = XMLLoader.parseTextSync(text, options);
|
|
15
|
+
const parsedXML = XMLLoader.parseTextSync?.(text, options);
|
|
16
16
|
// TODO - implement parser
|
|
17
17
|
return parsedXML as unknown as WMSLayerDescription;
|
|
18
18
|
}
|
|
@@ -14,15 +14,12 @@ export type ArcGISImageServerProps = ImageSourceProps & {
|
|
|
14
14
|
* Note - exports a big API, that could be exposed here if there is a use case
|
|
15
15
|
* @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm
|
|
16
16
|
*/
|
|
17
|
-
export class ArcGISImageServer extends ImageSource {
|
|
17
|
+
export class ArcGISImageServer extends ImageSource<ArcGISImageServerProps> {
|
|
18
18
|
static type: 'arcgis-image-server' = 'arcgis-image-server';
|
|
19
19
|
static testURL = (url: string): boolean => url.toLowerCase().includes('ImageServer');
|
|
20
20
|
|
|
21
|
-
props: ArcGISImageServerProps;
|
|
22
|
-
|
|
23
21
|
constructor(props: ArcGISImageServerProps) {
|
|
24
22
|
super(props);
|
|
25
|
-
this.props = props;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
// ImageSource (normalized endpoints)
|
|
@@ -20,15 +20,12 @@ export type ImageServiceProps = {
|
|
|
20
20
|
* ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources
|
|
21
21
|
* Accepts a template url string and builds requests URLs
|
|
22
22
|
*/
|
|
23
|
-
export class ImageService extends ImageSource {
|
|
23
|
+
export class ImageService<PropsT extends ImageServiceProps> extends ImageSource<PropsT> {
|
|
24
24
|
static type: 'template' = 'template';
|
|
25
25
|
static testURL = (url: string): boolean => url.toLowerCase().includes('{');
|
|
26
26
|
|
|
27
|
-
props:
|
|
28
|
-
|
|
29
|
-
constructor(props: ImageServiceProps) {
|
|
27
|
+
constructor(props: PropsT) {
|
|
30
28
|
super(props);
|
|
31
|
-
this.props = props;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
// IMAGE SOURCE API
|
|
@@ -54,11 +54,10 @@ export type CSWServiceProps = DataSourceProps & {
|
|
|
54
54
|
* - implements the ImageService interface
|
|
55
55
|
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
56
56
|
*/
|
|
57
|
-
export class CSWService extends DataSource {
|
|
57
|
+
export class CSWService extends DataSource<CSWServiceProps> {
|
|
58
58
|
static type: 'csw' = 'csw';
|
|
59
59
|
static testURL = (url: string): boolean => url.toLowerCase().includes('csw');
|
|
60
60
|
|
|
61
|
-
props: CSWServiceProps;
|
|
62
61
|
capabilities: CSWCapabilities | null = null;
|
|
63
62
|
|
|
64
63
|
/** A list of loaders used by the CSWService methods */
|
|
@@ -67,7 +66,6 @@ export class CSWService extends DataSource {
|
|
|
67
66
|
/** Create a CSWService */
|
|
68
67
|
constructor(props: CSWServiceProps) {
|
|
69
68
|
super(props);
|
|
70
|
-
this.props = props;
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
async getMetadata(): Promise<CSWCapabilities> {
|