@loaders.gl/ogc 0.0.0-stage → 5.0.0-alpha.13

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 (382) hide show
  1. package/README.md +10 -2
  2. package/dist/index.cjs +7052 -0
  3. package/dist/index.cjs.map +6 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +6 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/stac/index.cjs +1095 -0
  9. package/dist/stac/index.cjs.map +6 -0
  10. package/dist/stac/index.d.ts +4 -0
  11. package/dist/stac/index.d.ts.map +1 -0
  12. package/dist/stac/index.js +5 -0
  13. package/dist/stac/index.js.map +1 -0
  14. package/dist/stac/stac-source-loader-types.d.ts +44 -0
  15. package/dist/stac/stac-source-loader-types.d.ts.map +1 -0
  16. package/dist/stac/stac-source-loader-types.js +43 -0
  17. package/dist/stac/stac-source-loader-types.js.map +1 -0
  18. package/dist/stac/stac-source.cjs +1544 -0
  19. package/dist/stac/stac-source.cjs.map +6 -0
  20. package/dist/stac/stac-source.d.ts +92 -0
  21. package/dist/stac/stac-source.d.ts.map +1 -0
  22. package/dist/stac/stac-source.js +500 -0
  23. package/dist/stac/stac-source.js.map +1 -0
  24. package/dist/stac/stac-types.d.ts +213 -0
  25. package/dist/stac/stac-types.d.ts.map +1 -0
  26. package/dist/stac/stac-types.js +5 -0
  27. package/dist/stac/stac-types.js.map +1 -0
  28. package/dist/wms/bundled.cjs +7295 -0
  29. package/dist/wms/bundled.cjs.map +6 -0
  30. package/dist/wms/bundled.d.ts +24 -0
  31. package/dist/wms/bundled.d.ts.map +1 -0
  32. package/dist/wms/bundled.js +18 -0
  33. package/dist/wms/bundled.js.map +1 -0
  34. package/dist/wms/capability-graph.d.ts +42 -0
  35. package/dist/wms/capability-graph.d.ts.map +1 -0
  36. package/dist/wms/capability-graph.js +118 -0
  37. package/dist/wms/capability-graph.js.map +1 -0
  38. package/dist/wms/crs-utils.d.ts +24 -0
  39. package/dist/wms/crs-utils.d.ts.map +1 -0
  40. package/dist/wms/crs-utils.js +57 -0
  41. package/dist/wms/crs-utils.js.map +1 -0
  42. package/dist/wms/csw-capabilities-loader-with-parser.d.ts +34 -0
  43. package/dist/wms/csw-capabilities-loader-with-parser.d.ts.map +1 -0
  44. package/dist/wms/csw-capabilities-loader-with-parser.js +15 -0
  45. package/dist/wms/csw-capabilities-loader-with-parser.js.map +1 -0
  46. package/dist/wms/csw-capabilities-loader.d.ts +56 -0
  47. package/dist/wms/csw-capabilities-loader.d.ts.map +1 -0
  48. package/dist/wms/csw-capabilities-loader.js +38 -0
  49. package/dist/wms/csw-capabilities-loader.js.map +1 -0
  50. package/dist/wms/csw-domain-loader-with-parser.d.ts +33 -0
  51. package/dist/wms/csw-domain-loader-with-parser.d.ts.map +1 -0
  52. package/dist/wms/csw-domain-loader-with-parser.js +15 -0
  53. package/dist/wms/csw-domain-loader-with-parser.js.map +1 -0
  54. package/dist/wms/csw-domain-loader.d.ts +55 -0
  55. package/dist/wms/csw-domain-loader.d.ts.map +1 -0
  56. package/dist/wms/csw-domain-loader.js +38 -0
  57. package/dist/wms/csw-domain-loader.js.map +1 -0
  58. package/dist/wms/csw-records-loader-with-parser.d.ts +33 -0
  59. package/dist/wms/csw-records-loader-with-parser.d.ts.map +1 -0
  60. package/dist/wms/csw-records-loader-with-parser.js +15 -0
  61. package/dist/wms/csw-records-loader-with-parser.js.map +1 -0
  62. package/dist/wms/csw-records-loader.d.ts +55 -0
  63. package/dist/wms/csw-records-loader.d.ts.map +1 -0
  64. package/dist/wms/csw-records-loader.js +38 -0
  65. package/dist/wms/csw-records-loader.js.map +1 -0
  66. package/dist/wms/csw-source-loader.d.ts +165 -0
  67. package/dist/wms/csw-source-loader.d.ts.map +1 -0
  68. package/dist/wms/csw-source-loader.js +203 -0
  69. package/dist/wms/csw-source-loader.js.map +1 -0
  70. package/dist/wms/feature-pagination.d.ts +34 -0
  71. package/dist/wms/feature-pagination.d.ts.map +1 -0
  72. package/dist/wms/feature-pagination.js +159 -0
  73. package/dist/wms/feature-pagination.js.map +1 -0
  74. package/dist/wms/gml-loader-types.d.ts +68 -0
  75. package/dist/wms/gml-loader-types.d.ts.map +1 -0
  76. package/dist/wms/gml-loader-types.js +38 -0
  77. package/dist/wms/gml-loader-types.js.map +1 -0
  78. package/dist/wms/gml-loader.cjs +5779 -0
  79. package/dist/wms/gml-loader.cjs.map +6 -0
  80. package/dist/wms/gml-loader.d.ts +38 -0
  81. package/dist/wms/gml-loader.d.ts.map +1 -0
  82. package/dist/wms/gml-loader.js +195 -0
  83. package/dist/wms/gml-loader.js.map +1 -0
  84. package/dist/wms/index.cjs +12416 -0
  85. package/dist/wms/index.cjs.map +6 -0
  86. package/dist/wms/index.d.ts +61 -0
  87. package/dist/wms/index.d.ts.map +1 -0
  88. package/dist/wms/index.js +36 -0
  89. package/dist/wms/index.js.map +1 -0
  90. package/dist/wms/lib/deprecated/create-image-source.d.ts +27 -0
  91. package/dist/wms/lib/deprecated/create-image-source.d.ts.map +1 -0
  92. package/dist/wms/lib/deprecated/create-image-source.js +44 -0
  93. package/dist/wms/lib/deprecated/create-image-source.js.map +1 -0
  94. package/dist/wms/lib/deprecated/image-source-compatibility.d.ts +14 -0
  95. package/dist/wms/lib/deprecated/image-source-compatibility.d.ts.map +1 -0
  96. package/dist/wms/lib/deprecated/image-source-compatibility.js +21 -0
  97. package/dist/wms/lib/deprecated/image-source-compatibility.js.map +1 -0
  98. package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts +79 -0
  99. package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts.map +1 -0
  100. package/dist/wms/lib/parsers/csw/parse-csw-capabilities.js +23 -0
  101. package/dist/wms/lib/parsers/csw/parse-csw-capabilities.js.map +1 -0
  102. package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts +17 -0
  103. package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts.map +1 -0
  104. package/dist/wms/lib/parsers/csw/parse-csw-domain.js +32 -0
  105. package/dist/wms/lib/parsers/csw/parse-csw-domain.js.map +1 -0
  106. package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts +34 -0
  107. package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts.map +1 -0
  108. package/dist/wms/lib/parsers/csw/parse-csw-records.js +56 -0
  109. package/dist/wms/lib/parsers/csw/parse-csw-records.js.map +1 -0
  110. package/dist/wms/lib/parsers/csw/parse-exception-report.d.ts +6 -0
  111. package/dist/wms/lib/parsers/csw/parse-exception-report.d.ts.map +1 -0
  112. package/dist/wms/lib/parsers/csw/parse-exception-report.js +29 -0
  113. package/dist/wms/lib/parsers/csw/parse-exception-report.js.map +1 -0
  114. package/dist/wms/lib/parsers/gml/deep-strict-equal.d.ts +3 -0
  115. package/dist/wms/lib/parsers/gml/deep-strict-equal.d.ts.map +1 -0
  116. package/dist/wms/lib/parsers/gml/deep-strict-equal.js +118 -0
  117. package/dist/wms/lib/parsers/gml/deep-strict-equal.js.map +1 -0
  118. package/dist/wms/lib/parsers/gml/parse-gml.d.ts +66 -0
  119. package/dist/wms/lib/parsers/gml/parse-gml.d.ts.map +1 -0
  120. package/dist/wms/lib/parsers/gml/parse-gml.js +641 -0
  121. package/dist/wms/lib/parsers/gml/parse-gml.js.map +1 -0
  122. package/dist/wms/lib/parsers/gml/rewind-geometry.d.ts +4 -0
  123. package/dist/wms/lib/parsers/gml/rewind-geometry.d.ts.map +1 -0
  124. package/dist/wms/lib/parsers/gml/rewind-geometry.js +45 -0
  125. package/dist/wms/lib/parsers/gml/rewind-geometry.js.map +1 -0
  126. package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.d.ts +19 -0
  127. package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.d.ts.map +1 -0
  128. package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.js +74 -0
  129. package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.js.map +1 -0
  130. package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.d.ts +63 -0
  131. package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.d.ts.map +1 -0
  132. package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.js +82 -0
  133. package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.js.map +1 -0
  134. package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.d.ts +97 -0
  135. package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.d.ts.map +1 -0
  136. package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.js +60 -0
  137. package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.js.map +1 -0
  138. package/dist/wms/lib/parsers/wfs/parse-wfs.d.ts +7 -0
  139. package/dist/wms/lib/parsers/wfs/parse-wfs.d.ts.map +1 -0
  140. package/dist/wms/lib/parsers/wfs/parse-wfs.js +31 -0
  141. package/dist/wms/lib/parsers/wfs/parse-wfs.js.map +1 -0
  142. package/dist/wms/lib/parsers/wms/parse-wms-capabilities.d.ts +126 -0
  143. package/dist/wms/lib/parsers/wms/parse-wms-capabilities.d.ts.map +1 -0
  144. package/dist/wms/lib/parsers/wms/parse-wms-capabilities.js +232 -0
  145. package/dist/wms/lib/parsers/wms/parse-wms-capabilities.js.map +1 -0
  146. package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts +8 -0
  147. package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts.map +1 -0
  148. package/dist/wms/lib/parsers/wms/parse-wms-error.js +21 -0
  149. package/dist/wms/lib/parsers/wms/parse-wms-error.js.map +1 -0
  150. package/dist/wms/lib/parsers/wms/parse-wms-features.d.ts +20 -0
  151. package/dist/wms/lib/parsers/wms/parse-wms-features.d.ts.map +1 -0
  152. package/dist/wms/lib/parsers/wms/parse-wms-features.js +26 -0
  153. package/dist/wms/lib/parsers/wms/parse-wms-features.js.map +1 -0
  154. package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts +11 -0
  155. package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts.map +1 -0
  156. package/dist/wms/lib/parsers/wms/parse-wms-layer-description.js +14 -0
  157. package/dist/wms/lib/parsers/wms/parse-wms-layer-description.js.map +1 -0
  158. package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.d.ts +101 -0
  159. package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.d.ts.map +1 -0
  160. package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js +175 -0
  161. package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js.map +1 -0
  162. package/dist/wms/lib/parsers/xml/parse-xml-helpers.d.ts +11 -0
  163. package/dist/wms/lib/parsers/xml/parse-xml-helpers.d.ts.map +1 -0
  164. package/dist/wms/lib/parsers/xml/parse-xml-helpers.js +63 -0
  165. package/dist/wms/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
  166. package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts +4 -0
  167. package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts.map +1 -0
  168. package/dist/wms/lib/parsers/xml/parse-xml-text.js +9 -0
  169. package/dist/wms/lib/parsers/xml/parse-xml-text.js.map +1 -0
  170. package/dist/wms/lib/tile-grid.d.ts +14 -0
  171. package/dist/wms/lib/tile-grid.d.ts.map +1 -0
  172. package/dist/wms/lib/tile-grid.js +28 -0
  173. package/dist/wms/lib/tile-grid.js.map +1 -0
  174. package/dist/wms/managed-vector-source.d.ts +66 -0
  175. package/dist/wms/managed-vector-source.d.ts.map +1 -0
  176. package/dist/wms/managed-vector-source.js +307 -0
  177. package/dist/wms/managed-vector-source.js.map +1 -0
  178. package/dist/wms/ogc-api-coverages-source-loader.d.ts +64 -0
  179. package/dist/wms/ogc-api-coverages-source-loader.d.ts.map +1 -0
  180. package/dist/wms/ogc-api-coverages-source-loader.js +78 -0
  181. package/dist/wms/ogc-api-coverages-source-loader.js.map +1 -0
  182. package/dist/wms/ogc-api-edr-source-loader.d.ts +72 -0
  183. package/dist/wms/ogc-api-edr-source-loader.d.ts.map +1 -0
  184. package/dist/wms/ogc-api-edr-source-loader.js +82 -0
  185. package/dist/wms/ogc-api-edr-source-loader.js.map +1 -0
  186. package/dist/wms/ogc-api-source-loader.d.ts +223 -0
  187. package/dist/wms/ogc-api-source-loader.d.ts.map +1 -0
  188. package/dist/wms/ogc-api-source-loader.js +517 -0
  189. package/dist/wms/ogc-api-source-loader.js.map +1 -0
  190. package/dist/wms/service-capabilities.d.ts +17 -0
  191. package/dist/wms/service-capabilities.d.ts.map +1 -0
  192. package/dist/wms/service-capabilities.js +110 -0
  193. package/dist/wms/service-capabilities.js.map +1 -0
  194. package/dist/wms/service-runtime.d.ts +67 -0
  195. package/dist/wms/service-runtime.d.ts.map +1 -0
  196. package/dist/wms/service-runtime.js +165 -0
  197. package/dist/wms/service-runtime.js.map +1 -0
  198. package/dist/wms/unbundled.cjs +5995 -0
  199. package/dist/wms/unbundled.cjs.map +6 -0
  200. package/dist/wms/unbundled.d.ts +18 -0
  201. package/dist/wms/unbundled.d.ts.map +1 -0
  202. package/dist/wms/unbundled.js +12 -0
  203. package/dist/wms/unbundled.js.map +1 -0
  204. package/dist/wms/wcs-source-loader.d.ts +99 -0
  205. package/dist/wms/wcs-source-loader.d.ts.map +1 -0
  206. package/dist/wms/wcs-source-loader.js +178 -0
  207. package/dist/wms/wcs-source-loader.js.map +1 -0
  208. package/dist/wms/wfs-capabilities-loader-with-parser.d.ts +35 -0
  209. package/dist/wms/wfs-capabilities-loader-with-parser.d.ts.map +1 -0
  210. package/dist/wms/wfs-capabilities-loader-with-parser.js +17 -0
  211. package/dist/wms/wfs-capabilities-loader-with-parser.js.map +1 -0
  212. package/dist/wms/wfs-capabilities-loader.d.ts +59 -0
  213. package/dist/wms/wfs-capabilities-loader.d.ts.map +1 -0
  214. package/dist/wms/wfs-capabilities-loader.js +42 -0
  215. package/dist/wms/wfs-capabilities-loader.js.map +1 -0
  216. package/dist/wms/wfs-source-loader.d.ts +353 -0
  217. package/dist/wms/wfs-source-loader.d.ts.map +1 -0
  218. package/dist/wms/wfs-source-loader.js +606 -0
  219. package/dist/wms/wfs-source-loader.js.map +1 -0
  220. package/dist/wms/wip/data-source.d.ts +54 -0
  221. package/dist/wms/wip/data-source.d.ts.map +1 -0
  222. package/dist/wms/wip/data-source.js +62 -0
  223. package/dist/wms/wip/data-source.js.map +1 -0
  224. package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.d.ts +78 -0
  225. package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.d.ts.map +1 -0
  226. package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.js +14 -0
  227. package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -0
  228. package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.d.ts +87 -0
  229. package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.d.ts.map +1 -0
  230. package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.js +76 -0
  231. package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -0
  232. package/dist/wms/wip/lib/wmts/parse-wmts.d.ts +7 -0
  233. package/dist/wms/wip/lib/wmts/parse-wmts.d.ts.map +1 -0
  234. package/dist/wms/wip/lib/wmts/parse-wmts.js +34 -0
  235. package/dist/wms/wip/lib/wmts/parse-wmts.js.map +1 -0
  236. package/dist/wms/wip/wcs-capabilities-loader-with-parser.d.ts +12 -0
  237. package/dist/wms/wip/wcs-capabilities-loader-with-parser.d.ts.map +1 -0
  238. package/dist/wms/wip/wcs-capabilities-loader-with-parser.js +16 -0
  239. package/dist/wms/wip/wcs-capabilities-loader-with-parser.js.map +1 -0
  240. package/dist/wms/wip/wcs-capabilities-loader.d.ts +12 -0
  241. package/dist/wms/wip/wcs-capabilities-loader.d.ts.map +1 -0
  242. package/dist/wms/wip/wcs-capabilities-loader.js +36 -0
  243. package/dist/wms/wip/wcs-capabilities-loader.js.map +1 -0
  244. package/dist/wms/wip/wms-feature-info-loader-with-parser.d.ts +7 -0
  245. package/dist/wms/wip/wms-feature-info-loader-with-parser.d.ts.map +1 -0
  246. package/dist/wms/wip/wms-feature-info-loader-with-parser.js +15 -0
  247. package/dist/wms/wip/wms-feature-info-loader-with-parser.js.map +1 -0
  248. package/dist/wms/wip/wms-feature-info-loader.d.ts +7 -0
  249. package/dist/wms/wip/wms-feature-info-loader.d.ts.map +1 -0
  250. package/dist/wms/wip/wms-feature-info-loader.js +19 -0
  251. package/dist/wms/wip/wms-feature-info-loader.js.map +1 -0
  252. package/dist/wms/wip/wms-layer-description-loader-with-parser.d.ts +7 -0
  253. package/dist/wms/wip/wms-layer-description-loader-with-parser.d.ts.map +1 -0
  254. package/dist/wms/wip/wms-layer-description-loader-with-parser.js +15 -0
  255. package/dist/wms/wip/wms-layer-description-loader-with-parser.js.map +1 -0
  256. package/dist/wms/wip/wms-layer-description-loader.d.ts +7 -0
  257. package/dist/wms/wip/wms-layer-description-loader.d.ts.map +1 -0
  258. package/dist/wms/wip/wms-layer-description-loader.js +19 -0
  259. package/dist/wms/wip/wms-layer-description-loader.js.map +1 -0
  260. package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts +11 -0
  261. package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
  262. package/dist/wms/wip/wmts-capabilities-loader-with-parser.js +17 -0
  263. package/dist/wms/wip/wmts-capabilities-loader-with-parser.js.map +1 -0
  264. package/dist/wms/wip/wmts-capabilities-loader.d.ts +11 -0
  265. package/dist/wms/wip/wmts-capabilities-loader.d.ts.map +1 -0
  266. package/dist/wms/wip/wmts-capabilities-loader.js +36 -0
  267. package/dist/wms/wip/wmts-capabilities-loader.js.map +1 -0
  268. package/dist/wms/wms-capabilities-loader-with-parser.d.ts +40 -0
  269. package/dist/wms/wms-capabilities-loader-with-parser.d.ts.map +1 -0
  270. package/dist/wms/wms-capabilities-loader-with-parser.js +19 -0
  271. package/dist/wms/wms-capabilities-loader-with-parser.js.map +1 -0
  272. package/dist/wms/wms-capabilities-loader.d.ts +62 -0
  273. package/dist/wms/wms-capabilities-loader.d.ts.map +1 -0
  274. package/dist/wms/wms-capabilities-loader.js +38 -0
  275. package/dist/wms/wms-capabilities-loader.js.map +1 -0
  276. package/dist/wms/wms-error-loader-with-parser.d.ts +39 -0
  277. package/dist/wms/wms-error-loader-with-parser.d.ts.map +1 -0
  278. package/dist/wms/wms-error-loader-with-parser.js +28 -0
  279. package/dist/wms/wms-error-loader-with-parser.js.map +1 -0
  280. package/dist/wms/wms-error-loader.d.ts +64 -0
  281. package/dist/wms/wms-error-loader.d.ts.map +1 -0
  282. package/dist/wms/wms-error-loader.js +40 -0
  283. package/dist/wms/wms-error-loader.js.map +1 -0
  284. package/dist/wms/wms-format.d.ts +13 -0
  285. package/dist/wms/wms-format.d.ts.map +1 -0
  286. package/dist/wms/wms-format.js +25 -0
  287. package/dist/wms/wms-format.js.map +1 -0
  288. package/dist/wms/wms-source-loader.d.ts +226 -0
  289. package/dist/wms/wms-source-loader.d.ts.map +1 -0
  290. package/dist/wms/wms-source-loader.js +397 -0
  291. package/dist/wms/wms-source-loader.js.map +1 -0
  292. package/dist/wms/wmts-capabilities-loader-with-parser.cjs +2189 -0
  293. package/dist/wms/wmts-capabilities-loader-with-parser.cjs.map +6 -0
  294. package/dist/wms/wmts-capabilities-loader-with-parser.d.ts +3 -0
  295. package/dist/wms/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
  296. package/dist/wms/wmts-capabilities-loader-with-parser.js +13 -0
  297. package/dist/wms/wmts-capabilities-loader-with-parser.js.map +1 -0
  298. package/dist/wms/wmts-capabilities-loader.d.ts +7 -0
  299. package/dist/wms/wmts-capabilities-loader.d.ts.map +1 -0
  300. package/dist/wms/wmts-capabilities-loader.js +24 -0
  301. package/dist/wms/wmts-capabilities-loader.js.map +1 -0
  302. package/dist/wms/wmts-source-loader.d.ts +120 -0
  303. package/dist/wms/wmts-source-loader.d.ts.map +1 -0
  304. package/dist/wms/wmts-source-loader.js +472 -0
  305. package/dist/wms/wmts-source-loader.js.map +1 -0
  306. package/package.json +88 -4
  307. package/src/index.ts +6 -0
  308. package/src/stac/index.ts +25 -0
  309. package/src/stac/stac-source-loader-types.ts +65 -0
  310. package/src/stac/stac-source.ts +635 -0
  311. package/src/stac/stac-types.ts +230 -0
  312. package/src/wms/bundled.ts +30 -0
  313. package/src/wms/capability-graph.ts +152 -0
  314. package/src/wms/crs-utils.ts +67 -0
  315. package/src/wms/csw-capabilities-loader-with-parser.ts +30 -0
  316. package/src/wms/csw-capabilities-loader.ts +54 -0
  317. package/src/wms/csw-domain-loader-with-parser.ts +28 -0
  318. package/src/wms/csw-domain-loader.ts +53 -0
  319. package/src/wms/csw-records-loader-with-parser.ts +28 -0
  320. package/src/wms/csw-records-loader.ts +52 -0
  321. package/src/wms/csw-source-loader.ts +330 -0
  322. package/src/wms/feature-pagination.ts +198 -0
  323. package/src/wms/gml-loader-types.ts +62 -0
  324. package/src/wms/gml-loader.ts +228 -0
  325. package/src/wms/index.ts +171 -0
  326. package/src/wms/lib/deprecated/create-image-service.ts.disabled +57 -0
  327. package/src/wms/lib/deprecated/create-image-source.ts +75 -0
  328. package/src/wms/lib/deprecated/image-source-compatibility.ts +28 -0
  329. package/src/wms/lib/deprecated/template-image-service.ts.disabled +68 -0
  330. package/src/wms/lib/parsers/csw/parse-csw-capabilities.ts +105 -0
  331. package/src/wms/lib/parsers/csw/parse-csw-domain.ts +47 -0
  332. package/src/wms/lib/parsers/csw/parse-csw-records.ts +94 -0
  333. package/src/wms/lib/parsers/csw/parse-exception-report.ts +33 -0
  334. package/src/wms/lib/parsers/gml/deep-strict-equal.ts +122 -0
  335. package/src/wms/lib/parsers/gml/parse-gml.ts +849 -0
  336. package/src/wms/lib/parsers/gml/rewind-geometry.ts +45 -0
  337. package/src/wms/lib/parsers/ogc-api/tile-matrix-limits.ts +107 -0
  338. package/src/wms/lib/parsers/ogc-api/tile-matrix-set.ts +167 -0
  339. package/src/wms/lib/parsers/wfs/parse-wfs-capabilities.ts +165 -0
  340. package/src/wms/lib/parsers/wfs/parse-wfs.ts +36 -0
  341. package/src/wms/lib/parsers/wms/parse-wms-capabilities.ts +427 -0
  342. package/src/wms/lib/parsers/wms/parse-wms-error.ts +24 -0
  343. package/src/wms/lib/parsers/wms/parse-wms-features.ts +41 -0
  344. package/src/wms/lib/parsers/wms/parse-wms-layer-description.ts +24 -0
  345. package/src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts +281 -0
  346. package/src/wms/lib/parsers/xml/parse-xml-helpers.ts +67 -0
  347. package/src/wms/lib/parsers/xml/parse-xml-text.ts +11 -0
  348. package/src/wms/lib/tile-grid.ts +47 -0
  349. package/src/wms/managed-vector-source.ts +384 -0
  350. package/src/wms/ogc-api-coverages-source-loader.ts +109 -0
  351. package/src/wms/ogc-api-edr-source-loader.ts +127 -0
  352. package/src/wms/ogc-api-source-loader.ts +742 -0
  353. package/src/wms/service-capabilities.ts +147 -0
  354. package/src/wms/service-runtime.ts +225 -0
  355. package/src/wms/unbundled.ts +24 -0
  356. package/src/wms/wcs-source-loader.ts +260 -0
  357. package/src/wms/wfs-capabilities-loader-with-parser.ts +30 -0
  358. package/src/wms/wfs-capabilities-loader.ts +57 -0
  359. package/src/wms/wfs-source-loader.ts +987 -0
  360. package/src/wms/wip/data-source.ts +64 -0
  361. package/src/wms/wip/lib/wcs/parse-wcs-capabilities.ts +91 -0
  362. package/src/wms/wip/lib/wmts/parse-wmts-capabilities.ts +171 -0
  363. package/src/wms/wip/lib/wmts/parse-wmts.ts +39 -0
  364. package/src/wms/wip/services/wmts-service.ts.disabled +348 -0
  365. package/src/wms/wip/wcs-capabilities-loader-with-parser.ts +29 -0
  366. package/src/wms/wip/wcs-capabilities-loader.ts +50 -0
  367. package/src/wms/wip/wms-feature-info-loader-with-parser.ts +25 -0
  368. package/src/wms/wip/wms-feature-info-loader.ts +28 -0
  369. package/src/wms/wip/wms-layer-description-loader-with-parser.ts +25 -0
  370. package/src/wms/wip/wms-layer-description-loader.md.disabled.md +47 -0
  371. package/src/wms/wip/wms-layer-description-loader.ts +28 -0
  372. package/src/wms/wip/wmts-capabilities-loader-with-parser.ts +30 -0
  373. package/src/wms/wip/wmts-capabilities-loader.ts +52 -0
  374. package/src/wms/wms-capabilities-loader-with-parser.ts +45 -0
  375. package/src/wms/wms-capabilities-loader.ts +68 -0
  376. package/src/wms/wms-error-loader-with-parser.ts +44 -0
  377. package/src/wms/wms-error-loader.ts +56 -0
  378. package/src/wms/wms-format.ts +52 -0
  379. package/src/wms/wms-source-loader.ts +686 -0
  380. package/src/wms/wmts-capabilities-loader-with-parser.ts +17 -0
  381. package/src/wms/wmts-capabilities-loader.ts +30 -0
  382. package/src/wms/wmts-source-loader.ts +649 -0
@@ -0,0 +1,742 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {
6
+ CoreAPI,
7
+ DataSourceOptions,
8
+ GetFeaturesParameters,
9
+ GetTileDataParameters,
10
+ GetTileParameters,
11
+ SourceLoader,
12
+ TileGrid,
13
+ TileSource,
14
+ TileSourceMetadata,
15
+ VectorSource,
16
+ VectorSourceData,
17
+ VectorSourceMetadata
18
+ } from '@loaders.gl/core/loader-utils';
19
+ import {DataSource} from '@loaders.gl/core/loader-utils';
20
+ import type {GeoJSONTable, Schema} from '@loaders.gl/core/schema';
21
+ import {convertFeaturesToWKBArrowTable} from '@loaders.gl/arrow-geometry/feature-collection-to-arrow';
22
+ import {convertGeojsonToBinaryFeatureCollection} from '@loaders.gl/arrow-geometry/legacy-binary';
23
+ import {getServiceCRSAxisOrder} from './crs-utils';
24
+ import type {OGCTileMatrixSet} from './lib/parsers/ogc-api/tile-matrix-set';
25
+ import {convertOGCTileMatrixSetToTileGrid} from './lib/parsers/ogc-api/tile-matrix-set';
26
+ import type {OGCTileMatrixLimits} from './lib/parsers/ogc-api/tile-matrix-limits';
27
+ import {
28
+ convertOGCTileMatrixLimits,
29
+ isOGCTileAvailable
30
+ } from './lib/parsers/ogc-api/tile-matrix-limits';
31
+ import {getTileGridMatrixId, validateMetersPerUnit} from './lib/tile-grid';
32
+ import type {FeaturePaginationOptions, FeaturePage} from './feature-pagination';
33
+ import {
34
+ addNextLinkHeader,
35
+ collectFeaturePages,
36
+ getPaginationOptions,
37
+ iterateFeaturePages
38
+ } from './feature-pagination';
39
+
40
+ /** Options shared by the minimal OGC API source adapters. */
41
+ export type OGCAPISourceOptions = DataSourceOptions & {
42
+ /** Optional collection identifier for an OGC API Features source. */
43
+ 'ogc-api'?: {
44
+ /** Collection to query. */
45
+ collectionId?: string;
46
+ /** Explicit tile template for the tiles adapter. */
47
+ tileTemplate?: string;
48
+ /**
49
+ * Tile matrix set for the tiles adapter, as an OGC TileMatrixSet 2.0 document or the URL of
50
+ * one. When set, `getMetadata()` reports it as `tileGrid`. When omitted, the tile matrix set
51
+ * is discovered from the tileset that `tileTemplate` belongs to.
52
+ */
53
+ tileMatrixSet?: OGCTileMatrixSet | string;
54
+ /** Inclusive availability limits; overrides discovered limits, including an empty list. */
55
+ tileMatrixSetLimits?: OGCTileMatrixLimits[];
56
+ /**
57
+ * Set to `false` to skip discovery. `{tileMatrix}` is then the `tileMatrix` tile parameter,
58
+ * otherwise `z`, which suits services whose matrix identifiers are zoom numbers. Default `true`.
59
+ */
60
+ discoverTileMatrixSet?: boolean;
61
+ /** Length of one CRS unit in meters, for a tile matrix set given by scale denominators. */
62
+ metersPerUnit?: number | null;
63
+ /** Opt-in bounded pagination for getFeatures(); omitted keeps the single-page behavior. */
64
+ pagination?: FeaturePaginationOptions;
65
+ };
66
+ };
67
+
68
+ /** A small representation of an OGC API link. */
69
+ export type OGCAPILink = {href: string; rel?: string; type?: string; title?: string};
70
+
71
+ /** A minimal OGC API collection description. */
72
+ export type OGCAPICollection = {
73
+ id: string;
74
+ title?: string;
75
+ description?: string;
76
+ extent?: {spatial?: {bbox?: number[][]}; temporal?: unknown};
77
+ crs?: string[];
78
+ links?: OGCAPILink[];
79
+ };
80
+
81
+ /**
82
+ * OGC API Tiles tileset metadata used to discover matrix geometry and availability.
83
+ */
84
+ export type OGCAPITileset = {
85
+ /** Human-readable tileset title. */
86
+ title?: string;
87
+ /** Inclusive coverage; omitted means unrestricted, empty means no available tiles. */
88
+ tileMatrixSetLimits?: OGCTileMatrixLimits[];
89
+ /** Identifier of the tile matrix set in this API's `/tileMatrixSets`. */
90
+ tileMatrixSetId?: string;
91
+ /** Registry URI of the tile matrix set. */
92
+ tileMatrixSetURI?: string;
93
+ /** Includes the `http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme` link. */
94
+ links?: OGCAPILink[];
95
+ [key: string]: unknown;
96
+ };
97
+
98
+ /** One entry of an OGC API Tiles `/tileMatrixSets` list. */
99
+ export type OGCAPITileMatrixSetSummary = {
100
+ id: string;
101
+ title?: string;
102
+ /** Registry URI of the tile matrix set. */
103
+ uri?: string;
104
+ links?: OGCAPILink[];
105
+ };
106
+
107
+ /** The normalized landing page returned by an OGC API service. */
108
+ export type OGCAPILandingPage = {
109
+ title?: string;
110
+ description?: string;
111
+ links?: OGCAPILink[];
112
+ };
113
+
114
+ /** Minimal OGC API Features source. */
115
+ export class OGCAPIFeaturesSource
116
+ extends DataSource<string, OGCAPISourceOptions>
117
+ implements VectorSource
118
+ {
119
+ /** Creates an OGC API Features source. */
120
+ constructor(url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) {
121
+ super(url.replace(/\/$/, ''), options, OGCAPIFeaturesSourceLoader.defaultOptions, coreApi);
122
+ }
123
+
124
+ /** Returns the landing page metadata. */
125
+ async getLandingPage(): Promise<OGCAPILandingPage> {
126
+ return (await this.fetchJSON(this.getServiceURL())) as OGCAPILandingPage;
127
+ }
128
+
129
+ /** Lists the feature collections advertised by the service. */
130
+ async getCollections(): Promise<OGCAPICollection[]> {
131
+ const response = (await this.fetchJSON(`${this.getServiceURL()}/collections`)) as {
132
+ collections?: OGCAPICollection[];
133
+ };
134
+ return response.collections || [];
135
+ }
136
+
137
+ /** Returns normalized metadata for the selected collection. */
138
+ async getMetadata(): Promise<VectorSourceMetadata> {
139
+ const collections = await this.getCollections();
140
+ const collection = this.getCollection(collections);
141
+ return {
142
+ name: collection?.id || this.getCollectionId(),
143
+ title: collection?.title,
144
+ abstract: collection?.description,
145
+ keywords: [],
146
+ layers: collection ? [toVectorLayer(collection)] : []
147
+ };
148
+ }
149
+
150
+ /** Returns a minimal schema; OGC API schema extensions remain optional. */
151
+ async getSchema(): Promise<Schema> {
152
+ return {fields: [], metadata: {}};
153
+ }
154
+
155
+ /** Fetches one page, or gathers advertised pages when ogc-api.pagination is configured. */
156
+ async getFeatures(parameters: GetFeaturesParameters): Promise<VectorSourceData> {
157
+ const geoJSONTable = this.options['ogc-api']?.pagination
158
+ ? await collectFeaturePages(this.getFeaturesInPages(parameters))
159
+ : (await this.fetchFeaturePage(this.getFeaturesURL(parameters), parameters.signal)).table;
160
+ switch (parameters.format || 'geojson') {
161
+ case 'binary':
162
+ return convertGeojsonToBinaryFeatureCollection(geoJSONTable.features);
163
+ case 'arrow':
164
+ return convertFeaturesToWKBArrowTable(geoJSONTable.features, {
165
+ encodingPreference: parameters.geoarrow?.encodingPreference
166
+ });
167
+ case 'geojson':
168
+ default:
169
+ return geoJSONTable;
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Yields GeoJSON pages by following advertised body or HTTP-header next links.
175
+ * Does not invent offset parameters. Page requests are sequential and independently bounded.
176
+ * Unknown totals remain unknown, so managed coverage still requires count evidence.
177
+ */
178
+ getFeaturesInPages(
179
+ parameters: GetFeaturesParameters,
180
+ options: FeaturePaginationOptions = this.options['ogc-api']?.pagination || {}
181
+ ): AsyncIterable<GeoJSONTable> {
182
+ const limits = getPaginationOptions(options);
183
+ const url = new URL(this.getFeaturesURL(parameters));
184
+ url.searchParams.set('limit', String(limits.pageSize));
185
+ return iterateFeaturePages(
186
+ url.toString(),
187
+ pageURL => this.fetchFeaturePage(pageURL, parameters.signal),
188
+ limits,
189
+ parameters.signal,
190
+ (_url, _table, featureCount, matched) => {
191
+ if (matched !== undefined && featureCount < matched)
192
+ throw new Error(
193
+ 'OGC API Features pagination ended before numberMatched without a next link'
194
+ );
195
+ return undefined;
196
+ }
197
+ );
198
+ }
199
+
200
+ /** Builds a bounded items URL, preserving endpoint query parameters. */
201
+ private getFeaturesURL(parameters: GetFeaturesParameters): string {
202
+ const url = new URL(this.url);
203
+ const collectionId = this.getCollectionId(parameters.layers);
204
+ url.pathname = /\/collections\/[^/]+\/?$/.test(url.pathname)
205
+ ? `${url.pathname.replace(/\/$/, '')}/items`
206
+ : `${url.pathname.replace(/\/$/, '')}/collections/${encodeURIComponent(collectionId)}/items`;
207
+ const requestCrs = parameters.requestCrs || parameters.crs;
208
+ url.searchParams.set('bbox', flattenBoundingBox(parameters.boundingBox, requestCrs).join(','));
209
+ if (parameters.crs) url.searchParams.set('crs', parameters.crs);
210
+ if (requestCrs) url.searchParams.set('bbox-crs', requestCrs);
211
+ return url.toString();
212
+ }
213
+
214
+ /** Fetches one validated page, retaining body links and HTTP Link-header pagination. */
215
+ private async fetchFeaturePage(url: string, signal?: AbortSignal): Promise<FeaturePage> {
216
+ const response = await this.fetch(url, {
217
+ headers: {Accept: 'application/geo+json, application/json;q=0.9'},
218
+ signal
219
+ });
220
+ if (!response.ok) throw new Error(`OGC API request failed: ${response.status}`);
221
+ const json = await response.json();
222
+ if (!isFeatureCollection(json) || !Array.isArray(json.features))
223
+ throw new Error('OGC API Features response was not a GeoJSON FeatureCollection');
224
+ return {
225
+ table: addNextLinkHeader(
226
+ {shape: 'geojson-table', ...json} as GeoJSONTable,
227
+ response.headers.get('link')
228
+ ),
229
+ url: response.url || url
230
+ };
231
+ }
232
+
233
+ /** Fetches and decodes a JSON representation from the service. */
234
+ private async fetchJSON(
235
+ url: string,
236
+ accept = 'application/json',
237
+ signal?: AbortSignal
238
+ ): Promise<unknown> {
239
+ const response = await this.fetch(url, {headers: {Accept: accept}, signal});
240
+ if (!response.ok) throw new Error(`OGC API request failed: ${response.status}`);
241
+ return response.json();
242
+ }
243
+
244
+ /** Selects the requested collection from a collections response. */
245
+ private getCollection(collections: OGCAPICollection[]): OGCAPICollection | undefined {
246
+ const collectionId = this.getCollectionId();
247
+ return collections.find(collection => collection.id === collectionId) || collections[0];
248
+ }
249
+
250
+ /** Returns the configured collection identifier or the first URL collection segment. */
251
+ private getCollectionId(layers?: string | string[]): string {
252
+ const configuredId = this.options['ogc-api']?.collectionId;
253
+ const layerId = Array.isArray(layers) ? layers[0] : layers;
254
+ if (configuredId || layerId) return configuredId || layerId!;
255
+ const match = this.url.match(/\/collections\/([^/]+)/);
256
+ if (match) return decodeURIComponent(match[1]);
257
+ return '';
258
+ }
259
+
260
+ /** Returns the service root for both landing-page and collection URLs. */
261
+ private getServiceURL(): string {
262
+ return this.url.replace(/\/collections\/[^/]+$/, '');
263
+ }
264
+ }
265
+
266
+ /** Source loader for minimal OGC API Features support. */
267
+ export const OGCAPIFeaturesSourceLoader = {
268
+ dataType: null as unknown as OGCAPIFeaturesSource,
269
+ batchType: null as never,
270
+ name: 'OGC API Features',
271
+ id: 'ogc-api-features',
272
+ module: 'ogc',
273
+ version: '0.0.0',
274
+ extensions: [],
275
+ mimeTypes: ['application/geo+json'],
276
+ type: 'ogc-api-features',
277
+ fromUrl: true,
278
+ fromBlob: false,
279
+ options: {'ogc-api': {}},
280
+ defaultOptions: {'ogc-api': {}},
281
+ testURL: (url: string): boolean => /\/collections(?:\/|$)|ogc[/-]?api[/-]features/i.test(url),
282
+ createDataSource: (url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) =>
283
+ new OGCAPIFeaturesSource(url, options, coreApi)
284
+ } as const satisfies SourceLoader<OGCAPIFeaturesSource>;
285
+
286
+ /** Minimal OGC API Tiles source that follows a discovered tile template. */
287
+ export class OGCAPITilesSource
288
+ extends DataSource<string, OGCAPISourceOptions>
289
+ implements TileSource
290
+ {
291
+ /** Converted tile matrix set and the options it was loaded or discovered with. */
292
+ private _tileGridCache: {
293
+ /** Configured matrix document or URL used by this request. */
294
+ tileMatrixSet: OGCTileMatrixSet | string | undefined;
295
+ /** Configured coverage override used by this request. */
296
+ tileMatrixSetLimits: OGCTileMatrixLimits[] | undefined;
297
+ /** Unit conversion used by this request. */
298
+ metersPerUnit: number | null | undefined;
299
+ /** Template the matrix set is discovered from; undefined when it is configured or not discovered. */
300
+ tileTemplate: string | undefined;
301
+ /** Shared in-flight or fulfilled matrix request. */
302
+ promise: Promise<TileGrid | undefined>;
303
+ /** The converted grid, once available. */
304
+ tileGrid?: TileGrid;
305
+ } | null = null;
306
+
307
+ /** Creates an OGC API Tiles source. */
308
+ constructor(url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) {
309
+ super(url.replace(/\/$/, ''), options, OGCAPITilesSourceLoader.defaultOptions, coreApi);
310
+ validateMetersPerUnit(options['ogc-api']?.metersPerUnit, 'OGC API Tiles');
311
+ }
312
+
313
+ /** Updates options. A new `tileMatrixSet` document replaces the old one instead of merging. */
314
+ override setProps(options: OGCAPISourceOptions): void {
315
+ super.setProps(options);
316
+ const ogcAPIOptions = options['ogc-api'];
317
+ if (ogcAPIOptions && 'tileMatrixSet' in ogcAPIOptions) {
318
+ this.options['ogc-api'] = {
319
+ ...this.options['ogc-api'],
320
+ tileMatrixSet: ogcAPIOptions.tileMatrixSet
321
+ };
322
+ }
323
+ }
324
+
325
+ /** Returns basic tileset metadata from the service landing page and configured matrix set. */
326
+ async getMetadata(): Promise<TileSourceMetadata> {
327
+ const [landingPage, tileGrid] = await Promise.all([
328
+ this.fetchJSON(this.url) as Promise<OGCAPILandingPage>,
329
+ this.getTileGrid()
330
+ ]);
331
+ const tileLink = landingPage.links?.find(link => link.rel?.includes('tileset'));
332
+ return {
333
+ name: landingPage.title || '',
334
+ title: landingPage.title,
335
+ format: tileLink?.type,
336
+ ...(tileGrid ? {tileGrid} : {})
337
+ };
338
+ }
339
+
340
+ /** Lists the tile matrix sets the API advertises at `/tileMatrixSets`. */
341
+ async getTileMatrixSets(): Promise<OGCAPITileMatrixSetSummary[]> {
342
+ const response = (await this.fetchJSON(resolveLink('tileMatrixSets', this.url))) as {
343
+ tileMatrixSets?: OGCAPITileMatrixSetSummary[];
344
+ };
345
+ return Array.isArray(response?.tileMatrixSets) ? response.tileMatrixSets : [];
346
+ }
347
+
348
+ /** Fetches one tile matrix set from `/tileMatrixSets/{tileMatrixSetId}`. */
349
+ async getTileMatrixSet(tileMatrixSetId: string): Promise<OGCTileMatrixSet> {
350
+ return (await this.fetchJSON(this.getTileMatrixSetIdURL(tileMatrixSetId))) as OGCTileMatrixSet;
351
+ }
352
+
353
+ /** Returns the URL of `/tileMatrixSets/{tileMatrixSetId}`. */
354
+ private getTileMatrixSetIdURL(tileMatrixSetId: string): string {
355
+ return resolveLink(`tileMatrixSets/${encodeURIComponent(tileMatrixSetId)}`, this.url);
356
+ }
357
+
358
+ /**
359
+ * Returns the configured or discovered tile matrix set as a tile grid. The result is reused until
360
+ * the options change, and concurrent callers share one request. A failed load or discovery
361
+ * rejects, and is retried on the next call.
362
+ */
363
+ private getTileGrid(): Promise<TileGrid | undefined> {
364
+ const key = this.getTileGridKey();
365
+ const cache = this._tileGridCache;
366
+ if (cache && isSameTileGridKey(cache, key)) {
367
+ return cache.promise;
368
+ }
369
+ const {tileMatrixSet, tileMatrixSetLimits, metersPerUnit, tileTemplate} = key;
370
+ const promise = tileMatrixSet
371
+ ? this.loadTileGrid(tileMatrixSet, metersPerUnit, tileMatrixSetLimits)
372
+ : this.discoverTileGrid(tileTemplate, metersPerUnit, tileMatrixSetLimits).catch(error => {
373
+ throw new Error(
374
+ `OGC API Tiles could not discover the tile matrix set: ${(error as Error)?.message}`,
375
+ {cause: error}
376
+ );
377
+ });
378
+ const newCache: NonNullable<OGCAPITilesSource['_tileGridCache']> = {...key, promise};
379
+ this._tileGridCache = newCache;
380
+ newCache.promise.then(
381
+ tileGrid => {
382
+ newCache.tileGrid = tileGrid;
383
+ },
384
+ () => {
385
+ if (this._tileGridCache === newCache) this._tileGridCache = null;
386
+ }
387
+ );
388
+ return newCache.promise;
389
+ }
390
+
391
+ /**
392
+ * The options a tile grid depends on. `tileTemplate` is set only when the matrix set is
393
+ * discovered from it: a configured matrix set or `discoverTileMatrixSet: false` disables discovery.
394
+ */
395
+ private getTileGridKey() {
396
+ const {tileMatrixSet, tileMatrixSetLimits, metersPerUnit, tileTemplate, discoverTileMatrixSet} =
397
+ this.options['ogc-api'] || {};
398
+ const discover = !tileMatrixSet && discoverTileMatrixSet !== false;
399
+ return {
400
+ tileMatrixSet,
401
+ tileMatrixSetLimits,
402
+ metersPerUnit,
403
+ tileTemplate: discover ? tileTemplate : undefined
404
+ };
405
+ }
406
+
407
+ /** Whether the tile matrix set is configured or discovered, rather than absent. */
408
+ private requiresTileGrid(): boolean {
409
+ const {tileMatrixSet, tileTemplate} = this.getTileGridKey();
410
+ return Boolean(tileMatrixSet || (tileTemplate && getTilesetURL(tileTemplate)));
411
+ }
412
+
413
+ /**
414
+ * Discovers the tile matrix set of the tileset that a `{tileMatrix}` template belongs to. The
415
+ * tileset metadata is the template path before `/{tileMatrix}`, as OGC API Tiles lays out tile
416
+ * resources. Its tiling-scheme link is followed; otherwise `tileMatrixSetId` is looked up in
417
+ * `/tileMatrixSets`, and a `tileMatrixSetURI` is matched against the `/tileMatrixSets` list.
418
+ * Resolves to undefined when the template has no `{tileMatrix}`, and rejects when the tileset
419
+ * or its tile matrix set cannot be loaded.
420
+ */
421
+ private async discoverTileGrid(
422
+ tileTemplate: string | undefined,
423
+ metersPerUnit: number | null | undefined,
424
+ configuredLimits: OGCTileMatrixLimits[] | undefined
425
+ ): Promise<TileGrid | undefined> {
426
+ // Find the tileset path before resolving, since URL parsing may percent-encode the braces.
427
+ const tilesetPath = tileTemplate && getTilesetURL(tileTemplate);
428
+ if (!tilesetPath) return applyTileMatrixLimits(undefined, configuredLimits);
429
+ const tilesetUrl = resolveLink(tilesetPath, this.url);
430
+ const tileset = (await this.fetchJSON(tilesetUrl)) as OGCAPITileset;
431
+ const tileMatrixSetUrl = await this.getTileMatrixSetURL(tileset, tilesetUrl);
432
+ const document = (await this.fetchJSON(tileMatrixSetUrl)) as OGCTileMatrixSet;
433
+ return applyTileMatrixLimits(
434
+ convertOGCTileMatrixSetToTileGrid(document, {metersPerUnit}),
435
+ configuredLimits === undefined ? tileset.tileMatrixSetLimits : configuredLimits
436
+ );
437
+ }
438
+
439
+ /** Returns the URL of the tile matrix set a tileset uses. */
440
+ private async getTileMatrixSetURL(tileset: OGCAPITileset, tilesetUrl: string): Promise<string> {
441
+ const link = findJSONLink(tileset?.links, isTilingSchemeRel);
442
+ if (link) return resolveDocumentLink(link.href, tilesetUrl);
443
+ if (typeof tileset?.tileMatrixSetId === 'string' && tileset.tileMatrixSetId) {
444
+ return this.getTileMatrixSetIdURL(tileset.tileMatrixSetId);
445
+ }
446
+ if (typeof tileset?.tileMatrixSetURI === 'string' && tileset.tileMatrixSetURI) {
447
+ const listUrl = resolveLink('tileMatrixSets', this.url);
448
+ const summary = (await this.getTileMatrixSets()).find(
449
+ candidate => candidate.uri === tileset.tileMatrixSetURI
450
+ );
451
+ const selfLink = findJSONLink(summary?.links, rel => rel === 'self');
452
+ if (selfLink) return resolveDocumentLink(selfLink.href, listUrl);
453
+ if (summary?.id) return this.getTileMatrixSetIdURL(summary.id);
454
+ throw new Error(`${tileset.tileMatrixSetURI} is not listed in ${listUrl}`);
455
+ }
456
+ throw new Error(`${tilesetUrl} names no tile matrix set`);
457
+ }
458
+
459
+ /**
460
+ * Returns the tile grid if it is available without waiting: an inline document is converted
461
+ * immediately, while a document given as a URL or discovered is available once loaded.
462
+ */
463
+ private getLoadedTileGrid(): TileGrid | undefined {
464
+ const tileMatrixSet = this.options['ogc-api']?.tileMatrixSet;
465
+ const cache = this._tileGridCache;
466
+ if (cache?.tileGrid && isSameTileGridKey(cache, this.getTileGridKey())) return cache.tileGrid;
467
+ if (tileMatrixSet && typeof tileMatrixSet !== 'string') {
468
+ return applyTileMatrixLimits(
469
+ convertOGCTileMatrixSetToTileGrid(tileMatrixSet, {
470
+ metersPerUnit: this.options['ogc-api']?.metersPerUnit
471
+ }),
472
+ this.options['ogc-api']?.tileMatrixSetLimits
473
+ );
474
+ }
475
+ return this.requiresTileGrid()
476
+ ? undefined
477
+ : applyTileMatrixLimits(undefined, this.options['ogc-api']?.tileMatrixSetLimits);
478
+ }
479
+
480
+ /** Converts a tile matrix set, fetching it first when given as a URL. */
481
+ private async loadTileGrid(
482
+ tileMatrixSet: OGCTileMatrixSet | string | undefined,
483
+ metersPerUnit: number | null | undefined,
484
+ limits: OGCTileMatrixLimits[] | undefined
485
+ ): Promise<TileGrid | undefined> {
486
+ if (!tileMatrixSet) return undefined;
487
+ const document =
488
+ typeof tileMatrixSet === 'string'
489
+ ? ((await this.fetchJSON(resolveLink(tileMatrixSet, this.url))) as OGCTileMatrixSet)
490
+ : tileMatrixSet;
491
+ return applyTileMatrixLimits(
492
+ convertOGCTileMatrixSetToTileGrid(document, {metersPerUnit}),
493
+ limits
494
+ );
495
+ }
496
+
497
+ /** Fetches raw bytes for one tile from an advertised template. */
498
+ async getTile(parameters: GetTileParameters): Promise<ArrayBuffer | null> {
499
+ if (parameters.signal?.aborted)
500
+ throw new DOMException('The operation was aborted', 'AbortError');
501
+ // The matrix identifier in the URL comes from the configured or discovered tile matrix set.
502
+ const tileGrid = await this.getTileGrid();
503
+ if (!isOGCTileAvailable(parameters, tileGrid)) return null;
504
+ const url = this.getTileURL(parameters);
505
+ const response = await this.fetch(url, {
506
+ headers: {Accept: 'application/octet-stream'},
507
+ signal: parameters.signal
508
+ });
509
+ if (!response.ok) throw new Error(`OGC API Tiles request failed: ${response.status}`);
510
+ return response.arrayBuffer();
511
+ }
512
+
513
+ /** Fetches a tile using the deck.gl-compatible request shape. */
514
+ async getTileData(parameters: GetTileDataParameters): Promise<ArrayBuffer | null> {
515
+ return this.getTile({
516
+ ...parameters.index,
517
+ tileMatrix: parameters.tileMatrix,
518
+ signal: parameters.signal
519
+ });
520
+ }
521
+
522
+ /** Checks advertised coverage; load remote metadata with getMetadata() first. */
523
+ isTileAvailable(parameters: GetTileParameters): boolean {
524
+ const tileGrid = this.getLoadedTileGrid();
525
+ if (!tileGrid && this.requiresTileGrid()) {
526
+ throw new Error(
527
+ 'OGC API Tiles has not loaded its tile matrix set; await getMetadata() before isTileAvailable()'
528
+ );
529
+ }
530
+ return isOGCTileAvailable(parameters, tileGrid);
531
+ }
532
+
533
+ /**
534
+ * Expands a `{tileMatrix}`, `{tileRow}`, and `{tileCol}` template. `{tileMatrix}` is
535
+ * `parameters.tileMatrix` when given, otherwise the identifier of the matrix whose id equals
536
+ * `z`, otherwise the matrix at index `z`. With a tile matrix set, a matrix it does not contain
537
+ * throws a `RangeError`. A matrix set given by URL or discovered must be loaded first, by
538
+ * `getMetadata()` or `getTile()`; until then this throws rather than using `z`. Only without a
539
+ * matrix set (no `{tileMatrix}` to discover, or `discoverTileMatrixSet: false`) is
540
+ * `{tileMatrix}` the explicit identifier or `z`. `{z}` is always the number.
541
+ */
542
+ getTileURL(parameters: GetTileParameters): string {
543
+ const template = this.options['ogc-api']?.tileTemplate;
544
+ if (!template) throw new Error('OGC API Tiles requires ogc-api.tileTemplate');
545
+ const loadedGrid = this.getLoadedTileGrid();
546
+ if (!isOGCTileAvailable(parameters, loadedGrid)) {
547
+ throw new RangeError('OGC tile is outside advertised coverage');
548
+ }
549
+ // XYZ placeholders keep numeric z; only OGC placeholders substitute a matrix identifier.
550
+ let tileMatrixId = '';
551
+ if (template.includes('{tileMatrix}')) {
552
+ const tileGrid = this.getLoadedTileGrid();
553
+ if (!tileGrid && parameters.tileMatrix === undefined && this.requiresTileGrid()) {
554
+ throw new Error(
555
+ 'OGC API Tiles has not loaded its tile matrix set; await getMetadata() before getTileURL()'
556
+ );
557
+ }
558
+ tileMatrixId = getTileGridMatrixId(tileGrid, parameters);
559
+ }
560
+ const tileUrl = template
561
+ .replaceAll('{tileMatrix}', encodeURIComponent(tileMatrixId))
562
+ .replaceAll('{tileRow}', String(parameters.y))
563
+ .replaceAll('{tileCol}', String(parameters.x))
564
+ .replaceAll('{z}', String(parameters.z))
565
+ .replaceAll('{y}', String(parameters.y))
566
+ .replaceAll('{x}', String(parameters.x));
567
+ return resolveLink(tileUrl, this.url);
568
+ }
569
+
570
+ private async fetchJSON(url: string): Promise<unknown> {
571
+ const response = await this.fetch(url, {headers: {Accept: 'application/json'}});
572
+ if (!response.ok) throw new Error(`OGC API request failed: ${response.status}`);
573
+ return response.json();
574
+ }
575
+ }
576
+
577
+ /** Source loader for minimal OGC API Tiles support. */
578
+ export const OGCAPITilesSourceLoader = {
579
+ dataType: null as unknown as OGCAPITilesSource,
580
+ batchType: null as never,
581
+ name: 'OGC API Tiles',
582
+ id: 'ogc-api-tiles',
583
+ module: 'ogc',
584
+ version: '0.0.0',
585
+ extensions: [],
586
+ mimeTypes: [],
587
+ type: 'ogc-api-tiles',
588
+ fromUrl: true,
589
+ fromBlob: false,
590
+ options: {},
591
+ defaultOptions: {},
592
+ testURL: (url: string): boolean => /\/tiles(?:\/|$)|ogc[/-]?api[/-]tiles/i.test(url),
593
+ createDataSource: (url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) =>
594
+ new OGCAPITilesSource(url, options, coreApi)
595
+ } as const satisfies SourceLoader<OGCAPITilesSource>;
596
+
597
+ /**
598
+ * Resolves a link against a landing page treated as a directory, so `tileMatrixSets/x` under
599
+ * `https://host/api` becomes `https://host/api/tileMatrixSets/x`. Absolute links are returned
600
+ * unchanged, and a relative landing page stays relative.
601
+ */
602
+ function resolveLink(link: string, landingPageUrl: string): string {
603
+ return resolveDocumentLink(link, landingPageUrl, true);
604
+ }
605
+
606
+ /**
607
+ * Resolves a link found in a document against the document URL, as browsers do. With
608
+ * `asDirectory`, the URL is treated as a directory. A relative document URL stays relative.
609
+ */
610
+ function resolveDocumentLink(link: string, documentUrl: string, asDirectory = false): string {
611
+ if (/^[a-z][a-z\d+.-]*:/i.test(link)) return link;
612
+ const placeholderOrigin = 'http://placeholder.invalid';
613
+ const isAbsolute = /^[a-z][a-z\d+.-]*:/i.test(documentUrl);
614
+ const isPathRelative = !isAbsolute && !documentUrl.startsWith('/');
615
+ // Anchor relative paths deeply enough that URL normalization preserves every leading ../.
616
+ // The marker cannot occur in either input, so it cannot be mistaken for a real path segment.
617
+ let anchorSegment = '__loaders_relative_base__';
618
+ while (documentUrl.includes(anchorSegment) || link.includes(anchorSegment)) anchorSegment += '_';
619
+ const anchorDepth = documentUrl.split('/').length + link.split('/').length + 1;
620
+ const anchorPath = isPathRelative ? `/${`${anchorSegment}/`.repeat(anchorDepth)}` : '/';
621
+ const base = new URL(documentUrl, `${placeholderOrigin}${anchorPath}`);
622
+ if (asDirectory && !base.pathname.endsWith('/')) base.pathname += '/';
623
+ const resolved = new URL(link, base);
624
+ if (isAbsolute) return resolved.href;
625
+ if (
626
+ resolved.origin !== placeholderOrigin ||
627
+ documentUrl.startsWith('//') ||
628
+ link.startsWith('//')
629
+ ) {
630
+ return `//${resolved.host}${resolved.pathname}${resolved.search}${resolved.hash}`;
631
+ }
632
+ if (isPathRelative && !link.startsWith('/')) {
633
+ const segments = resolved.pathname.slice(1).split('/');
634
+ let preservedDepth = 0;
635
+ while (segments[preservedDepth] === anchorSegment) preservedDepth++;
636
+ const relativePath =
637
+ '../'.repeat(anchorDepth - preservedDepth) + segments.slice(preservedDepth).join('/');
638
+ // ./ also protects a leading colon or slash from being interpreted as a scheme or root.
639
+ const pathname = relativePath.startsWith('../') ? relativePath : `./${relativePath}`;
640
+ return `${pathname}${resolved.search}${resolved.hash}`;
641
+ }
642
+ return `${resolved.pathname}${resolved.search}${resolved.hash}`;
643
+ }
644
+
645
+ /**
646
+ * Returns the tileset metadata URL for an OGC tile template: the path before `/{tileMatrix}`,
647
+ * keeping query parameters other than the `f` format selector. Undefined for other templates.
648
+ */
649
+ function getTilesetURL(tileTemplate: string): string | undefined {
650
+ const index = tileTemplate.indexOf('/{tileMatrix}');
651
+ if (index < 0) return undefined;
652
+ const queryIndex = tileTemplate.indexOf('?', index);
653
+ const query = new URLSearchParams(queryIndex < 0 ? '' : tileTemplate.slice(queryIndex + 1));
654
+ query.delete('f');
655
+ const queryString = query.toString();
656
+ return tileTemplate.slice(0, index) + (queryString ? `?${queryString}` : '');
657
+ }
658
+
659
+ /** The current and legacy link relations from a tileset to its tile matrix set. */
660
+ function isTilingSchemeRel(rel: string): boolean {
661
+ return rel === 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme' || rel === 'tiling-scheme';
662
+ }
663
+
664
+ /** Returns the matching link with a JSON media type, otherwise the first one without a type. */
665
+ function findJSONLink(
666
+ links: OGCAPILink[] | undefined,
667
+ matchesRel: (rel: string) => boolean
668
+ ): OGCAPILink | undefined {
669
+ const candidates = (Array.isArray(links) ? links : []).filter(
670
+ link => typeof link?.href === 'string' && typeof link.rel === 'string' && matchesRel(link.rel)
671
+ );
672
+ return (
673
+ candidates.find(link => /^application\/([\w.-]+\+)?json\b/i.test(link.type || '')) ||
674
+ candidates.find(link => !link.type)
675
+ );
676
+ }
677
+
678
+ /** Tests whether a cached tile grid was loaded with these options. */
679
+ function isSameTileGridKey(
680
+ cachedKey: {
681
+ tileMatrixSet: unknown;
682
+ tileMatrixSetLimits: unknown;
683
+ metersPerUnit: unknown;
684
+ tileTemplate: unknown;
685
+ },
686
+ requestedKey: {
687
+ tileMatrixSet: unknown;
688
+ tileMatrixSetLimits: unknown;
689
+ metersPerUnit: unknown;
690
+ tileTemplate: unknown;
691
+ }
692
+ ): boolean {
693
+ return (
694
+ cachedKey.tileMatrixSet === requestedKey.tileMatrixSet &&
695
+ cachedKey.tileMatrixSetLimits === requestedKey.tileMatrixSetLimits &&
696
+ cachedKey.metersPerUnit === requestedKey.metersPerUnit &&
697
+ cachedKey.tileTemplate === requestedKey.tileTemplate
698
+ );
699
+ }
700
+
701
+ /** Converts the loaders.gl nested bounding box into the OGC comma-separated form. */
702
+ function flattenBoundingBox(
703
+ boundingBox: GetFeaturesParameters['boundingBox'],
704
+ requestCrs?: GetFeaturesParameters['requestCrs']
705
+ ): number[] {
706
+ const values = [boundingBox[0][0], boundingBox[0][1], boundingBox[1][0], boundingBox[1][1]];
707
+ if (getServiceCRSAxisOrder(requestCrs) === 'yx') {
708
+ return [values[1], values[0], values[3], values[2]];
709
+ }
710
+ return values;
711
+ }
712
+
713
+ /** Checks that a decoded response has the required GeoJSON feature-collection marker. */
714
+ function isFeatureCollection(value: unknown): value is Pick<GeoJSONTable, 'type' | 'features'> {
715
+ return Boolean(value && typeof value === 'object' && (value as any).type === 'FeatureCollection');
716
+ }
717
+
718
+ /** Converts an OGC collection extent into the normalized source-layer shape. */
719
+ function toVectorLayer(collection: OGCAPICollection) {
720
+ const bbox = collection.extent?.spatial?.bbox?.[0];
721
+ return {
722
+ name: collection.id,
723
+ title: collection.title,
724
+ crs: collection.crs,
725
+ boundingBox: bbox
726
+ ? ([
727
+ [bbox[0], bbox[1]],
728
+ [bbox[2], bbox[3]]
729
+ ] as [[number, number], [number, number]])
730
+ : undefined,
731
+ layers: []
732
+ };
733
+ }
734
+
735
+ /** Attaches normalized coverage without requiring complete matrix geometry. */
736
+ function applyTileMatrixLimits(
737
+ grid: TileGrid | undefined,
738
+ limits: OGCTileMatrixLimits[] | undefined
739
+ ): TileGrid | undefined {
740
+ if (limits === undefined) return grid;
741
+ return {...grid, limits: convertOGCTileMatrixLimits(limits, grid || {})};
742
+ }