@loaders.gl/wms 4.0.0-alpha.9 → 4.0.0-beta.1
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.d.ts +1 -17
- package/dist/csw-capabilities-loader.d.ts.map +1 -1
- package/dist/csw-domain-loader.d.ts +1 -17
- package/dist/csw-domain-loader.d.ts.map +1 -1
- package/dist/csw-records-loader.d.ts +1 -1
- package/dist/csw-records-loader.d.ts.map +1 -1
- package/dist/dist.min.js +187 -161
- package/dist/es5/csw-capabilities-loader.js +2 -4
- package/dist/es5/csw-capabilities-loader.js.map +1 -1
- package/dist/es5/csw-domain-loader.js +2 -4
- package/dist/es5/csw-domain-loader.js.map +1 -1
- package/dist/es5/csw-records-loader.js +2 -2
- package/dist/es5/csw-records-loader.js.map +1 -1
- package/dist/es5/gml-loader.js +2 -4
- package/dist/es5/gml-loader.js.map +1 -1
- package/dist/es5/index.js +23 -10
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +2 -4
- package/dist/es5/lerc-loader.js.map +1 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/es5/lib/{create-image-source.js → services/create-image-service.js} +30 -21
- package/dist/es5/lib/services/create-image-service.js.map +1 -0
- package/dist/es5/lib/services/{generic/image-service.js → image-service.js} +2 -2
- package/dist/es5/lib/services/image-service.js.map +1 -0
- package/dist/es5/{lib/services → services}/arcgis/arcgis-image-service.js +22 -16
- package/dist/es5/services/arcgis/arcgis-image-service.js.map +1 -0
- package/dist/es5/services/arcgis/arcgis-server.js.map +1 -0
- package/dist/es5/services/create-image-source.js +14 -0
- package/dist/es5/services/create-image-source.js.map +1 -0
- package/dist/es5/{lib/services → services}/ogc/csw-service.js +10 -8
- package/dist/es5/services/ogc/csw-service.js.map +1 -0
- package/dist/es5/{lib/services → services}/ogc/wms-service.js +28 -22
- package/dist/es5/services/ogc/wms-service.js.map +1 -0
- package/dist/es5/wip/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/es5/wip/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/es5/wip/services/arcgis-feature-service.js.map +1 -0
- 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 +2 -2
- 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/wmts-capabilities-loader.js +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-capabilities-loader.js +2 -4
- package/dist/es5/wms-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-error-loader.js +2 -4
- package/dist/es5/wms-error-loader.js.map +1 -1
- package/dist/esm/csw-capabilities-loader.js +1 -2
- package/dist/esm/csw-capabilities-loader.js.map +1 -1
- package/dist/esm/csw-domain-loader.js +1 -2
- package/dist/esm/csw-domain-loader.js.map +1 -1
- package/dist/esm/csw-records-loader.js +2 -2
- package/dist/esm/csw-records-loader.js.map +1 -1
- package/dist/esm/gml-loader.js +1 -2
- package/dist/esm/gml-loader.js.map +1 -1
- package/dist/esm/index.js +8 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -2
- package/dist/esm/lerc-loader.js.map +1 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/esm/lib/services/create-image-service.js +27 -0
- package/dist/esm/lib/services/create-image-service.js.map +1 -0
- package/dist/esm/lib/services/{generic/image-service.js → image-service.js} +1 -1
- package/dist/esm/lib/services/image-service.js.map +1 -0
- package/dist/esm/{lib/services → services}/arcgis/arcgis-image-service.js +7 -5
- package/dist/esm/services/arcgis/arcgis-image-service.js.map +1 -0
- package/dist/esm/services/arcgis/arcgis-server.js.map +1 -0
- package/dist/esm/services/create-image-source.js +8 -0
- package/dist/esm/services/create-image-source.js.map +1 -0
- package/dist/esm/{lib/services → services}/ogc/csw-service.js +9 -7
- package/dist/esm/services/ogc/csw-service.js.map +1 -0
- package/dist/esm/{lib/services → services}/ogc/wms-service.js +15 -11
- package/dist/esm/services/ogc/wms-service.js.map +1 -0
- package/dist/esm/wip/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/esm/wip/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/esm/wip/services/arcgis-feature-service.js.map +1 -0
- 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 +2 -2
- 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/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 -2
- package/dist/esm/wms-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-error-loader.js +1 -2
- package/dist/esm/wms-error-loader.js.map +1 -1
- package/dist/gml-loader.d.ts +2 -18
- package/dist/gml-loader.d.ts.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/lerc-loader.d.ts +1 -14
- package/dist/lerc-loader.d.ts.map +1 -1
- package/dist/lib/parsers/gml/parse-gml.d.ts +1 -0
- package/dist/lib/parsers/gml/parse-gml.d.ts.map +1 -1
- package/dist/lib/services/create-image-service.d.ts +14 -0
- package/dist/lib/services/create-image-service.d.ts.map +1 -0
- package/dist/lib/services/{generic/image-service.d.ts → image-service.d.ts} +4 -4
- package/dist/lib/services/image-service.d.ts.map +1 -0
- package/dist/{lib/services → services}/arcgis/arcgis-image-service.d.ts +6 -7
- package/dist/services/arcgis/arcgis-image-service.d.ts.map +1 -0
- package/dist/services/arcgis/arcgis-server.d.ts.map +1 -0
- package/dist/services/create-image-source.d.ts +18 -0
- package/dist/services/create-image-source.d.ts.map +1 -0
- package/dist/{lib/services → services}/ogc/csw-service.d.ts +6 -38
- package/dist/services/ogc/csw-service.d.ts.map +1 -0
- package/dist/{lib/services → services}/ogc/wms-service.d.ts +14 -80
- package/dist/services/ogc/wms-service.d.ts.map +1 -0
- package/dist/wip/lib/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/wip/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/wip/services/arcgis-feature-service.d.ts.map +1 -0
- package/dist/wip/wfs-capabilities-loader.d.ts +1 -16
- package/dist/wip/wfs-capabilities-loader.d.ts.map +1 -1
- package/dist/wip/wms-feature-info-loader.d.ts +1 -15
- package/dist/wip/wms-feature-info-loader.d.ts.map +1 -1
- package/dist/wip/wms-layer-description-loader.d.ts +20 -6
- package/dist/wip/wms-layer-description-loader.d.ts.map +1 -1
- package/dist/wms-capabilities-loader.d.ts +2 -17
- package/dist/wms-capabilities-loader.d.ts.map +1 -1
- package/dist/wms-error-loader.d.ts +1 -21
- package/dist/wms-error-loader.d.ts.map +1 -1
- package/package.json +6 -9
- package/src/csw-capabilities-loader.ts +1 -4
- package/src/csw-domain-loader.ts +1 -3
- package/src/csw-records-loader.ts +2 -3
- package/src/gml-loader.ts +2 -3
- package/src/index.ts +14 -10
- package/src/lerc-loader.ts +1 -3
- package/src/lib/parsers/gml/parse-gml.ts +2 -0
- package/src/lib/services/create-image-service.ts +55 -0
- package/src/lib/services/{generic/image-service.ts → image-service.ts} +6 -4
- package/src/{lib/services → services}/arcgis/arcgis-image-service.ts +15 -8
- package/src/services/create-image-source.ts +31 -0
- package/src/{lib/services → services}/ogc/csw-service.ts +11 -11
- package/src/{lib/services → services}/ogc/wms-service.ts +27 -34
- package/src/wip/wfs-capabilities-loader.ts +2 -2
- package/src/wip/wms-feature-info-loader.ts +2 -1
- package/src/wms-capabilities-loader.ts +6 -4
- package/src/wms-error-loader.ts +1 -3
- package/dist/bundle.js +0 -6
- package/dist/csw-capabilities-loader.js +0 -31
- package/dist/csw-domain-loader.js +0 -31
- package/dist/csw-records-loader.js +0 -30
- package/dist/es5/lib/create-image-source.js.map +0 -1
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +0 -1
- package/dist/es5/lib/services/arcgis/arcgis-server.js.map +0 -1
- package/dist/es5/lib/services/generic/image-service.js.map +0 -1
- package/dist/es5/lib/services/ogc/csw-service.js.map +0 -1
- package/dist/es5/lib/services/ogc/wms-service.js.map +0 -1
- package/dist/es5/lib/sources/data-source.js +0 -67
- package/dist/es5/lib/sources/data-source.js.map +0 -1
- package/dist/es5/lib/sources/image-source.js +0 -26
- package/dist/es5/lib/sources/image-source.js.map +0 -1
- package/dist/es5/lib/sources/tile-source.js +0 -26
- package/dist/es5/lib/sources/tile-source.js.map +0 -1
- package/dist/es5/lib/sources/utils/utils.js +0 -36
- package/dist/es5/lib/sources/utils/utils.js.map +0 -1
- package/dist/es5/lib/wfs/parse-wfs.js.map +0 -1
- package/dist/es5/lib/wmts/parse-wmts.js.map +0 -1
- package/dist/es5/wip/arcgis-feature-service.js.map +0 -1
- package/dist/esm/lib/create-image-source.js +0 -27
- package/dist/esm/lib/create-image-source.js.map +0 -1
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +0 -1
- package/dist/esm/lib/services/arcgis/arcgis-server.js.map +0 -1
- package/dist/esm/lib/services/generic/image-service.js.map +0 -1
- package/dist/esm/lib/services/ogc/csw-service.js.map +0 -1
- package/dist/esm/lib/services/ogc/wms-service.js.map +0 -1
- package/dist/esm/lib/sources/data-source.js +0 -43
- package/dist/esm/lib/sources/data-source.js.map +0 -1
- package/dist/esm/lib/sources/image-source.js +0 -3
- package/dist/esm/lib/sources/image-source.js.map +0 -1
- package/dist/esm/lib/sources/tile-source.js +0 -3
- package/dist/esm/lib/sources/tile-source.js.map +0 -1
- package/dist/esm/lib/sources/utils/utils.js +0 -21
- package/dist/esm/lib/sources/utils/utils.js.map +0 -1
- package/dist/esm/lib/wfs/parse-wfs.js.map +0 -1
- package/dist/esm/lib/wmts/parse-wmts.js.map +0 -1
- package/dist/esm/wip/arcgis-feature-service.js.map +0 -1
- package/dist/gml-loader.js +0 -31
- package/dist/index.js +0 -39
- package/dist/lerc-loader.js +0 -56
- package/dist/lib/create-image-source.d.ts +0 -17
- package/dist/lib/create-image-source.d.ts.map +0 -1
- package/dist/lib/create-image-source.js +0 -39
- package/dist/lib/parsers/csw/parse-csw-capabilities.js +0 -24
- package/dist/lib/parsers/csw/parse-csw-domain.js +0 -33
- package/dist/lib/parsers/csw/parse-csw-records.js +0 -58
- package/dist/lib/parsers/csw/parse-exception-report.js +0 -30
- package/dist/lib/parsers/gml/deep-strict-equal.js +0 -119
- package/dist/lib/parsers/gml/parse-gml.js +0 -371
- package/dist/lib/parsers/lerc/lerc-types.js +0 -3
- package/dist/lib/parsers/wms/parse-wms-capabilities.js +0 -233
- package/dist/lib/parsers/wms/parse-wms-error.js +0 -22
- package/dist/lib/parsers/wms/parse-wms-features.js +0 -27
- package/dist/lib/parsers/wms/parse-wms-layer-description.js +0 -15
- package/dist/lib/parsers/xml/parse-xml-helpers.js +0 -68
- package/dist/lib/services/arcgis/arcgis-image-service.d.ts.map +0 -1
- package/dist/lib/services/arcgis/arcgis-image-service.js +0 -94
- package/dist/lib/services/arcgis/arcgis-server.d.ts.map +0 -1
- package/dist/lib/services/arcgis/arcgis-server.js +0 -42
- package/dist/lib/services/generic/image-service.d.ts.map +0 -1
- package/dist/lib/services/generic/image-service.js +0 -47
- package/dist/lib/services/ogc/csw-service.d.ts.map +0 -1
- package/dist/lib/services/ogc/csw-service.js +0 -168
- package/dist/lib/services/ogc/wms-service.d.ts.map +0 -1
- package/dist/lib/services/ogc/wms-service.js +0 -317
- package/dist/lib/sources/data-source.d.ts +0 -32
- package/dist/lib/sources/data-source.d.ts.map +0 -1
- package/dist/lib/sources/data-source.js +0 -56
- package/dist/lib/sources/image-source.d.ts +0 -79
- package/dist/lib/sources/image-source.d.ts.map +0 -1
- package/dist/lib/sources/image-source.js +0 -13
- package/dist/lib/sources/tile-source.d.ts +0 -56
- package/dist/lib/sources/tile-source.d.ts.map +0 -1
- package/dist/lib/sources/tile-source.js +0 -13
- package/dist/lib/sources/utils/utils.d.ts +0 -13
- package/dist/lib/sources/utils/utils.d.ts.map +0 -1
- package/dist/lib/sources/utils/utils.js +0 -38
- package/dist/lib/wfs/parse-wfs.d.ts.map +0 -1
- package/dist/lib/wfs/parse-wfs.js +0 -32
- package/dist/lib/wmts/parse-wmts.d.ts.map +0 -1
- package/dist/lib/wmts/parse-wmts.js +0 -35
- package/dist/wip/arcgis-feature-service.d.ts.map +0 -1
- package/dist/wip/arcgis-feature-service.js +0 -28
- package/dist/wip/data-source.js +0 -59
- package/dist/wip/lib/wcs/parse-wcs-capabilities.js +0 -15
- package/dist/wip/lib/wfs/parse-wfs-capabilities.js +0 -19
- package/dist/wip/lib/wmts/parse-wmts-capabilities.js +0 -77
- package/dist/wip/wcs-capabilities-loader.js +0 -31
- package/dist/wip/wfs-capabilities-loader.js +0 -31
- package/dist/wip/wms-feature-info-loader.js +0 -17
- package/dist/wip/wms-layer-description-loader.js +0 -17
- package/dist/wip/wmts-capabilities-loader.js +0 -32
- package/dist/wms-capabilities-loader.js +0 -35
- package/dist/wms-error-loader.js +0 -43
- package/src/lib/create-image-source.ts +0 -48
- package/src/lib/sources/data-source.ts +0 -73
- package/src/lib/sources/image-source.ts +0 -92
- package/src/lib/sources/tile-source.ts +0 -61
- package/src/lib/sources/utils/utils.ts +0 -42
- /package/dist/es5/{lib/services → services}/arcgis/arcgis-server.js +0 -0
- /package/dist/es5/{lib → wip/lib}/wfs/parse-wfs.js +0 -0
- /package/dist/es5/{lib → wip/lib}/wmts/parse-wmts.js +0 -0
- /package/dist/es5/wip/{arcgis-feature-service.js → services/arcgis-feature-service.js} +0 -0
- /package/dist/es5/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
- /package/dist/esm/{lib/services → services}/arcgis/arcgis-server.js +0 -0
- /package/dist/esm/{lib → wip/lib}/wfs/parse-wfs.js +0 -0
- /package/dist/esm/{lib → wip/lib}/wmts/parse-wmts.js +0 -0
- /package/dist/esm/wip/{arcgis-feature-service.js → services/arcgis-feature-service.js} +0 -0
- /package/dist/esm/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
- /package/dist/{lib/services → services}/arcgis/arcgis-server.d.ts +0 -0
- /package/dist/{lib → wip/lib}/wfs/parse-wfs.d.ts +0 -0
- /package/dist/{lib → wip/lib}/wmts/parse-wmts.d.ts +0 -0
- /package/dist/wip/{arcgis-feature-service.d.ts → services/arcgis-feature-service.d.ts} +0 -0
- /package/src/{lib/services → services}/arcgis/arcgis-server.ts +0 -0
- /package/src/{lib → wip/lib}/wfs/parse-wfs.ts +0 -0
- /package/src/{lib → wip/lib}/wmts/parse-wmts.ts +0 -0
- /package/src/wip/{arcgis-feature-service.ts → services/arcgis-feature-service.ts} +0 -0
- /package/src/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// https://github.com/nodejs/node/commit/c1d82ac2ff15594840e2a1b9531b506ae067ed27;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.deepStrictEqual = void 0;
|
|
5
|
-
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
|
|
6
|
-
//
|
|
7
|
-
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
|
|
8
|
-
//
|
|
9
|
-
// Originally from narwhal.js (http://narwhaljs.org)
|
|
10
|
-
// Copyright (c) 2009 Thomas Robinson <280north.com>
|
|
11
|
-
//
|
|
12
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
// of this software and associated documentation files (the 'Software'), to
|
|
14
|
-
// deal in the Software without restriction, including without limitation the
|
|
15
|
-
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
16
|
-
// sell copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
// furnished to do so, subject to the following conditions:
|
|
18
|
-
//
|
|
19
|
-
// The above copyright notice and this permission notice shall be included in
|
|
20
|
-
// all copies or substantial portions of the Software.
|
|
21
|
-
//
|
|
22
|
-
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
26
|
-
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
27
|
-
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
-
/** @todo replace this ridiculous choice of deepStrictEqual */
|
|
29
|
-
// eslint-disable-next-line complexity
|
|
30
|
-
function deepStrictEqual(actual, expected, strict) {
|
|
31
|
-
// 7.1. All identical values are equivalent, as determined by ===.
|
|
32
|
-
if (actual === expected) {
|
|
33
|
-
return true;
|
|
34
|
-
// } else if (actual instanceof Buffer && expected instanceof Buffer) {
|
|
35
|
-
// return compare(actual, expected) === 0;
|
|
36
|
-
// // 7.2. If the expected value is a Date object, the actual value is
|
|
37
|
-
// // equivalent if it is also a Date object that refers to the same time.
|
|
38
|
-
}
|
|
39
|
-
else if (actual instanceof Date && expected instanceof Date) {
|
|
40
|
-
return actual.getTime() === expected.getTime();
|
|
41
|
-
// 7.3 If the expected value is a RegExp object, the actual value is
|
|
42
|
-
// equivalent if it is also a RegExp object with the same source and
|
|
43
|
-
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
|
|
44
|
-
}
|
|
45
|
-
else if (actual instanceof RegExp && expected instanceof RegExp) {
|
|
46
|
-
return (actual.source === expected.source &&
|
|
47
|
-
actual.global === expected.global &&
|
|
48
|
-
actual.multiline === expected.multiline &&
|
|
49
|
-
actual.lastIndex === expected.lastIndex &&
|
|
50
|
-
actual.ignoreCase === expected.ignoreCase);
|
|
51
|
-
// 7.4. Other pairs that do not both pass typeof value == 'object',
|
|
52
|
-
// equivalence is determined by ==.
|
|
53
|
-
}
|
|
54
|
-
else if ((actual === null || typeof actual !== 'object') &&
|
|
55
|
-
(expected === null || typeof expected !== 'object')) {
|
|
56
|
-
// eslint-disable-next-line eqeqeq
|
|
57
|
-
return strict ? actual === expected : actual == expected;
|
|
58
|
-
// 7.5 For all other Object pairs, including Array objects, equivalence is
|
|
59
|
-
// determined by having the same number of owned properties (as verified
|
|
60
|
-
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
|
61
|
-
// (although not necessarily the same order), equivalent values for every
|
|
62
|
-
// corresponding key, and an identical 'prototype' property. Note: this
|
|
63
|
-
// accounts for both named and indexed properties on Arrays.
|
|
64
|
-
}
|
|
65
|
-
return objEquiv(actual, expected, strict);
|
|
66
|
-
}
|
|
67
|
-
exports.deepStrictEqual = deepStrictEqual;
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
69
|
-
const pSlice = Array.prototype.slice;
|
|
70
|
-
function isPrimitive(arg) {
|
|
71
|
-
return arg === null || (typeof arg !== 'object' && typeof arg !== 'function');
|
|
72
|
-
}
|
|
73
|
-
function isArguments(object) {
|
|
74
|
-
// eslint-disable-next-line eqeqeq
|
|
75
|
-
return Object.prototype.toString.call(object) == '[object Arguments]';
|
|
76
|
-
}
|
|
77
|
-
// eslint-disable-next-line complexity
|
|
78
|
-
function objEquiv(a, b, strict) {
|
|
79
|
-
if (a === null || a === undefined || b === null || b === undefined)
|
|
80
|
-
return false;
|
|
81
|
-
// if one is a primitive, the other must be same
|
|
82
|
-
if (isPrimitive(a) || isPrimitive(b))
|
|
83
|
-
return a === b;
|
|
84
|
-
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
|
|
85
|
-
return false;
|
|
86
|
-
const aIsArgs = isArguments(a);
|
|
87
|
-
const bIsArgs = isArguments(b);
|
|
88
|
-
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
|
|
89
|
-
return false;
|
|
90
|
-
if (aIsArgs) {
|
|
91
|
-
a = pSlice.call(a);
|
|
92
|
-
b = pSlice.call(b);
|
|
93
|
-
return deepStrictEqual(a, b, strict);
|
|
94
|
-
}
|
|
95
|
-
const ka = Object.keys(a);
|
|
96
|
-
const kb = Object.keys(b);
|
|
97
|
-
let key;
|
|
98
|
-
let i;
|
|
99
|
-
// having the same number of owned properties (keys incorporates
|
|
100
|
-
// hasOwnProperty)
|
|
101
|
-
if (ka.length !== kb.length)
|
|
102
|
-
return false;
|
|
103
|
-
// the same set of keys (although not necessarily the same order),
|
|
104
|
-
ka.sort();
|
|
105
|
-
kb.sort();
|
|
106
|
-
// ~~~cheap key test
|
|
107
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
|
108
|
-
if (ka[i] !== kb[i])
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
// equivalent values for every corresponding key, and
|
|
112
|
-
// ~~~possibly expensive deep test
|
|
113
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
|
114
|
-
key = ka[i];
|
|
115
|
-
if (!deepStrictEqual(a[key], b[key], strict))
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.parseMultiSurface = exports.parseCompositeSurface = exports.parseSurface = exports.parsePolygonOrRectangle = exports.parseExteriorOrInterior = exports.parseRing = exports.parseCurveSegments = exports.parseLinearRingOrLineString = exports.parsePoint = exports.parsePos = exports.parsePosList = exports.parseGMLToGeometry = exports.parseGML = void 0;
|
|
8
|
-
const xml_1 = require("@loaders.gl/xml");
|
|
9
|
-
const deep_strict_equal_1 = require("./deep-strict-equal");
|
|
10
|
-
const rewind_1 = __importDefault(require("@turf/rewind"));
|
|
11
|
-
function noTransform(...coords) {
|
|
12
|
-
return coords;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Parses a typed data structure from raw XML for GML features
|
|
16
|
-
* @note Error handlings is fairly weak
|
|
17
|
-
*/
|
|
18
|
-
function parseGML(text, options) {
|
|
19
|
-
// GeoJSON | null {
|
|
20
|
-
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, options);
|
|
21
|
-
options = { transformCoords: noTransform, stride: 2, ...options };
|
|
22
|
-
const context = createChildContext(parsedXML, options, {});
|
|
23
|
-
return parseGMLToGeometry(parsedXML, options, context);
|
|
24
|
-
}
|
|
25
|
-
exports.parseGML = parseGML;
|
|
26
|
-
/** Parse a GeoJSON geometry from GML XML */
|
|
27
|
-
function parseGMLToGeometry(inputXML, options, context) {
|
|
28
|
-
const childContext = createChildContext(inputXML, options, context);
|
|
29
|
-
let geometry = null;
|
|
30
|
-
const [name, xml] = getFirstKeyValue(inputXML);
|
|
31
|
-
switch (name) {
|
|
32
|
-
// case 'gml:MultiPoint':
|
|
33
|
-
// geometry = {
|
|
34
|
-
// type: 'MultiPoint',
|
|
35
|
-
// coordinates: parseMultiPoint(xml, options, childContext)
|
|
36
|
-
// };
|
|
37
|
-
// break;
|
|
38
|
-
case 'gml:LineString':
|
|
39
|
-
geometry = {
|
|
40
|
-
type: 'LineString',
|
|
41
|
-
coordinates: parseLinearRingOrLineString(xml, options, childContext)
|
|
42
|
-
};
|
|
43
|
-
break;
|
|
44
|
-
// case 'gml:MultiLineString':
|
|
45
|
-
// geometry = {
|
|
46
|
-
// type: 'MultiLineString',
|
|
47
|
-
// coordinates: parseMultiLineString(xml, options, childContext)
|
|
48
|
-
// };
|
|
49
|
-
// break;
|
|
50
|
-
case 'gml:Polygon':
|
|
51
|
-
case 'gml:Rectangle':
|
|
52
|
-
geometry = {
|
|
53
|
-
type: 'Polygon',
|
|
54
|
-
coordinates: parsePolygonOrRectangle(xml, options, childContext)
|
|
55
|
-
};
|
|
56
|
-
break;
|
|
57
|
-
case 'gml:Surface':
|
|
58
|
-
geometry = {
|
|
59
|
-
type: 'MultiPolygon',
|
|
60
|
-
coordinates: parseSurface(xml, options, childContext)
|
|
61
|
-
};
|
|
62
|
-
break;
|
|
63
|
-
case 'gml:MultiSurface':
|
|
64
|
-
geometry = {
|
|
65
|
-
type: 'MultiPolygon',
|
|
66
|
-
coordinates: parseMultiSurface(xml, options, childContext)
|
|
67
|
-
};
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
// todo
|
|
73
|
-
return (0, rewind_1.default)(geometry, { mutate: true });
|
|
74
|
-
}
|
|
75
|
-
exports.parseGMLToGeometry = parseGMLToGeometry;
|
|
76
|
-
/** Parse a list of coordinates from a string */
|
|
77
|
-
function parseCoords(s, options, context) {
|
|
78
|
-
const stride = context.srsDimension || options.stride || 2;
|
|
79
|
-
// Handle white space
|
|
80
|
-
const coords = s.replace(/\s+/g, ' ').trim().split(' ');
|
|
81
|
-
if (coords.length === 0 || coords.length % stride !== 0) {
|
|
82
|
-
throw new Error(`invalid coordinates list (stride ${stride})`);
|
|
83
|
-
}
|
|
84
|
-
const points = [];
|
|
85
|
-
for (let i = 0; i < coords.length - 1; i += stride) {
|
|
86
|
-
const point = coords.slice(i, i + stride).map(parseFloat);
|
|
87
|
-
points.push(options.transformCoords?.(...point) || point);
|
|
88
|
-
}
|
|
89
|
-
return points;
|
|
90
|
-
}
|
|
91
|
-
function parsePosList(xml, options, context) {
|
|
92
|
-
const childContext = createChildContext(xml, options, context);
|
|
93
|
-
const coords = textOf(xml);
|
|
94
|
-
if (!coords) {
|
|
95
|
-
throw new Error('invalid gml:posList element');
|
|
96
|
-
}
|
|
97
|
-
return parseCoords(coords, options, childContext);
|
|
98
|
-
}
|
|
99
|
-
exports.parsePosList = parsePosList;
|
|
100
|
-
function parsePos(xml, options, context) {
|
|
101
|
-
const childContext = createChildContext(xml, options, context);
|
|
102
|
-
const coords = textOf(xml);
|
|
103
|
-
if (!coords) {
|
|
104
|
-
throw new Error('invalid gml:pos element');
|
|
105
|
-
}
|
|
106
|
-
const points = parseCoords(coords, options, childContext);
|
|
107
|
-
if (points.length !== 1) {
|
|
108
|
-
throw new Error('gml:pos must have 1 point');
|
|
109
|
-
}
|
|
110
|
-
return points[0];
|
|
111
|
-
}
|
|
112
|
-
exports.parsePos = parsePos;
|
|
113
|
-
function parsePoint(xml, options, context) {
|
|
114
|
-
const childContext = createChildContext(xml, options, context);
|
|
115
|
-
// TODO AV: Parse other gml:Point options
|
|
116
|
-
const pos = findIn(xml, 'gml:pos');
|
|
117
|
-
if (!pos) {
|
|
118
|
-
throw new Error('invalid gml:Point element, expected a gml:pos subelement');
|
|
119
|
-
}
|
|
120
|
-
return parsePos(pos, options, childContext);
|
|
121
|
-
}
|
|
122
|
-
exports.parsePoint = parsePoint;
|
|
123
|
-
function parseLinearRingOrLineString(xml, options, context) {
|
|
124
|
-
// or a LineStringSegment
|
|
125
|
-
const childContext = createChildContext(xml, options, context);
|
|
126
|
-
let points = [];
|
|
127
|
-
const posList = findIn(xml, 'gml:posList');
|
|
128
|
-
if (posList) {
|
|
129
|
-
points = parsePosList(posList, options, childContext);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
for (const [childName, childXML] of Object.entries(xml)) {
|
|
133
|
-
switch (childName) {
|
|
134
|
-
case 'gml:Point':
|
|
135
|
-
points.push(parsePoint(childXML, options, childContext));
|
|
136
|
-
break;
|
|
137
|
-
case 'gml:pos':
|
|
138
|
-
points.push(parsePos(childXML, options, childContext));
|
|
139
|
-
break;
|
|
140
|
-
default:
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (points.length === 0) {
|
|
146
|
-
throw new Error(`${xml.name} must have > 0 points`);
|
|
147
|
-
}
|
|
148
|
-
return points;
|
|
149
|
-
}
|
|
150
|
-
exports.parseLinearRingOrLineString = parseLinearRingOrLineString;
|
|
151
|
-
function parseCurveSegments(xml, options, context) {
|
|
152
|
-
const points = [];
|
|
153
|
-
for (const [childName, childXML] of Object.entries(xml)) {
|
|
154
|
-
switch (childName) {
|
|
155
|
-
case 'gml:LineStringSegment':
|
|
156
|
-
const points2 = parseLinearRingOrLineString(childXML, options, context);
|
|
157
|
-
// remove overlapping
|
|
158
|
-
const end = points[points.length - 1];
|
|
159
|
-
const start = points2[0];
|
|
160
|
-
if (end && start && (0, deep_strict_equal_1.deepStrictEqual)(end, start)) {
|
|
161
|
-
points2.shift();
|
|
162
|
-
}
|
|
163
|
-
points.push(...points2);
|
|
164
|
-
break;
|
|
165
|
-
default:
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (points.length === 0) {
|
|
170
|
-
throw new Error('gml:Curve > gml:segments must have > 0 points');
|
|
171
|
-
}
|
|
172
|
-
return points;
|
|
173
|
-
}
|
|
174
|
-
exports.parseCurveSegments = parseCurveSegments;
|
|
175
|
-
function parseRing(xml, options, context) {
|
|
176
|
-
const childContext = createChildContext(xml, options, context);
|
|
177
|
-
const points = [];
|
|
178
|
-
for (const [childName, childXML] of Object.entries(xml)) {
|
|
179
|
-
switch (childName) {
|
|
180
|
-
case 'gml:curveMember':
|
|
181
|
-
let points2;
|
|
182
|
-
const lineString = findIn(childXML, 'gml:LineString');
|
|
183
|
-
if (lineString) {
|
|
184
|
-
points2 = parseLinearRingOrLineString(lineString, options, childContext);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
const segments = findIn(childXML, 'gml:Curve', 'gml:segments');
|
|
188
|
-
if (!segments) {
|
|
189
|
-
throw new Error(`invalid ${childName} element`);
|
|
190
|
-
}
|
|
191
|
-
points2 = parseCurveSegments(segments, options, childContext);
|
|
192
|
-
}
|
|
193
|
-
// remove overlapping
|
|
194
|
-
const end = points[points.length - 1];
|
|
195
|
-
const start = points2[0];
|
|
196
|
-
if (end && start && (0, deep_strict_equal_1.deepStrictEqual)(end, start)) {
|
|
197
|
-
points2.shift();
|
|
198
|
-
}
|
|
199
|
-
points.push(...points2);
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (points.length < 4) {
|
|
204
|
-
throw new Error(`${xml.name} must have >= 4 points`);
|
|
205
|
-
}
|
|
206
|
-
return points;
|
|
207
|
-
}
|
|
208
|
-
exports.parseRing = parseRing;
|
|
209
|
-
function parseExteriorOrInterior(xml, options, context) {
|
|
210
|
-
const linearRing = findIn(xml, 'gml:LinearRing');
|
|
211
|
-
if (linearRing) {
|
|
212
|
-
return parseLinearRingOrLineString(linearRing, options, context);
|
|
213
|
-
}
|
|
214
|
-
const ring = findIn(xml, 'gml:Ring');
|
|
215
|
-
if (!ring) {
|
|
216
|
-
throw new Error(`invalid ${xml.name} element`);
|
|
217
|
-
}
|
|
218
|
-
return parseRing(ring, options, context);
|
|
219
|
-
}
|
|
220
|
-
exports.parseExteriorOrInterior = parseExteriorOrInterior;
|
|
221
|
-
function parsePolygonOrRectangle(xml, options, context) {
|
|
222
|
-
// or PolygonPatch
|
|
223
|
-
const childContext = createChildContext(xml, options, context);
|
|
224
|
-
const exterior = findIn(xml, 'gml:exterior');
|
|
225
|
-
if (!exterior) {
|
|
226
|
-
throw new Error(`invalid ${xml.name} element`);
|
|
227
|
-
}
|
|
228
|
-
const pointLists = [parseExteriorOrInterior(exterior, options, childContext)];
|
|
229
|
-
for (const [childName, childXML] of Object.entries(xml)) {
|
|
230
|
-
switch (childName) {
|
|
231
|
-
case 'gml:interior':
|
|
232
|
-
pointLists.push(parseExteriorOrInterior(childXML, options, childContext));
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return pointLists;
|
|
237
|
-
}
|
|
238
|
-
exports.parsePolygonOrRectangle = parsePolygonOrRectangle;
|
|
239
|
-
function parseSurface(xml, options, context) {
|
|
240
|
-
const childContext = createChildContext(xml, options, context);
|
|
241
|
-
const patches = findIn(xml, 'gml:patches');
|
|
242
|
-
if (!patches) {
|
|
243
|
-
throw new Error(`invalid ${xml.name} element`);
|
|
244
|
-
}
|
|
245
|
-
const polygons = [];
|
|
246
|
-
for (const [childName, childXML] of Object.entries(xml)) {
|
|
247
|
-
switch (childName) {
|
|
248
|
-
case 'gml:PolygonPatch':
|
|
249
|
-
case 'gml:Rectangle':
|
|
250
|
-
polygons.push(parsePolygonOrRectangle(childXML, options, childContext));
|
|
251
|
-
break;
|
|
252
|
-
default:
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
if (polygons.length === 0) {
|
|
257
|
-
throw new Error(`${xml.name} must have > 0 polygons`);
|
|
258
|
-
}
|
|
259
|
-
return polygons;
|
|
260
|
-
}
|
|
261
|
-
exports.parseSurface = parseSurface;
|
|
262
|
-
function parseCompositeSurface(xml, options, context) {
|
|
263
|
-
const childContext = createChildContext(xml, options, context);
|
|
264
|
-
const polygons = [];
|
|
265
|
-
for (const [childName, childXML] of Object.entries(xml)) {
|
|
266
|
-
switch (childName) {
|
|
267
|
-
case 'gml:surfaceMember':
|
|
268
|
-
case 'gml:surfaceMembers':
|
|
269
|
-
const [c2Name, c2Xml] = getFirstKeyValue(childXML);
|
|
270
|
-
switch (c2Name) {
|
|
271
|
-
case 'gml:Surface':
|
|
272
|
-
polygons.push(...parseSurface(c2Xml, options, childContext));
|
|
273
|
-
break;
|
|
274
|
-
case 'gml:Polygon':
|
|
275
|
-
polygons.push(parsePolygonOrRectangle(c2Xml, options, childContext));
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (polygons.length === 0) {
|
|
282
|
-
throw new Error(`${xml.name} must have > 0 polygons`);
|
|
283
|
-
}
|
|
284
|
-
return polygons;
|
|
285
|
-
}
|
|
286
|
-
exports.parseCompositeSurface = parseCompositeSurface;
|
|
287
|
-
function parseMultiSurface(xml, options, context) {
|
|
288
|
-
let el = xml;
|
|
289
|
-
const surfaceMembers = findIn(xml, 'gml:LinearRing');
|
|
290
|
-
if (surfaceMembers) {
|
|
291
|
-
el = surfaceMembers;
|
|
292
|
-
}
|
|
293
|
-
const polygons = [];
|
|
294
|
-
for (const [childName, childXML] of Object.entries(el)) {
|
|
295
|
-
switch (childName) {
|
|
296
|
-
case 'gml:Surface':
|
|
297
|
-
const polygons2 = parseSurface(childXML, options, context);
|
|
298
|
-
polygons.push(...polygons2);
|
|
299
|
-
break;
|
|
300
|
-
case 'gml:surfaceMember':
|
|
301
|
-
const polygons3 = parseSurfaceMember(childXML, options, context);
|
|
302
|
-
polygons.push(...polygons3);
|
|
303
|
-
break;
|
|
304
|
-
case 'gml:surfaceMembers':
|
|
305
|
-
const polygonXML = findIn(childXML, 'gml:Polygon');
|
|
306
|
-
for (const surfaceMemberXML of polygonXML) {
|
|
307
|
-
const polygons3 = parseSurfaceMember(surfaceMemberXML, options, context);
|
|
308
|
-
polygons.push(...polygons3);
|
|
309
|
-
}
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
if (polygons.length === 0) {
|
|
314
|
-
throw new Error(`${xml.name} must have > 0 polygons`);
|
|
315
|
-
}
|
|
316
|
-
return polygons;
|
|
317
|
-
}
|
|
318
|
-
exports.parseMultiSurface = parseMultiSurface;
|
|
319
|
-
function parseSurfaceMember(xml, options, context) {
|
|
320
|
-
const [childName, childXml] = getFirstKeyValue(xml);
|
|
321
|
-
switch (childName) {
|
|
322
|
-
case 'gml:CompositeSurface':
|
|
323
|
-
return parseCompositeSurface(childXml, options, context);
|
|
324
|
-
case 'gml:Surface':
|
|
325
|
-
return parseSurface(childXml, options, context);
|
|
326
|
-
case 'gml:Polygon':
|
|
327
|
-
return [parsePolygonOrRectangle(childXml, options, context)];
|
|
328
|
-
}
|
|
329
|
-
throw new Error(`${childName} must have polygons`);
|
|
330
|
-
}
|
|
331
|
-
// Helpers
|
|
332
|
-
function textOf(el) {
|
|
333
|
-
if (typeof el !== 'string') {
|
|
334
|
-
throw new Error('expected string');
|
|
335
|
-
}
|
|
336
|
-
return el;
|
|
337
|
-
}
|
|
338
|
-
function findIn(root, ...tags) {
|
|
339
|
-
let el = root;
|
|
340
|
-
for (const tag of tags) {
|
|
341
|
-
const child = el[tag];
|
|
342
|
-
if (!child) {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
el = child;
|
|
346
|
-
}
|
|
347
|
-
return el;
|
|
348
|
-
}
|
|
349
|
-
/** @returns the first [key, value] pair in an object, or ['', null] if empty object */
|
|
350
|
-
function getFirstKeyValue(object) {
|
|
351
|
-
if (object && typeof object === 'object') {
|
|
352
|
-
for (const [key, value] of Object.entries(object)) {
|
|
353
|
-
return [key, value];
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
return ['', null];
|
|
357
|
-
}
|
|
358
|
-
/** A bit heavyweight for just tracking dimension? */
|
|
359
|
-
function createChildContext(xml, options, context) {
|
|
360
|
-
const srsDimensionAttribute = xml.attributes && xml.attributes.srsDimension;
|
|
361
|
-
if (srsDimensionAttribute) {
|
|
362
|
-
const srsDimension = parseInt(srsDimensionAttribute);
|
|
363
|
-
if (Number.isNaN(srsDimension) || srsDimension <= 0) {
|
|
364
|
-
throw new Error(`invalid srsDimension attribute value "${srsDimensionAttribute}", expected a positive integer`);
|
|
365
|
-
}
|
|
366
|
-
const childContext = Object.create(context);
|
|
367
|
-
childContext.srsDimension = srsDimension;
|
|
368
|
-
return childContext;
|
|
369
|
-
}
|
|
370
|
-
return context;
|
|
371
|
-
}
|