@loaders.gl/wms 4.0.0-alpha.23 → 4.0.0-alpha.24

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.
Files changed (79) hide show
  1. package/dist/es5/csw-capabilities-loader.js +1 -1
  2. package/dist/es5/csw-domain-loader.js +1 -1
  3. package/dist/es5/csw-records-loader.js +1 -1
  4. package/dist/es5/gml-loader.js +1 -1
  5. package/dist/es5/gml-loader.js.map +1 -1
  6. package/dist/es5/lerc-loader.js +1 -1
  7. package/dist/es5/lerc-loader.js.map +1 -1
  8. package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
  9. package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
  10. package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
  11. package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
  12. package/dist/es5/wms-capabilities-loader.js +1 -1
  13. package/dist/es5/wms-error-loader.js +1 -1
  14. package/dist/esm/csw-capabilities-loader.js +1 -1
  15. package/dist/esm/csw-domain-loader.js +1 -1
  16. package/dist/esm/csw-records-loader.js +1 -1
  17. package/dist/esm/gml-loader.js +1 -1
  18. package/dist/esm/gml-loader.js.map +1 -1
  19. package/dist/esm/lerc-loader.js +1 -1
  20. package/dist/esm/lerc-loader.js.map +1 -1
  21. package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
  22. package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
  23. package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
  24. package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
  25. package/dist/esm/wms-capabilities-loader.js +1 -1
  26. package/dist/esm/wms-error-loader.js +1 -1
  27. package/dist/gml-loader.d.ts +2 -1
  28. package/dist/gml-loader.d.ts.map +1 -1
  29. package/dist/lerc-loader.d.ts +2 -1
  30. package/dist/lerc-loader.d.ts.map +1 -1
  31. package/dist/lib/parsers/gml/parse-gml.d.ts +1 -0
  32. package/dist/lib/parsers/gml/parse-gml.d.ts.map +1 -1
  33. package/package.json +6 -6
  34. package/src/gml-loader.ts +2 -1
  35. package/src/lerc-loader.ts +1 -1
  36. package/src/lib/parsers/gml/parse-gml.ts +2 -0
  37. package/dist/bundle.js +0 -6
  38. package/dist/csw-capabilities-loader.js +0 -30
  39. package/dist/csw-domain-loader.js +0 -30
  40. package/dist/csw-records-loader.js +0 -30
  41. package/dist/gml-loader.js +0 -30
  42. package/dist/index.js +0 -39
  43. package/dist/lerc-loader.js +0 -55
  44. package/dist/lib/create-image-source.js +0 -39
  45. package/dist/lib/parsers/csw/parse-csw-capabilities.js +0 -24
  46. package/dist/lib/parsers/csw/parse-csw-domain.js +0 -33
  47. package/dist/lib/parsers/csw/parse-csw-records.js +0 -58
  48. package/dist/lib/parsers/csw/parse-exception-report.js +0 -30
  49. package/dist/lib/parsers/gml/deep-strict-equal.js +0 -119
  50. package/dist/lib/parsers/gml/parse-gml.js +0 -371
  51. package/dist/lib/parsers/lerc/lerc-types.js +0 -3
  52. package/dist/lib/parsers/wms/parse-wms-capabilities.js +0 -233
  53. package/dist/lib/parsers/wms/parse-wms-error.js +0 -22
  54. package/dist/lib/parsers/wms/parse-wms-features.js +0 -27
  55. package/dist/lib/parsers/wms/parse-wms-layer-description.js +0 -15
  56. package/dist/lib/parsers/xml/parse-xml-helpers.js +0 -68
  57. package/dist/lib/services/arcgis/arcgis-image-service.js +0 -94
  58. package/dist/lib/services/arcgis/arcgis-server.js +0 -42
  59. package/dist/lib/services/generic/image-service.js +0 -47
  60. package/dist/lib/services/ogc/csw-service.js +0 -168
  61. package/dist/lib/services/ogc/wms-service.js +0 -309
  62. package/dist/lib/sources/data-source.js +0 -56
  63. package/dist/lib/sources/image-source.js +0 -13
  64. package/dist/lib/sources/tile-source.js +0 -13
  65. package/dist/lib/sources/utils/utils.js +0 -38
  66. package/dist/lib/wfs/parse-wfs.js +0 -32
  67. package/dist/lib/wmts/parse-wmts.js +0 -35
  68. package/dist/wip/arcgis-feature-service.js +0 -28
  69. package/dist/wip/data-source.js +0 -59
  70. package/dist/wip/lib/wcs/parse-wcs-capabilities.js +0 -15
  71. package/dist/wip/lib/wfs/parse-wfs-capabilities.js +0 -19
  72. package/dist/wip/lib/wmts/parse-wmts-capabilities.js +0 -77
  73. package/dist/wip/wcs-capabilities-loader.js +0 -31
  74. package/dist/wip/wfs-capabilities-loader.js +0 -31
  75. package/dist/wip/wms-feature-info-loader.js +0 -18
  76. package/dist/wip/wms-layer-description-loader.js +0 -17
  77. package/dist/wip/wmts-capabilities-loader.js +0 -32
  78. package/dist/wms-capabilities-loader.js +0 -34
  79. package/dist/wms-error-loader.js +0 -42
@@ -1,309 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.WMSService = void 0;
5
- const images_1 = require("@loaders.gl/images");
6
- const loader_utils_1 = require("@loaders.gl/loader-utils");
7
- const image_source_1 = require("../../sources/image-source");
8
- const wms_capabilities_loader_1 = require("../../../wms-capabilities-loader");
9
- const wms_feature_info_loader_1 = require("../../../wip/wms-feature-info-loader");
10
- const wms_layer_description_loader_1 = require("../../../wip/wms-layer-description-loader");
11
- const wms_error_loader_1 = require("../../../wms-error-loader");
12
- /**
13
- * The WMSService class provides
14
- * - provides type safe methods to form URLs to a WMS service
15
- * - provides type safe methods to query and parse results (and errors) from a WMS service
16
- * - implements the ImageService interface
17
- * @note Only the URL parameter conversion is supported. XML posts are not supported.
18
- */
19
- class WMSService extends image_source_1.ImageSource {
20
- /** Create a WMSService */
21
- constructor(props) {
22
- super(props);
23
- this.capabilities = null;
24
- // TODO - defaults such as version, layers etc could be extracted from a base URL with parameters
25
- // This would make pasting in any WMS URL more likely to make this class just work.
26
- // const {baseUrl, parameters} = this._parseWMSUrl(props.url);
27
- this.url = props.url;
28
- this.substituteCRS84 = props.substituteCRS84 ?? false;
29
- this.flipCRS = ['EPSG:4326'];
30
- this.wmsParameters = {
31
- layers: undefined,
32
- query_layers: undefined,
33
- styles: undefined,
34
- version: '1.3.0',
35
- crs: 'EPSG:4326',
36
- format: 'image/png',
37
- info_format: 'text/plain',
38
- transparent: undefined,
39
- time: undefined,
40
- elevation: undefined,
41
- ...props.wmsParameters
42
- };
43
- this.vendorParameters = props.vendorParameters || {};
44
- }
45
- // ImageSource implementation
46
- async getMetadata() {
47
- const capabilities = await this.getCapabilities();
48
- return this.normalizeMetadata(capabilities);
49
- }
50
- async getImage(parameters) {
51
- return await this.getMap(parameters);
52
- }
53
- normalizeMetadata(capabilities) {
54
- return capabilities;
55
- }
56
- // WMS Service API Stubs
57
- /** Get Capabilities */
58
- async getCapabilities(wmsParameters, vendorParameters) {
59
- const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
60
- const response = await this.fetch(url);
61
- const arrayBuffer = await response.arrayBuffer();
62
- this._checkResponse(response, arrayBuffer);
63
- const capabilities = await wms_capabilities_loader_1.WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);
64
- this.capabilities = capabilities;
65
- return capabilities;
66
- }
67
- /** Get a map image */
68
- async getMap(wmsParameters, vendorParameters) {
69
- const url = this.getMapURL(wmsParameters, vendorParameters);
70
- const response = await this.fetch(url);
71
- const arrayBuffer = await response.arrayBuffer();
72
- this._checkResponse(response, arrayBuffer);
73
- try {
74
- return await images_1.ImageLoader.parse(arrayBuffer, this.loadOptions);
75
- }
76
- catch {
77
- throw this._parseError(arrayBuffer);
78
- }
79
- }
80
- /** Get Feature Info for a coordinate */
81
- async getFeatureInfo(wmsParameters, vendorParameters) {
82
- const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
83
- const response = await this.fetch(url);
84
- const arrayBuffer = await response.arrayBuffer();
85
- this._checkResponse(response, arrayBuffer);
86
- return await wms_feature_info_loader_1.WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
87
- }
88
- /** Get Feature Info for a coordinate */
89
- async getFeatureInfoText(wmsParameters, vendorParameters) {
90
- const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
91
- const response = await this.fetch(url);
92
- const arrayBuffer = await response.arrayBuffer();
93
- this._checkResponse(response, arrayBuffer);
94
- return new TextDecoder().decode(arrayBuffer);
95
- }
96
- /** Get more information about a layer */
97
- async describeLayer(wmsParameters, vendorParameters) {
98
- const url = this.describeLayerURL(wmsParameters, vendorParameters);
99
- const response = await this.fetch(url);
100
- const arrayBuffer = await response.arrayBuffer();
101
- this._checkResponse(response, arrayBuffer);
102
- return await wms_layer_description_loader_1.WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
103
- }
104
- /** Get an image with a semantic legend */
105
- async getLegendGraphic(wmsParameters, vendorParameters) {
106
- const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);
107
- const response = await this.fetch(url);
108
- const arrayBuffer = await response.arrayBuffer();
109
- this._checkResponse(response, arrayBuffer);
110
- try {
111
- return await images_1.ImageLoader.parse(arrayBuffer, this.loadOptions);
112
- }
113
- catch {
114
- throw this._parseError(arrayBuffer);
115
- }
116
- }
117
- // Typed URL creators
118
- // For applications that want full control of fetching and parsing
119
- /** Generate a URL for the GetCapabilities request */
120
- getCapabilitiesURL(wmsParameters, vendorParameters) {
121
- const options = {
122
- version: this.wmsParameters.version,
123
- ...wmsParameters
124
- };
125
- return this._getWMSUrl('GetCapabilities', options, vendorParameters);
126
- }
127
- /** Generate a URL for the GetMap request */
128
- getMapURL(wmsParameters, vendorParameters) {
129
- wmsParameters = this._getWMS130Parameters(wmsParameters);
130
- const options = {
131
- version: this.wmsParameters.version,
132
- format: this.wmsParameters.format,
133
- transparent: this.wmsParameters.transparent,
134
- time: this.wmsParameters.time,
135
- elevation: this.wmsParameters.elevation,
136
- layers: this.wmsParameters.layers,
137
- styles: this.wmsParameters.styles,
138
- crs: this.wmsParameters.crs,
139
- // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
140
- // width: 1200,
141
- // height: 900,
142
- ...wmsParameters
143
- };
144
- return this._getWMSUrl('GetMap', options, vendorParameters);
145
- }
146
- /** Generate a URL for the GetFeatureInfo request */
147
- getFeatureInfoURL(wmsParameters, vendorParameters) {
148
- const options = {
149
- version: this.wmsParameters.version,
150
- // query_layers: [],
151
- // format: this.wmsParameters.format,
152
- info_format: this.wmsParameters.info_format,
153
- layers: this.wmsParameters.layers,
154
- query_layers: this.wmsParameters.query_layers,
155
- styles: this.wmsParameters.styles,
156
- crs: this.wmsParameters.crs,
157
- // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
158
- // width: 1200,
159
- // height: 900,
160
- // x: undefined!,
161
- // y: undefined!,
162
- ...wmsParameters
163
- };
164
- return this._getWMSUrl('GetFeatureInfo', options, vendorParameters);
165
- }
166
- /** Generate a URL for the GetFeatureInfo request */
167
- describeLayerURL(wmsParameters, vendorParameters) {
168
- const options = {
169
- version: this.wmsParameters.version,
170
- ...wmsParameters
171
- };
172
- return this._getWMSUrl('DescribeLayer', options, vendorParameters);
173
- }
174
- getLegendGraphicURL(wmsParameters, vendorParameters) {
175
- const options = {
176
- version: this.wmsParameters.version,
177
- // format?
178
- ...wmsParameters
179
- };
180
- return this._getWMSUrl('GetLegendGraphic', options, vendorParameters);
181
- }
182
- // INTERNAL METHODS
183
- _parseWMSUrl(url) {
184
- const [baseUrl, search] = url.split('?');
185
- const searchParams = search.split('&');
186
- const parameters = {};
187
- for (const parameter of searchParams) {
188
- const [key, value] = parameter.split('=');
189
- parameters[key] = value;
190
- }
191
- return { url: baseUrl, parameters };
192
- }
193
- /**
194
- * Generate a URL with parameters
195
- * @note case _getWMSUrl may need to be overridden to handle certain backends?
196
- * @note at the moment, only URLs with parameters are supported (no XML payloads)
197
- * */
198
- _getWMSUrl(request, wmsParameters, vendorParameters) {
199
- let url = this.url;
200
- let first = true;
201
- // Add any vendor searchParams
202
- const allParameters = {
203
- service: 'WMS',
204
- version: wmsParameters.version,
205
- request,
206
- ...wmsParameters,
207
- ...this.vendorParameters,
208
- ...vendorParameters
209
- };
210
- // Encode the keys
211
- const IGNORE_EMPTY_KEYS = ['transparent', 'time', 'elevation'];
212
- for (const [key, value] of Object.entries(allParameters)) {
213
- // hack to preserve test cases. Not super clear if keys should be included when values are undefined
214
- if (!IGNORE_EMPTY_KEYS.includes(key) || value) {
215
- url += first ? '?' : '&';
216
- first = false;
217
- url += this._getURLParameter(key, value, wmsParameters);
218
- }
219
- }
220
- return encodeURI(url);
221
- }
222
- _getWMS130Parameters(wmsParameters) {
223
- const newParameters = { ...wmsParameters };
224
- if (newParameters.srs) {
225
- newParameters.crs = newParameters.crs || newParameters.srs;
226
- delete newParameters.srs;
227
- }
228
- return newParameters;
229
- }
230
- // eslint-disable-complexity
231
- _getURLParameter(key, value, wmsParameters) {
232
- // Substitute by key
233
- switch (key) {
234
- case 'crs':
235
- // CRS was called SRS before WMS 1.3.0
236
- if (wmsParameters.version !== '1.3.0') {
237
- key = 'srs';
238
- }
239
- else if (this.substituteCRS84 && value === 'EPSG:4326') {
240
- /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */
241
- // Substitute by value
242
- value = 'CRS:84';
243
- }
244
- break;
245
- case 'srs':
246
- // CRS was called SRS before WMS 1.3.0
247
- if (wmsParameters.version === '1.3.0') {
248
- key = 'crs';
249
- }
250
- break;
251
- case 'bbox':
252
- // Coordinate order is flipped for certain CRS in WMS 1.3.0
253
- const bbox = this._flipBoundingBox(value, wmsParameters);
254
- if (bbox) {
255
- value = bbox;
256
- }
257
- break;
258
- default:
259
- // do nothing
260
- }
261
- key = key.toUpperCase();
262
- return Array.isArray(value)
263
- ? `${key}=${value.join(',')}`
264
- : `${key}=${value ? String(value) : ''}`;
265
- }
266
- /** Coordinate order is flipped for certain CRS in WMS 1.3.0 */
267
- _flipBoundingBox(bboxValue, wmsParameters) {
268
- // Sanity checks
269
- if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {
270
- return null;
271
- }
272
- const flipCoordinates =
273
- // Only affects WMS 1.3.0
274
- wmsParameters.version === '1.3.0' &&
275
- // Flip if we are dealing with a CRS that was flipped in 1.3.0
276
- this.flipCRS.includes(wmsParameters.crs || '') &&
277
- // Don't flip if we are subsituting EPSG:4326 with CRS:84
278
- !(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');
279
- const bbox = bboxValue;
280
- return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;
281
- }
282
- /** Fetches an array buffer and checks the response (boilerplate reduction) */
283
- async _fetchArrayBuffer(url) {
284
- const response = await this.fetch(url);
285
- const arrayBuffer = await response.arrayBuffer();
286
- this._checkResponse(response, arrayBuffer);
287
- return arrayBuffer;
288
- }
289
- /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
290
- _checkResponse(response, arrayBuffer) {
291
- const contentType = response.headers['content-type'];
292
- if (!response.ok || wms_error_loader_1.WMSErrorLoader.mimeTypes.includes(contentType)) {
293
- // We want error responses to throw exceptions, the WMSErrorLoader can do this
294
- const loadOptions = (0, loader_utils_1.mergeLoaderOptions)(this.loadOptions, {
295
- wms: { throwOnError: true }
296
- });
297
- const error = wms_error_loader_1.WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);
298
- throw new Error(error);
299
- }
300
- }
301
- /** Error situation detected */
302
- _parseError(arrayBuffer) {
303
- const error = wms_error_loader_1.WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);
304
- return new Error(error);
305
- }
306
- }
307
- exports.WMSService = WMSService;
308
- WMSService.type = 'wms';
309
- WMSService.testURL = (url) => url.toLowerCase().includes('wms');
@@ -1,56 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getFetchFunction = exports.DataSource = void 0;
5
- /** base class of all data sources */
6
- class DataSource {
7
- constructor(props) {
8
- this._needsRefresh = true;
9
- this.props = { ...props };
10
- this.loadOptions = { ...props.loadOptions };
11
- this.fetch = getFetchFunction(this.loadOptions);
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
- }
33
- }
34
- exports.DataSource = DataSource;
35
- /**
36
- * Gets the current fetch function from options
37
- * @todo - move to loader-utils module
38
- * @todo - use in core module counterpart
39
- * @param options
40
- * @param context
41
- */
42
- function getFetchFunction(options) {
43
- const fetchFunction = options?.fetch;
44
- // options.fetch can be a function
45
- if (fetchFunction && typeof fetchFunction === 'function') {
46
- return (url, fetchOptions) => fetchFunction(url, fetchOptions);
47
- }
48
- // options.fetch can be an options object, use global fetch with those options
49
- const fetchOptions = options?.fetch;
50
- if (fetchOptions && typeof fetchOptions !== 'function') {
51
- return (url) => fetch(url, fetchOptions);
52
- }
53
- // else return the global fetch function
54
- return (url) => fetch(url);
55
- }
56
- exports.getFetchFunction = getFetchFunction;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ImageSource = void 0;
5
- const data_source_1 = require("./data-source");
6
- /**
7
- * MapImageSource - data sources that allow data to be queried by (geospatial) extents
8
- * @note
9
- * - If geospatial, bounding box is expected to be in web mercator coordinates
10
- */
11
- class ImageSource extends data_source_1.DataSource {
12
- }
13
- exports.ImageSource = ImageSource;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TileSource = void 0;
5
- const data_source_1 = require("./data-source");
6
- /**
7
- * MapTileSource - data sources that allow data to be queried by (geospatial) extents
8
- * @note
9
- * - If geospatial, bounding box is expected to be in web mercator coordinates
10
- */
11
- class TileSource extends data_source_1.DataSource {
12
- }
13
- exports.TileSource = TileSource;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.mergeImageServiceProps = exports.getFetchFunction = void 0;
5
- /**
6
- * Gets the current fetch function from options
7
- * @todo - move to loader-utils module
8
- * @todo - use in core module counterpart
9
- * @param options
10
- * @param context
11
- */
12
- function getFetchFunction(options) {
13
- const fetchFunction = options?.fetch;
14
- // options.fetch can be a function
15
- if (fetchFunction && typeof fetchFunction === 'function') {
16
- return (url, fetchOptions) => fetchFunction(url, fetchOptions);
17
- }
18
- // options.fetch can be an options object, use global fetch with those options
19
- const fetchOptions = options?.fetch;
20
- if (fetchOptions && typeof fetchOptions !== 'function') {
21
- return (url) => fetch(url, fetchOptions);
22
- }
23
- // else return the global fetch function
24
- return (url) => fetch(url);
25
- }
26
- exports.getFetchFunction = getFetchFunction;
27
- function mergeImageServiceProps(props) {
28
- // @ts-expect-error
29
- return {
30
- // Default fetch
31
- ...props,
32
- loadOptions: {
33
- ...props.loadOptions,
34
- fetch: getFetchFunction(props.loadOptions)
35
- }
36
- };
37
- }
38
- exports.mergeImageServiceProps = mergeImageServiceProps;
@@ -1,32 +0,0 @@
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
- }
@@ -1,35 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ArcGISFeatureService = void 0;
5
- class ArcGISFeatureService {
6
- constructor(props) {
7
- this.url = props.url;
8
- this.loadOptions = props.loadOptions || {};
9
- this.fetch = props.fetch || fetch;
10
- }
11
- // URL creators
12
- metadataURL(options) {
13
- return this.getUrl({ ...options });
14
- }
15
- /**
16
- * Form a URL to an ESRI FeatureServer
17
- // https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?
18
- // returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&
19
- // geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`
20
- */
21
- exportImageURL(options) {
22
- const { boundingBox } = options;
23
- // const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;
24
- // const size = `size=${width},${height}`
25
- return this.getUrl({ path: 'exportImage', });
26
- }
27
- }
28
- exports.ArcGISFeatureService = ArcGISFeatureService;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- /** General data source class */
4
- // export abstract class DataSource {};
5
- // export type DataSourceMetadata = {};
6
- // ImageSource
7
- // Tile Source
8
- /** Data source that serves data by tile index *
9
- export abstract class TileDataSource extends DataSource {};
10
-
11
- // Image Tile Data Source
12
-
13
- export type ImageTileDataSourceCapabilities = {
14
- }
15
-
16
- export type ImageTile = Record<string, any>;
17
-
18
- export type FeatureInfo = {};
19
-
20
- export abstract class ImageTileDataSource extends TileDataSource {
21
- source: ImageDataSource;
22
-
23
- constructor(source: ImageDataSource) {
24
- super();
25
- this.source = source;
26
- }
27
-
28
- getCapabilities(): Promise<ImageTileDataSourceCapabilities> {
29
- return this.source.getCapabilities();
30
- }
31
-
32
- getTile({x, y, z, width, height, layers, parameters}): Promise<ImageType> {
33
- const boundingBox = this.getBoundingBoxFromTileIndex(x, y, z);
34
- return this.source.getImage({boundingBox, width, height, layers, parameters});
35
- }
36
-
37
- getFeatureInfo(): FeatureInfo | null {
38
- return null;
39
- }
40
-
41
- getBoundingBoxFromTileIndex(x: number, y: number, z: number): [number, number, number, number] {
42
- return [0, 0, 1, 1];
43
- }
44
- }
45
-
46
- // Vector Tile Source
47
-
48
- export type VectorTileDataSourceCapabilities = {
49
- // check tile.json
50
- }
51
-
52
- export type VectorTile = Record<string, any>;
53
-
54
- export abstract class VectorTileDataSource extends TileDataSource {
55
- abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;
56
- abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;
57
- }
58
-
59
- */
@@ -1,15 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.parseWCSCapabilities = 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 parseWCSCapabilities(text, options) {
11
- const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, { ...options, xml: { ...options?.xml, removeNSPrefix: true } });
12
- const xmlCapabilities = parsedXML.Capabilities || parsedXML;
13
- return xmlCapabilities;
14
- }
15
- exports.parseWCSCapabilities = parseWCSCapabilities;
@@ -1,19 +0,0 @@
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
- const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, { ...options, xml: {
12
- ...options?.xml,
13
- removeNSPrefix: true,
14
- uncapitalizeKeys: true
15
- } });
16
- const xmlCapabilities = parsedXML.Capabilities || parsedXML;
17
- return xmlCapabilities;
18
- }
19
- exports.parseWFSCapabilities = parseWFSCapabilities;