@loaders.gl/wms 3.3.0-alpha.12 → 3.3.0-alpha.14

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 (244) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +6 -0
  4. package/dist/dist.min.js +3990 -5373
  5. package/dist/es5/index.js +44 -16
  6. package/dist/es5/index.js.map +1 -1
  7. package/dist/es5/lerc-loader.js +74 -0
  8. package/dist/es5/lerc-loader.js.map +1 -0
  9. package/dist/es5/lib/data-sources/adhoc-image-service.js +129 -0
  10. package/dist/es5/lib/data-sources/adhoc-image-service.js.map +1 -0
  11. package/dist/es5/lib/data-sources/arcgis-image-service.js +180 -0
  12. package/dist/es5/lib/data-sources/arcgis-image-service.js.map +1 -0
  13. package/dist/es5/lib/data-sources/create-image-source.js +45 -0
  14. package/dist/es5/lib/data-sources/create-image-source.js.map +1 -0
  15. package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js +179 -0
  16. package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
  17. package/dist/es5/lib/data-sources/image-services/image-service.js +163 -0
  18. package/dist/es5/lib/data-sources/image-services/image-service.js.map +1 -0
  19. package/dist/es5/lib/data-sources/image-services/wms-service.js +400 -0
  20. package/dist/es5/lib/data-sources/image-services/wms-service.js.map +1 -0
  21. package/dist/es5/lib/data-sources/image-source.js +14 -0
  22. package/dist/es5/lib/data-sources/image-source.js.map +1 -0
  23. package/dist/es5/lib/gml/deep-strict-equal.js +64 -0
  24. package/dist/es5/lib/gml/deep-strict-equal.js.map +1 -0
  25. package/dist/es5/lib/gml/parse-gml.js +3 -3
  26. package/dist/es5/lib/gml/parse-gml.js.map +1 -1
  27. package/dist/es5/lib/lerc/lerc-types.js +2 -0
  28. package/dist/es5/lib/lerc/lerc-types.js.map +1 -0
  29. package/dist/es5/lib/wcs/parse-wcs.js +43 -0
  30. package/dist/es5/lib/wcs/parse-wcs.js.map +1 -0
  31. package/dist/es5/lib/wcs/wcs-types.js +2 -0
  32. package/dist/es5/lib/wcs/wcs-types.js.map +1 -0
  33. package/dist/es5/lib/wms/parse-wms.js +6 -4
  34. package/dist/es5/lib/wms/parse-wms.js.map +1 -1
  35. package/dist/es5/wip/arcgis-feature-service.js +45 -0
  36. package/dist/es5/wip/arcgis-feature-service.js.map +1 -0
  37. package/dist/es5/wip/data-source.js +4 -0
  38. package/dist/es5/wip/data-source.js.map +1 -0
  39. package/dist/es5/{gml-loader.js → wip/gml-loader.js} +2 -2
  40. package/dist/es5/wip/gml-loader.js.map +1 -0
  41. package/dist/es5/{wcs-capabilities-loader.js → wip/wcs-capabilities-loader.js} +5 -5
  42. package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -0
  43. package/dist/es5/{wfs-capabilities-loader.js → wip/wfs-capabilities-loader.js} +3 -3
  44. package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -0
  45. package/dist/es5/{wms-feature-info-loader.js → wip/wms-feature-info-loader.js} +3 -3
  46. package/dist/es5/wip/wms-feature-info-loader.js.map +1 -0
  47. package/dist/es5/{wms-layer-description-loader.js → wip/wms-layer-description-loader.js} +3 -3
  48. package/dist/es5/wip/wms-layer-description-loader.js.map +1 -0
  49. package/dist/es5/wip/wms-layer-description-loader.md +47 -0
  50. package/dist/es5/{wmts-capabilities-loader.js → wip/wmts-capabilities-loader.js} +3 -3
  51. package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -0
  52. package/dist/es5/wms-capabilities-loader.js +2 -2
  53. package/dist/es5/wms-capabilities-loader.js.map +1 -1
  54. package/dist/es5/wms-error-loader.js +22 -6
  55. package/dist/es5/wms-error-loader.js.map +1 -1
  56. package/dist/esm/index.js +12 -6
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/lerc-loader.js +25 -0
  59. package/dist/esm/lerc-loader.js.map +1 -0
  60. package/dist/esm/lib/data-sources/adhoc-image-service.js +43 -0
  61. package/dist/esm/lib/data-sources/adhoc-image-service.js.map +1 -0
  62. package/dist/esm/lib/data-sources/arcgis-image-service.js +62 -0
  63. package/dist/esm/lib/data-sources/arcgis-image-service.js.map +1 -0
  64. package/dist/esm/lib/data-sources/create-image-source.js +30 -0
  65. package/dist/esm/lib/data-sources/create-image-source.js.map +1 -0
  66. package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js +61 -0
  67. package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
  68. package/dist/esm/lib/data-sources/image-services/image-service.js +72 -0
  69. package/dist/esm/lib/data-sources/image-services/image-service.js.map +1 -0
  70. package/dist/esm/lib/data-sources/image-services/wms-service.js +190 -0
  71. package/dist/esm/lib/data-sources/image-services/wms-service.js.map +1 -0
  72. package/dist/esm/lib/data-sources/image-source.js +4 -0
  73. package/dist/esm/lib/data-sources/image-source.js.map +1 -0
  74. package/dist/esm/lib/gml/deep-strict-equal.js +57 -0
  75. package/dist/esm/lib/gml/deep-strict-equal.js.map +1 -0
  76. package/dist/esm/lib/gml/parse-gml.js +1 -1
  77. package/dist/esm/lib/gml/parse-gml.js.map +1 -1
  78. package/dist/esm/lib/lerc/lerc-types.js +2 -0
  79. package/dist/esm/lib/lerc/lerc-types.js.map +1 -0
  80. package/dist/esm/lib/wcs/parse-wcs.js +32 -0
  81. package/dist/esm/lib/wcs/parse-wcs.js.map +1 -0
  82. package/dist/esm/lib/wcs/wcs-types.js +2 -0
  83. package/dist/esm/lib/wcs/wcs-types.js.map +1 -0
  84. package/dist/esm/lib/wms/parse-wms.js +6 -4
  85. package/dist/esm/lib/wms/parse-wms.js.map +1 -1
  86. package/dist/esm/wip/arcgis-feature-service.js +28 -0
  87. package/dist/esm/wip/arcgis-feature-service.js.map +1 -0
  88. package/dist/esm/wip/data-source.js +2 -0
  89. package/dist/esm/wip/data-source.js.map +1 -0
  90. package/dist/esm/{gml-loader.js → wip/gml-loader.js} +2 -2
  91. package/dist/esm/wip/gml-loader.js.map +1 -0
  92. package/dist/esm/{wcs-capabilities-loader.js → wip/wcs-capabilities-loader.js} +3 -3
  93. package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -0
  94. package/dist/esm/{wfs-capabilities-loader.js → wip/wfs-capabilities-loader.js} +3 -3
  95. package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -0
  96. package/dist/esm/{wms-feature-info-loader.js → wip/wms-feature-info-loader.js} +3 -3
  97. package/dist/esm/wip/wms-feature-info-loader.js.map +1 -0
  98. package/dist/esm/{wms-layer-description-loader.js → wip/wms-layer-description-loader.js} +3 -3
  99. package/dist/esm/wip/wms-layer-description-loader.js.map +1 -0
  100. package/dist/esm/wip/wms-layer-description-loader.md +47 -0
  101. package/dist/esm/{wmts-capabilities-loader.js → wip/wmts-capabilities-loader.js} +3 -3
  102. package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -0
  103. package/dist/esm/wms-capabilities-loader.js +2 -2
  104. package/dist/esm/wms-capabilities-loader.js.map +1 -1
  105. package/dist/esm/wms-error-loader.js +20 -5
  106. package/dist/esm/wms-error-loader.js.map +1 -1
  107. package/dist/index.d.ts +27 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +33 -0
  110. package/dist/lerc-loader.d.ts +30 -0
  111. package/dist/lerc-loader.d.ts.map +1 -0
  112. package/dist/lerc-loader.js +56 -0
  113. package/dist/lib/data-sources/adhoc-image-service.d.ts +24 -0
  114. package/dist/lib/data-sources/adhoc-image-service.d.ts.map +1 -0
  115. package/dist/lib/data-sources/adhoc-image-service.js +46 -0
  116. package/dist/lib/data-sources/arcgis-image-service.d.ts +79 -0
  117. package/dist/lib/data-sources/arcgis-image-service.d.ts.map +1 -0
  118. package/dist/lib/data-sources/arcgis-image-service.js +85 -0
  119. package/dist/lib/data-sources/create-image-source.d.ts +16 -0
  120. package/dist/lib/data-sources/create-image-source.d.ts.map +1 -0
  121. package/dist/lib/data-sources/create-image-source.js +39 -0
  122. package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts +71 -0
  123. package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts.map +1 -0
  124. package/dist/lib/data-sources/image-services/arcgis-image-service.js +85 -0
  125. package/dist/lib/data-sources/image-services/image-service.d.ts +39 -0
  126. package/dist/lib/data-sources/image-services/image-service.d.ts.map +1 -0
  127. package/dist/lib/data-sources/image-services/image-service.js +82 -0
  128. package/dist/lib/data-sources/image-services/wms-service.d.ts +188 -0
  129. package/dist/lib/data-sources/image-services/wms-service.d.ts.map +1 -0
  130. package/dist/lib/data-sources/image-services/wms-service.js +218 -0
  131. package/dist/lib/data-sources/image-source.d.ts +73 -0
  132. package/dist/lib/data-sources/image-source.d.ts.map +1 -0
  133. package/dist/lib/data-sources/image-source.js +12 -0
  134. package/dist/lib/gml/deep-strict-equal.d.ts +3 -0
  135. package/dist/lib/gml/deep-strict-equal.d.ts.map +1 -0
  136. package/dist/lib/gml/deep-strict-equal.js +119 -0
  137. package/dist/lib/gml/parse-gml.d.ts +28 -0
  138. package/dist/lib/gml/parse-gml.d.ts.map +1 -0
  139. package/dist/lib/gml/parse-gml.js +371 -0
  140. package/dist/lib/lerc/lerc-types.d.ts +30 -0
  141. package/dist/lib/lerc/lerc-types.d.ts.map +1 -0
  142. package/dist/lib/lerc/lerc-types.js +3 -0
  143. package/dist/lib/wcs/parse-wcs.d.ts +7 -0
  144. package/dist/lib/wcs/parse-wcs.d.ts.map +1 -0
  145. package/dist/lib/wcs/parse-wcs.js +36 -0
  146. package/dist/lib/wcs/wcs-types.d.ts +73 -0
  147. package/dist/lib/wcs/wcs-types.d.ts.map +1 -0
  148. package/dist/lib/wcs/wcs-types.js +3 -0
  149. package/dist/lib/wfs/parse-wfs.d.ts +7 -0
  150. package/dist/lib/wfs/parse-wfs.d.ts.map +1 -0
  151. package/dist/lib/wfs/parse-wfs.js +36 -0
  152. package/dist/lib/wfs/wfs-types.d.ts +73 -0
  153. package/dist/lib/wfs/wfs-types.d.ts.map +1 -0
  154. package/dist/lib/wfs/wfs-types.js +3 -0
  155. package/dist/lib/wms/parse-wms.d.ts +24 -0
  156. package/dist/lib/wms/parse-wms.d.ts.map +1 -0
  157. package/dist/lib/wms/parse-wms.js +115 -0
  158. package/dist/lib/wms/wms-types.d.ts +100 -0
  159. package/dist/lib/wms/wms-types.d.ts.map +1 -0
  160. package/dist/lib/wms/wms-types.js +1908 -0
  161. package/dist/lib/wmts/parse-wmts.d.ts +7 -0
  162. package/dist/lib/wmts/parse-wmts.d.ts.map +1 -0
  163. package/dist/lib/wmts/parse-wmts.js +36 -0
  164. package/dist/lib/wmts/wmts-types.d.ts +73 -0
  165. package/dist/lib/wmts/wmts-types.d.ts.map +1 -0
  166. package/dist/lib/wmts/wmts-types.js +3 -0
  167. package/dist/wip/arcgis-feature-service.d.ts +56 -0
  168. package/dist/wip/arcgis-feature-service.d.ts.map +1 -0
  169. package/dist/wip/arcgis-feature-service.js +28 -0
  170. package/dist/wip/data-source.d.ts +54 -0
  171. package/dist/wip/data-source.d.ts.map +1 -0
  172. package/dist/wip/data-source.js +59 -0
  173. package/dist/wip/gml-loader.d.ts +26 -0
  174. package/dist/wip/gml-loader.d.ts.map +1 -0
  175. package/dist/wip/gml-loader.js +31 -0
  176. package/dist/wip/wcs-capabilities-loader.d.ts +26 -0
  177. package/dist/wip/wcs-capabilities-loader.d.ts.map +1 -0
  178. package/dist/wip/wcs-capabilities-loader.js +31 -0
  179. package/dist/wip/wfs-capabilities-loader.d.ts +26 -0
  180. package/dist/wip/wfs-capabilities-loader.d.ts.map +1 -0
  181. package/dist/wip/wfs-capabilities-loader.js +31 -0
  182. package/dist/wip/wms-feature-info-loader.d.ts +22 -0
  183. package/dist/wip/wms-feature-info-loader.d.ts.map +1 -0
  184. package/dist/wip/wms-feature-info-loader.js +17 -0
  185. package/dist/wip/wms-layer-description-loader.d.ts +22 -0
  186. package/dist/wip/wms-layer-description-loader.d.ts.map +1 -0
  187. package/dist/wip/wms-layer-description-loader.js +17 -0
  188. package/dist/wip/wmts-capabilities-loader.d.ts +26 -0
  189. package/dist/wip/wmts-capabilities-loader.d.ts.map +1 -0
  190. package/dist/wip/wmts-capabilities-loader.js +31 -0
  191. package/dist/wms-capabilities-loader.d.ts +26 -0
  192. package/dist/wms-capabilities-loader.d.ts.map +1 -0
  193. package/dist/wms-capabilities-loader.js +31 -0
  194. package/dist/wms-error-loader.d.ts +34 -0
  195. package/dist/wms-error-loader.d.ts.map +1 -0
  196. package/dist/wms-error-loader.js +43 -0
  197. package/package.json +9 -8
  198. package/src/index.ts +41 -15
  199. package/src/lerc-loader.ts +50 -0
  200. package/src/lib/data-sources/adhoc-image-service.ts +61 -0
  201. package/src/lib/data-sources/arcgis-image-service.ts +146 -0
  202. package/src/lib/data-sources/create-image-source.ts +46 -0
  203. package/src/lib/data-sources/image-services/arcgis-image-service.ts +136 -0
  204. package/src/lib/data-sources/image-services/image-service.ts +105 -0
  205. package/src/lib/data-sources/image-services/wms-service.ts +351 -0
  206. package/src/lib/data-sources/image-source.ts +82 -0
  207. package/src/lib/gml/deep-strict-equal.ts +119 -0
  208. package/src/lib/gml/parse-gml.ts +1 -1
  209. package/src/lib/lerc/lerc-types.ts +43 -0
  210. package/src/lib/wcs/parse-wcs.ts +39 -0
  211. package/src/lib/wcs/wcs-types.ts +77 -0
  212. package/src/lib/wms/parse-wms.ts +16 -3
  213. package/src/wip/arcgis-feature-service.ts +89 -0
  214. package/src/{lib/data-sources/image-data-source.ts → wip/data-source.ts} +20 -41
  215. package/src/{gml-loader.ts → wip/gml-loader.ts} +1 -1
  216. package/src/{wcs-capabilities-loader.ts → wip/wcs-capabilities-loader.ts} +2 -2
  217. package/src/{wfs-capabilities-loader.ts → wip/wfs-capabilities-loader.ts} +2 -2
  218. package/src/{wms-feature-info-loader.ts → wip/wms-feature-info-loader.ts} +3 -3
  219. package/src/wip/wms-layer-description-loader.md +47 -0
  220. package/src/{wms-layer-description-loader.ts → wip/wms-layer-description-loader.ts} +3 -3
  221. package/src/{wmts-capabilities-loader.ts → wip/wmts-capabilities-loader.ts} +2 -2
  222. package/src/wms-capabilities-loader.ts +1 -1
  223. package/src/wms-error-loader.ts +25 -6
  224. package/dist/es5/gml-loader.js.map +0 -1
  225. package/dist/es5/lib/data-sources/image-data-source.js +0 -4
  226. package/dist/es5/lib/data-sources/image-data-source.js.map +0 -1
  227. package/dist/es5/lib/data-sources/wms-service.js +0 -340
  228. package/dist/es5/lib/data-sources/wms-service.js.map +0 -1
  229. package/dist/es5/wcs-capabilities-loader.js.map +0 -1
  230. package/dist/es5/wfs-capabilities-loader.js.map +0 -1
  231. package/dist/es5/wms-feature-info-loader.js.map +0 -1
  232. package/dist/es5/wms-layer-description-loader.js.map +0 -1
  233. package/dist/es5/wmts-capabilities-loader.js.map +0 -1
  234. package/dist/esm/gml-loader.js.map +0 -1
  235. package/dist/esm/lib/data-sources/image-data-source.js +0 -2
  236. package/dist/esm/lib/data-sources/image-data-source.js.map +0 -1
  237. package/dist/esm/lib/data-sources/wms-service.js +0 -156
  238. package/dist/esm/lib/data-sources/wms-service.js.map +0 -1
  239. package/dist/esm/wcs-capabilities-loader.js.map +0 -1
  240. package/dist/esm/wfs-capabilities-loader.js.map +0 -1
  241. package/dist/esm/wms-feature-info-loader.js.map +0 -1
  242. package/dist/esm/wms-layer-description-loader.js.map +0 -1
  243. package/dist/esm/wmts-capabilities-loader.js.map +0 -1
  244. package/src/lib/data-sources/wms-service.ts +0 -313
@@ -0,0 +1,119 @@
1
+ // https://github.com/nodejs/node/commit/c1d82ac2ff15594840e2a1b9531b506ae067ed27;
2
+
3
+ // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
4
+ //
5
+ // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
6
+ //
7
+ // Originally from narwhal.js (http://narwhaljs.org)
8
+ // Copyright (c) 2009 Thomas Robinson <280north.com>
9
+ //
10
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ // of this software and associated documentation files (the 'Software'), to
12
+ // deal in the Software without restriction, including without limitation the
13
+ // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14
+ // sell copies of the Software, and to permit persons to whom the Software is
15
+ // furnished to do so, subject to the following conditions:
16
+ //
17
+ // The above copyright notice and this permission notice shall be included in
18
+ // all copies or substantial portions of the Software.
19
+ //
20
+ // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
+ // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ /** @todo replace this ridiculous choice of deepStrictEqual */
28
+ // eslint-disable-next-line complexity
29
+ export function deepStrictEqual(actual: unknown, expected: unknown, strict?: boolean) {
30
+ // 7.1. All identical values are equivalent, as determined by ===.
31
+ if (actual === expected) {
32
+ return true;
33
+ // } else if (actual instanceof Buffer && expected instanceof Buffer) {
34
+ // return compare(actual, expected) === 0;
35
+
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
+ } else if (actual instanceof Date && expected instanceof Date) {
39
+ return actual.getTime() === expected.getTime();
40
+
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
+ } else if (actual instanceof RegExp && expected instanceof RegExp) {
45
+ return (
46
+ 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
+ );
52
+
53
+ // 7.4. Other pairs that do not both pass typeof value == 'object',
54
+ // equivalence is determined by ==.
55
+ } else if (
56
+ (actual === null || typeof actual !== 'object') &&
57
+ (expected === null || typeof expected !== 'object')
58
+ ) {
59
+ // eslint-disable-next-line eqeqeq
60
+ return strict ? actual === expected : actual == expected;
61
+
62
+ // 7.5 For all other Object pairs, including Array objects, equivalence is
63
+ // determined by having the same number of owned properties (as verified
64
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
65
+ // (although not necessarily the same order), equivalent values for every
66
+ // corresponding key, and an identical 'prototype' property. Note: this
67
+ // accounts for both named and indexed properties on Arrays.
68
+ }
69
+ return objEquiv(actual, expected, strict);
70
+ }
71
+
72
+ // eslint-disable-next-line @typescript-eslint/unbound-method
73
+ const pSlice = Array.prototype.slice;
74
+
75
+ function isPrimitive(arg) {
76
+ return arg === null || (typeof arg !== 'object' && typeof arg !== 'function');
77
+ }
78
+
79
+ function isArguments(object) {
80
+ // eslint-disable-next-line eqeqeq
81
+ return Object.prototype.toString.call(object) == '[object Arguments]';
82
+ }
83
+
84
+ // eslint-disable-next-line complexity
85
+ function objEquiv(a: unknown, b: unknown, strict) {
86
+ if (a === null || a === undefined || b === null || b === undefined) return false;
87
+ // if one is a primitive, the other must be same
88
+ if (isPrimitive(a) || isPrimitive(b)) return a === b;
89
+ if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;
90
+ const aIsArgs = isArguments(a);
91
+ const bIsArgs = isArguments(b);
92
+ if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) return false;
93
+ if (aIsArgs) {
94
+ a = pSlice.call(a);
95
+ b = pSlice.call(b);
96
+ return deepStrictEqual(a, b, strict);
97
+ }
98
+ const ka = Object.keys(a);
99
+ const kb = Object.keys(b);
100
+ let key;
101
+ let i;
102
+ // having the same number of owned properties (keys incorporates
103
+ // hasOwnProperty)
104
+ if (ka.length !== kb.length) return false;
105
+ // the same set of keys (although not necessarily the same order),
106
+ ka.sort();
107
+ kb.sort();
108
+ // ~~~cheap key test
109
+ for (i = ka.length - 1; i >= 0; i--) {
110
+ if (ka[i] !== kb[i]) return false;
111
+ }
112
+ // equivalent values for every corresponding key, and
113
+ // ~~~possibly expensive deep test
114
+ for (i = ka.length - 1; i >= 0; i--) {
115
+ key = ka[i];
116
+ if (!deepStrictEqual(a[key], b[key], strict)) return false;
117
+ }
118
+ return true;
119
+ }
@@ -22,7 +22,7 @@ import type {
22
22
  } from '@loaders.gl/schema';
23
23
 
24
24
  import {XMLLoader} from '@loaders.gl/xml';
25
- import deepStrictEqual from 'deep-strict-equal';
25
+ import {deepStrictEqual} from './deep-strict-equal';
26
26
  import rewind from '@turf/rewind';
27
27
 
28
28
  function noTransform(...coords) {
@@ -0,0 +1,43 @@
1
+ // loaders.gl, MIT license
2
+
3
+ /** Data returned by LERC loader */
4
+ export type LERCData = {
5
+ /** Width of decoded image */
6
+ width: number;
7
+ /** Height of decoded image */
8
+ height: number;
9
+ /** The type of pixels represented in the output */
10
+ pixelType: LercPixelType;
11
+ /** [statistics_band1, statistics_band2, …] Each element is a statistics object representing min and max values */
12
+ statistics: BandStats[];
13
+ /** [band1, band2, …] Each band is a typed array of width * height * depthCount */
14
+ pixels: TypedArray[];
15
+ /** Typed array with a size of width*height, or null if all pixels are valid */
16
+ mask: Uint8Array;
17
+ /** Depth count */
18
+ depthCount: number;
19
+ /** array [band1_mask, band2_mask, …] Each band is a Uint8Array of width * height * depthCount */
20
+ bandMasks?: Uint8Array[];
21
+ };
22
+
23
+ export type LercPixelType = 'S8' | 'U8' | 'S16' | 'U16' | 'S32' | 'U32' | 'F32' | 'F64';
24
+
25
+ export interface BandStats {
26
+ minValue: number;
27
+ maxValue: number;
28
+ depthStats?: {
29
+ minValues: Float64Array;
30
+ maxValues: Float64Array;
31
+ };
32
+ }
33
+
34
+ export type TypedArray =
35
+ | Int8Array
36
+ | Uint8Array
37
+ | Uint8ClampedArray
38
+ | Int16Array
39
+ | Uint16Array
40
+ | Int32Array
41
+ | Uint32Array
42
+ | Float32Array
43
+ | Float64Array;
@@ -0,0 +1,39 @@
1
+ // loaders.gl, MIT license
2
+
3
+ import type {WFSCapabilities} from './wcs-types';
4
+
5
+ import {XMLLoader} from '@loaders.gl/xml';
6
+
7
+ // GetCapabilities
8
+
9
+ /**
10
+ * Parses a typed data structure from raw XML for `GetCapabilities` response
11
+ * @note Error handlings is fairly weak
12
+ */
13
+ export function parseWFSCapabilities(text: string, options): WFSCapabilities {
14
+ // Remove namespaces in XML
15
+ options = {...options, xml: {...options?.xml, removeNSPrefix: true}};
16
+ const parsedXML = XMLLoader.parseTextSync(text, options);
17
+ const xmlCapabilities: any = parsedXML.Capabilities || parsedXML;
18
+ return uncapitalizeKeys(xmlCapabilities);
19
+ }
20
+
21
+ function uncapitalizeKeys(object: any): any {
22
+ if (object && typeof object === 'object') {
23
+ const newObject = {};
24
+ for (const [key, value] of Object.entries(object)) {
25
+ newObject[uncapitalize(key)] = uncapitalizeKeys(value);
26
+ }
27
+ return newObject;
28
+ }
29
+ return object;
30
+ }
31
+
32
+ /**
33
+ * Uncapitalize first letter of a string
34
+ * @param {string} str
35
+ * @returns {string}
36
+ */
37
+ function uncapitalize(str: string): string {
38
+ return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;
39
+ }
@@ -0,0 +1,77 @@
1
+ // loaders.gl, MIT licenses
2
+
3
+ /** All capabilities of a WFS service - response to a WFS `GetCapabilities` data structure extracted from XML */
4
+ export type WFSCapabilities = {
5
+ serviceIdentification: {
6
+ title: string;
7
+ serviceTypeVersion: string;
8
+ serviceType: string;
9
+ };
10
+
11
+ serviceProvider: {
12
+ providerName: string;
13
+ providerSite: string;
14
+ serviceContact: {
15
+ individualName: string;
16
+ positionName: string;
17
+ contactInfo: {
18
+ address: {
19
+ administrativeArea: string;
20
+ city: string;
21
+ country: string;
22
+ deliveryPoint: string;
23
+ electronicMailAddress: string;
24
+ postalCode: string;
25
+ };
26
+ phone: {
27
+ voice: string;
28
+ };
29
+ };
30
+ };
31
+ };
32
+
33
+ operationsMetadata: {
34
+ GetCapabilities: any;
35
+ GetFeatureInfo: any;
36
+ GetTile: any;
37
+ };
38
+
39
+ contents: {
40
+ layers: {
41
+ abstract: string;
42
+ identifier: string;
43
+ title: string;
44
+ formats: string[];
45
+ styles: {
46
+ identifier: string;
47
+ isDefault: string;
48
+ title: string;
49
+ abstract?: string;
50
+ }[];
51
+ bounds: {
52
+ left: number;
53
+ right: number;
54
+ bottom: number;
55
+ top: number;
56
+ };
57
+ tileMatrixSetLinks: {
58
+ tileMatrixSet: string;
59
+ }[];
60
+ tileMatrixSets: {
61
+ identifier: string;
62
+ matrixIds: {
63
+ identifier: string;
64
+ matrixHeight: number;
65
+ matrixWidth: number;
66
+ scaleDenominator: number;
67
+ tileWidth: number;
68
+ tileHeight: number;
69
+ topLeftCorner: {
70
+ lon: number;
71
+ lat: number;
72
+ };
73
+ }[];
74
+ };
75
+ }[];
76
+ };
77
+ };
@@ -122,8 +122,21 @@ export function parseWMSLayerDescription(text: string, options): WMSLayerDescrip
122
122
  return parsedXML as unknown as WMSLayerDescription;
123
123
  }
124
124
 
125
+ /**
126
+ * Extract an error message from WMS error response XML
127
+ * @param text
128
+ * @param options
129
+ * @returns a string with a human readable message
130
+ */
125
131
  export function parseWMSError(text: string, options): string {
126
- const parsedXML = XMLLoader.parseTextSync(text, options);
127
- const error = parsedXML?.ServiceExceptionReport?.ServiceException || 'Unknown error';
128
- return String(error);
132
+ const parsedXML = XMLLoader.parseTextSync?.(text, options);
133
+ const serviceExceptionXML =
134
+ parsedXML?.ServiceExceptionReport?.ServiceException ||
135
+ parsedXML?.['ogc:ServiceExceptionReport']?.['ogc:ServiceException'];
136
+ // Sigh, can be either a string or an object
137
+ const message =
138
+ typeof serviceExceptionXML === 'string'
139
+ ? serviceExceptionXML
140
+ : serviceExceptionXML['#text'] || serviceExceptionXML.code || 'Unknown error';
141
+ return message;
129
142
  }
@@ -0,0 +1,89 @@
1
+ // @ts-nocheck
2
+
3
+ import {LoaderOptions} from '@loaders.gl/loader-utils';
4
+ // import {GeoJSONLoader} from '@loaders.gl/geojson';
5
+
6
+ type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;
7
+
8
+ export type ArcGISImageServiceQueryOptions = {
9
+ returnGeometry: boolean;
10
+ where: '1%3D1';
11
+ outSR: 4326;
12
+ outFields: string | '*';
13
+ inSR: 4326;
14
+ geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`;
15
+ geometryType: 'esriGeometryEnvelope'; // TODO - look up valid values in Esri docs
16
+ spatialRel: 'esriSpatialRelIntersects'; // TODO - look up valid values in Esri docs
17
+ geometryPrecision: number; // TODO - look up valid values in Esri docs
18
+ resultType: 'tile'; // TODO - look up valid values in Esri docs
19
+ f?: 'geojson'; // TODO - look up valid values in Esri docs
20
+ }
21
+
22
+ // const DEFAULT_QUERY_OPTIONS: Required<ArcGISImageServiceQueryOptions> = {
23
+ // returnGeometry:true,
24
+ // where: '1%3D1',
25
+ // outSR: 4326,
26
+ // outFields: '*',
27
+ // inSR: 4326,
28
+ // geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`,
29
+ // geometryType: 'esriGeometryEnvelope',
30
+ // spatialRel: 'esriSpatialRelIntersects',
31
+ // geometryPrecision: 6,
32
+ // resultType: 'tile',
33
+ // f: 'geojson'
34
+ // };
35
+
36
+ export type ArcGISFeatureServiceProps = ArcGISImageServiceQueryOptions & {
37
+ url: string;
38
+ loadOptions?: LoaderOptions;
39
+ fetch?: typeof fetch | FetchLike;
40
+ };
41
+
42
+ export class ArcGISFeatureService {
43
+ url: string;
44
+ loadOptions: LoaderOptions;
45
+ fetch: typeof fetch | FetchLike;
46
+
47
+ constructor(props: ArcGISFeatureServiceProps) {
48
+ this.url = props.url;
49
+ this.loadOptions = props.loadOptions || {};
50
+ this.fetch = props.fetch || fetch;
51
+ }
52
+
53
+ // URL creators
54
+
55
+ metadataURL(options: {parameters?: Record<string, unknown>}): string {
56
+ return this.getUrl({...options});
57
+ }
58
+
59
+ /**
60
+ * Form a URL to an ESRI FeatureServer
61
+ // https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?
62
+ // returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&
63
+ // geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`
64
+ */
65
+ exportImageURL(options: {
66
+ boundingBox: [number, number, number, number];
67
+ boundingBoxSR?: string;
68
+ width: number;
69
+ height: number;
70
+ imageSR?: string;
71
+ time?: never;
72
+ f?: 'geojson';
73
+ resultType?: 'tile';
74
+ noData?: never;
75
+ noDataInterpretation?: 'esriNoDataMatchAny';
76
+ interpolation?: '+RSP_NearestNeighbor';
77
+ compression?: never
78
+ compressionQuality?: never;
79
+ bandIds?: never;
80
+ mosaicRule?: never;
81
+ renderingRule?: never;
82
+ f?: 'image';
83
+ }): string {
84
+ const {boundingBox} = options;
85
+ // const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;
86
+ // const size = `size=${width},${height}`
87
+ return this.getUrl({path: 'exportImage', });
88
+ }
89
+ }
@@ -1,51 +1,16 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
- // from '@loaders.gl/images';
3
+ /** General data source class */
4
+ // export abstract class DataSource {};
5
+ // export type DataSourceMetadata = {};
4
6
 
5
- /** General data source class *
6
- export abstract class DataSource {};
7
+ // ImageSource
8
+
9
+ // Tile Source
7
10
 
8
11
  /** Data source that serves data by tile index *
9
12
  export abstract class TileDataSource extends DataSource {};
10
13
 
11
- export type ImageFeatureInfo = {};
12
-
13
- export type ImageLayerInfo = {};
14
-
15
- export type ImageDataSourceCapabilities = {}
16
-
17
- /**
18
- * ImageDataSource - data sources that allow data to be queried by (geospatial) extents
19
- * @note
20
- * - If geospatial, bounding box is expected to be in web mercator coordinates
21
- *
22
- export abstract class ImageDataSource extends DataSource {
23
- abstract getCapabilities(): Promise<ImageDataSourceCapabilities>;
24
- abstract getImage({boundingBox, width, height, layers, parameters}): Promise<ImageType>;
25
- getFeatureInfo({layers, parameters}): Promise<ImageFeatureInfo> {
26
- throw new Error('not implemented');
27
- }
28
- getLayerInfo({layers, parameters}): Promise<ImageLayerInfo> {
29
- throw new Error('not implemented');
30
- }
31
- getLegendImage({layers, parameters}): Promise<ImageType> {
32
- throw new Error('not implemented');
33
- }
34
- }
35
-
36
- // Vector Tile Data Source
37
-
38
- export type VectorTileDataSourceCapabilities = {
39
- // check tile.json
40
- }
41
-
42
- export type VectorTile = Record<string, any>;
43
-
44
- export abstract class VectorTileDataSource extends TileDataSource {
45
- abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;
46
- abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;
47
- }
48
-
49
14
  // Image Tile Data Source
50
15
 
51
16
  export type ImageTileDataSourceCapabilities = {
@@ -80,4 +45,18 @@ export abstract class ImageTileDataSource extends TileDataSource {
80
45
  return [0, 0, 1, 1];
81
46
  }
82
47
  }
48
+
49
+ // Vector Tile Source
50
+
51
+ export type VectorTileDataSourceCapabilities = {
52
+ // check tile.json
53
+ }
54
+
55
+ export type VectorTile = Record<string, any>;
56
+
57
+ export abstract class VectorTileDataSource extends TileDataSource {
58
+ abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;
59
+ abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;
60
+ }
61
+
83
62
  */
@@ -1,7 +1,7 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
4
- import {parseGML} from './lib/gml/parse-gml';
4
+ import {parseGML} from '../lib/gml/parse-gml';
5
5
 
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -1,7 +1,7 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
4
- import {parseWFSCapabilities} from './lib/wfs/parse-wfs';
4
+ import {parseWFSCapabilities} from '../lib/wcs/parse-wcs';
5
5
 
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -15,8 +15,8 @@ export type WCSLoaderOptions = LoaderOptions & {
15
15
  * Loader for the response to the WCS GetCapability request
16
16
  */
17
17
  export const WCSCapabilitiesLoader = {
18
- name: 'WFS Capabilities',
19
18
  id: 'wcs-capabilities',
19
+ name: 'WFS Capabilities',
20
20
 
21
21
  module: 'wms',
22
22
  version: VERSION,
@@ -1,7 +1,7 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
4
- import {parseWFSCapabilities} from './lib/wfs/parse-wfs';
4
+ import {parseWFSCapabilities} from '../lib/wfs/parse-wfs';
5
5
 
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -15,8 +15,8 @@ export type WFSLoaderOptions = LoaderOptions & {
15
15
  * Loader for the response to the WFS GetCapability request
16
16
  */
17
17
  export const WFSCapabilitiesLoader = {
18
- name: 'WFS Capabilities',
19
18
  id: 'wfs-capabilities',
19
+ name: 'WFS Capabilities',
20
20
 
21
21
  module: 'wms',
22
22
  version: VERSION,
@@ -1,8 +1,8 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser} from '@loaders.gl/loader-utils';
4
- import {WMSCapabilitiesLoader, WMSLoaderOptions} from './wms-capabilities-loader';
5
- import {parseWMSFeatureInfo} from './lib/wms/parse-wms';
4
+ import {WMSCapabilitiesLoader, WMSLoaderOptions} from '../wms-capabilities-loader';
5
+ import {parseWMSFeatureInfo} from '../lib/wms/parse-wms';
6
6
 
7
7
  /**
8
8
  * Loader for the response to the WMS GetFeatureInfo request
@@ -10,8 +10,8 @@ import {parseWMSFeatureInfo} from './lib/wms/parse-wms';
10
10
  export const WMSFeatureInfoLoader = {
11
11
  ...WMSCapabilitiesLoader,
12
12
 
13
- name: 'WMS FeatureInfo',
14
13
  id: 'wms-feature-info',
14
+ name: 'WMS FeatureInfo',
15
15
 
16
16
  parse: async (arrayBuffer: ArrayBuffer, options?: WMSLoaderOptions) =>
17
17
  parseWMSFeatureInfo(new TextDecoder().decode(arrayBuffer), options),
@@ -0,0 +1,47 @@
1
+ # WMSLayerDescriptionLoader
2
+
3
+ <p class="badges">
4
+ <img src="https://img.shields.io/badge/From-v3.3-blue.svg?style=flat-square" alt="From-v3.3" />
5
+ <img src="https://img.shields.io/badge/-BETA-teal.svg" alt="BETA" />
6
+ </p>
7
+
8
+ The `WMSLayerDescriptionLoader` parses the XML-formatted response from the
9
+ the [OGC](https://www.opengeospatial.org/) [WMS](https://www.ogc.org/standards/wms) (Web Map Service) standard `DescribeLayer` request into a typed JavaScript data structure.
10
+
11
+ > Note that the WMS standard is rather verbose and the XML responses can contain many rarely used metadata fields, not all of which are extracted by this loader. If this is a problem, it is possible to use the `XMLLoader` directly though the result will be untyped and not normalized.
12
+
13
+ | Loader | Characteristic |
14
+ | --------------------- | ---------------------------------------------------- |
15
+ | File Extension | `.xml` |
16
+ | File Type | Text |
17
+ | File Format | [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) |
18
+ | Data Format | Data structure |
19
+ | Decoder Type | Synchronous |
20
+ | Worker Thread Support | No |
21
+ | Streaming Support | No |
22
+
23
+ ## Usage
24
+
25
+ ```js
26
+ import {WMSLayerDescriptionLoader} from '@loaders.gl/wms';
27
+ import {load} from '@loaders.gl/core';
28
+
29
+ // Form a WMS request
30
+ const url = `${WMS_SERVICE_URL}?REQUEST=DescribeLayer&LAYER=...`;
31
+
32
+ const data = await load(url, WMSLayerDescriptionLoader, options);
33
+ ```
34
+
35
+ ## Parsed Data Format
36
+
37
+ ```typescript
38
+ /** All capabilities of a WMS service. Typed data structure extracted from XML */
39
+ export type WMSLayerDescription = {
40
+ // TO BE DOCUMENTED
41
+ }
42
+ ```
43
+
44
+ ## Options
45
+
46
+ | Option | Type | Default | Description |
47
+ | ------ | ---- | ------- | ----------- |
@@ -1,8 +1,8 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser} from '@loaders.gl/loader-utils';
4
- import {WMSCapabilitiesLoader, WMSLoaderOptions} from './wms-capabilities-loader';
5
- import {parseWMSLayerDescription} from './lib/wms/parse-wms';
4
+ import {WMSCapabilitiesLoader, WMSLoaderOptions} from '../wms-capabilities-loader';
5
+ import {parseWMSLayerDescription} from '../lib/wms/parse-wms';
6
6
 
7
7
  /**
8
8
  * Loader for the response to the WMS DescribeLayer request
@@ -10,8 +10,8 @@ import {parseWMSLayerDescription} from './lib/wms/parse-wms';
10
10
  export const WMSLayerDescriptionLoader = {
11
11
  ...WMSCapabilitiesLoader,
12
12
 
13
- name: 'WMS DescribeLayer',
14
13
  id: 'wms-layer-description',
14
+ name: 'WMS DescribeLayer',
15
15
 
16
16
  parse: async (arrayBuffer: ArrayBuffer, options?: WMSLoaderOptions) =>
17
17
  parseWMSLayerDescription(new TextDecoder().decode(arrayBuffer), options),
@@ -1,7 +1,7 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
4
- import {parseWMTSCapabilities} from './lib/wmts/parse-wmts';
4
+ import {parseWMTSCapabilities} from '../lib/wmts/parse-wmts';
5
5
 
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -15,8 +15,8 @@ export type WMTSLoaderOptions = LoaderOptions & {
15
15
  * Loader for the response to the WMTS GetCapability request
16
16
  */
17
17
  export const WMTSCapabilitiesLoader = {
18
- name: 'WMTS Capabilities',
19
18
  id: 'wmts-capabilities',
19
+ name: 'WMTS Capabilities',
20
20
 
21
21
  module: 'wms',
22
22
  version: VERSION,
@@ -15,8 +15,8 @@ export type WMSLoaderOptions = LoaderOptions & {
15
15
  * Loader for the response to the WMS GetCapability request
16
16
  */
17
17
  export const WMSCapabilitiesLoader = {
18
- name: 'WMS Capabilities',
19
18
  id: 'wms-capabilities',
19
+ name: 'WMS Capabilities',
20
20
 
21
21
  module: 'wms',
22
22
  version: VERSION,