@loaders.gl/wms 4.0.0-alpha.9 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/csw-capabilities-loader.d.ts +1 -17
  2. package/dist/csw-capabilities-loader.d.ts.map +1 -1
  3. package/dist/csw-domain-loader.d.ts +1 -17
  4. package/dist/csw-domain-loader.d.ts.map +1 -1
  5. package/dist/csw-records-loader.d.ts +1 -1
  6. package/dist/csw-records-loader.d.ts.map +1 -1
  7. package/dist/dist.min.js +187 -161
  8. package/dist/es5/csw-capabilities-loader.js +2 -4
  9. package/dist/es5/csw-capabilities-loader.js.map +1 -1
  10. package/dist/es5/csw-domain-loader.js +2 -4
  11. package/dist/es5/csw-domain-loader.js.map +1 -1
  12. package/dist/es5/csw-records-loader.js +2 -2
  13. package/dist/es5/csw-records-loader.js.map +1 -1
  14. package/dist/es5/gml-loader.js +2 -4
  15. package/dist/es5/gml-loader.js.map +1 -1
  16. package/dist/es5/index.js +23 -10
  17. package/dist/es5/index.js.map +1 -1
  18. package/dist/es5/lerc-loader.js +2 -4
  19. package/dist/es5/lerc-loader.js.map +1 -1
  20. package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
  21. package/dist/es5/lib/{create-image-source.js → services/create-image-service.js} +30 -21
  22. package/dist/es5/lib/services/create-image-service.js.map +1 -0
  23. package/dist/es5/lib/services/{generic/image-service.js → image-service.js} +2 -2
  24. package/dist/es5/lib/services/image-service.js.map +1 -0
  25. package/dist/es5/{lib/services → services}/arcgis/arcgis-image-service.js +22 -16
  26. package/dist/es5/services/arcgis/arcgis-image-service.js.map +1 -0
  27. package/dist/es5/services/arcgis/arcgis-server.js.map +1 -0
  28. package/dist/es5/services/create-image-source.js +14 -0
  29. package/dist/es5/services/create-image-source.js.map +1 -0
  30. package/dist/es5/{lib/services → services}/ogc/csw-service.js +10 -8
  31. package/dist/es5/services/ogc/csw-service.js.map +1 -0
  32. package/dist/es5/{lib/services → services}/ogc/wms-service.js +28 -22
  33. package/dist/es5/services/ogc/wms-service.js.map +1 -0
  34. package/dist/es5/wip/lib/wfs/parse-wfs.js.map +1 -0
  35. package/dist/es5/wip/lib/wmts/parse-wmts.js.map +1 -0
  36. package/dist/es5/wip/services/arcgis-feature-service.js.map +1 -0
  37. package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
  38. package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -1
  39. package/dist/es5/wip/wfs-capabilities-loader.js +2 -2
  40. package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -1
  41. package/dist/es5/wip/wms-feature-info-loader.js.map +1 -1
  42. package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
  43. package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
  44. package/dist/es5/wms-capabilities-loader.js +2 -4
  45. package/dist/es5/wms-capabilities-loader.js.map +1 -1
  46. package/dist/es5/wms-error-loader.js +2 -4
  47. package/dist/es5/wms-error-loader.js.map +1 -1
  48. package/dist/esm/csw-capabilities-loader.js +1 -2
  49. package/dist/esm/csw-capabilities-loader.js.map +1 -1
  50. package/dist/esm/csw-domain-loader.js +1 -2
  51. package/dist/esm/csw-domain-loader.js.map +1 -1
  52. package/dist/esm/csw-records-loader.js +2 -2
  53. package/dist/esm/csw-records-loader.js.map +1 -1
  54. package/dist/esm/gml-loader.js +1 -2
  55. package/dist/esm/gml-loader.js.map +1 -1
  56. package/dist/esm/index.js +8 -7
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/lerc-loader.js +1 -2
  59. package/dist/esm/lerc-loader.js.map +1 -1
  60. package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
  61. package/dist/esm/lib/services/create-image-service.js +27 -0
  62. package/dist/esm/lib/services/create-image-service.js.map +1 -0
  63. package/dist/esm/lib/services/{generic/image-service.js → image-service.js} +1 -1
  64. package/dist/esm/lib/services/image-service.js.map +1 -0
  65. package/dist/esm/{lib/services → services}/arcgis/arcgis-image-service.js +7 -5
  66. package/dist/esm/services/arcgis/arcgis-image-service.js.map +1 -0
  67. package/dist/esm/services/arcgis/arcgis-server.js.map +1 -0
  68. package/dist/esm/services/create-image-source.js +8 -0
  69. package/dist/esm/services/create-image-source.js.map +1 -0
  70. package/dist/esm/{lib/services → services}/ogc/csw-service.js +9 -7
  71. package/dist/esm/services/ogc/csw-service.js.map +1 -0
  72. package/dist/esm/{lib/services → services}/ogc/wms-service.js +15 -11
  73. package/dist/esm/services/ogc/wms-service.js.map +1 -0
  74. package/dist/esm/wip/lib/wfs/parse-wfs.js.map +1 -0
  75. package/dist/esm/wip/lib/wmts/parse-wmts.js.map +1 -0
  76. package/dist/esm/wip/services/arcgis-feature-service.js.map +1 -0
  77. package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
  78. package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -1
  79. package/dist/esm/wip/wfs-capabilities-loader.js +2 -2
  80. package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -1
  81. package/dist/esm/wip/wms-feature-info-loader.js.map +1 -1
  82. package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
  83. package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -1
  84. package/dist/esm/wms-capabilities-loader.js +1 -2
  85. package/dist/esm/wms-capabilities-loader.js.map +1 -1
  86. package/dist/esm/wms-error-loader.js +1 -2
  87. package/dist/esm/wms-error-loader.js.map +1 -1
  88. package/dist/gml-loader.d.ts +2 -18
  89. package/dist/gml-loader.d.ts.map +1 -1
  90. package/dist/index.d.ts +11 -10
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/lerc-loader.d.ts +1 -14
  93. package/dist/lerc-loader.d.ts.map +1 -1
  94. package/dist/lib/parsers/gml/parse-gml.d.ts +1 -0
  95. package/dist/lib/parsers/gml/parse-gml.d.ts.map +1 -1
  96. package/dist/lib/services/create-image-service.d.ts +14 -0
  97. package/dist/lib/services/create-image-service.d.ts.map +1 -0
  98. package/dist/lib/services/{generic/image-service.d.ts → image-service.d.ts} +4 -4
  99. package/dist/lib/services/image-service.d.ts.map +1 -0
  100. package/dist/{lib/services → services}/arcgis/arcgis-image-service.d.ts +6 -7
  101. package/dist/services/arcgis/arcgis-image-service.d.ts.map +1 -0
  102. package/dist/services/arcgis/arcgis-server.d.ts.map +1 -0
  103. package/dist/services/create-image-source.d.ts +18 -0
  104. package/dist/services/create-image-source.d.ts.map +1 -0
  105. package/dist/{lib/services → services}/ogc/csw-service.d.ts +6 -38
  106. package/dist/services/ogc/csw-service.d.ts.map +1 -0
  107. package/dist/{lib/services → services}/ogc/wms-service.d.ts +14 -80
  108. package/dist/services/ogc/wms-service.d.ts.map +1 -0
  109. package/dist/wip/lib/wfs/parse-wfs.d.ts.map +1 -0
  110. package/dist/wip/lib/wmts/parse-wmts.d.ts.map +1 -0
  111. package/dist/wip/services/arcgis-feature-service.d.ts.map +1 -0
  112. package/dist/wip/wfs-capabilities-loader.d.ts +1 -16
  113. package/dist/wip/wfs-capabilities-loader.d.ts.map +1 -1
  114. package/dist/wip/wms-feature-info-loader.d.ts +1 -15
  115. package/dist/wip/wms-feature-info-loader.d.ts.map +1 -1
  116. package/dist/wip/wms-layer-description-loader.d.ts +20 -6
  117. package/dist/wip/wms-layer-description-loader.d.ts.map +1 -1
  118. package/dist/wms-capabilities-loader.d.ts +2 -17
  119. package/dist/wms-capabilities-loader.d.ts.map +1 -1
  120. package/dist/wms-error-loader.d.ts +1 -21
  121. package/dist/wms-error-loader.d.ts.map +1 -1
  122. package/package.json +6 -9
  123. package/src/csw-capabilities-loader.ts +1 -4
  124. package/src/csw-domain-loader.ts +1 -3
  125. package/src/csw-records-loader.ts +2 -3
  126. package/src/gml-loader.ts +2 -3
  127. package/src/index.ts +14 -10
  128. package/src/lerc-loader.ts +1 -3
  129. package/src/lib/parsers/gml/parse-gml.ts +2 -0
  130. package/src/lib/services/create-image-service.ts +55 -0
  131. package/src/lib/services/{generic/image-service.ts → image-service.ts} +6 -4
  132. package/src/{lib/services → services}/arcgis/arcgis-image-service.ts +15 -8
  133. package/src/services/create-image-source.ts +31 -0
  134. package/src/{lib/services → services}/ogc/csw-service.ts +11 -11
  135. package/src/{lib/services → services}/ogc/wms-service.ts +27 -34
  136. package/src/wip/wfs-capabilities-loader.ts +2 -2
  137. package/src/wip/wms-feature-info-loader.ts +2 -1
  138. package/src/wms-capabilities-loader.ts +6 -4
  139. package/src/wms-error-loader.ts +1 -3
  140. package/dist/bundle.js +0 -6
  141. package/dist/csw-capabilities-loader.js +0 -31
  142. package/dist/csw-domain-loader.js +0 -31
  143. package/dist/csw-records-loader.js +0 -30
  144. package/dist/es5/lib/create-image-source.js.map +0 -1
  145. package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +0 -1
  146. package/dist/es5/lib/services/arcgis/arcgis-server.js.map +0 -1
  147. package/dist/es5/lib/services/generic/image-service.js.map +0 -1
  148. package/dist/es5/lib/services/ogc/csw-service.js.map +0 -1
  149. package/dist/es5/lib/services/ogc/wms-service.js.map +0 -1
  150. package/dist/es5/lib/sources/data-source.js +0 -67
  151. package/dist/es5/lib/sources/data-source.js.map +0 -1
  152. package/dist/es5/lib/sources/image-source.js +0 -26
  153. package/dist/es5/lib/sources/image-source.js.map +0 -1
  154. package/dist/es5/lib/sources/tile-source.js +0 -26
  155. package/dist/es5/lib/sources/tile-source.js.map +0 -1
  156. package/dist/es5/lib/sources/utils/utils.js +0 -36
  157. package/dist/es5/lib/sources/utils/utils.js.map +0 -1
  158. package/dist/es5/lib/wfs/parse-wfs.js.map +0 -1
  159. package/dist/es5/lib/wmts/parse-wmts.js.map +0 -1
  160. package/dist/es5/wip/arcgis-feature-service.js.map +0 -1
  161. package/dist/esm/lib/create-image-source.js +0 -27
  162. package/dist/esm/lib/create-image-source.js.map +0 -1
  163. package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +0 -1
  164. package/dist/esm/lib/services/arcgis/arcgis-server.js.map +0 -1
  165. package/dist/esm/lib/services/generic/image-service.js.map +0 -1
  166. package/dist/esm/lib/services/ogc/csw-service.js.map +0 -1
  167. package/dist/esm/lib/services/ogc/wms-service.js.map +0 -1
  168. package/dist/esm/lib/sources/data-source.js +0 -43
  169. package/dist/esm/lib/sources/data-source.js.map +0 -1
  170. package/dist/esm/lib/sources/image-source.js +0 -3
  171. package/dist/esm/lib/sources/image-source.js.map +0 -1
  172. package/dist/esm/lib/sources/tile-source.js +0 -3
  173. package/dist/esm/lib/sources/tile-source.js.map +0 -1
  174. package/dist/esm/lib/sources/utils/utils.js +0 -21
  175. package/dist/esm/lib/sources/utils/utils.js.map +0 -1
  176. package/dist/esm/lib/wfs/parse-wfs.js.map +0 -1
  177. package/dist/esm/lib/wmts/parse-wmts.js.map +0 -1
  178. package/dist/esm/wip/arcgis-feature-service.js.map +0 -1
  179. package/dist/gml-loader.js +0 -31
  180. package/dist/index.js +0 -39
  181. package/dist/lerc-loader.js +0 -56
  182. package/dist/lib/create-image-source.d.ts +0 -17
  183. package/dist/lib/create-image-source.d.ts.map +0 -1
  184. package/dist/lib/create-image-source.js +0 -39
  185. package/dist/lib/parsers/csw/parse-csw-capabilities.js +0 -24
  186. package/dist/lib/parsers/csw/parse-csw-domain.js +0 -33
  187. package/dist/lib/parsers/csw/parse-csw-records.js +0 -58
  188. package/dist/lib/parsers/csw/parse-exception-report.js +0 -30
  189. package/dist/lib/parsers/gml/deep-strict-equal.js +0 -119
  190. package/dist/lib/parsers/gml/parse-gml.js +0 -371
  191. package/dist/lib/parsers/lerc/lerc-types.js +0 -3
  192. package/dist/lib/parsers/wms/parse-wms-capabilities.js +0 -233
  193. package/dist/lib/parsers/wms/parse-wms-error.js +0 -22
  194. package/dist/lib/parsers/wms/parse-wms-features.js +0 -27
  195. package/dist/lib/parsers/wms/parse-wms-layer-description.js +0 -15
  196. package/dist/lib/parsers/xml/parse-xml-helpers.js +0 -68
  197. package/dist/lib/services/arcgis/arcgis-image-service.d.ts.map +0 -1
  198. package/dist/lib/services/arcgis/arcgis-image-service.js +0 -94
  199. package/dist/lib/services/arcgis/arcgis-server.d.ts.map +0 -1
  200. package/dist/lib/services/arcgis/arcgis-server.js +0 -42
  201. package/dist/lib/services/generic/image-service.d.ts.map +0 -1
  202. package/dist/lib/services/generic/image-service.js +0 -47
  203. package/dist/lib/services/ogc/csw-service.d.ts.map +0 -1
  204. package/dist/lib/services/ogc/csw-service.js +0 -168
  205. package/dist/lib/services/ogc/wms-service.d.ts.map +0 -1
  206. package/dist/lib/services/ogc/wms-service.js +0 -317
  207. package/dist/lib/sources/data-source.d.ts +0 -32
  208. package/dist/lib/sources/data-source.d.ts.map +0 -1
  209. package/dist/lib/sources/data-source.js +0 -56
  210. package/dist/lib/sources/image-source.d.ts +0 -79
  211. package/dist/lib/sources/image-source.d.ts.map +0 -1
  212. package/dist/lib/sources/image-source.js +0 -13
  213. package/dist/lib/sources/tile-source.d.ts +0 -56
  214. package/dist/lib/sources/tile-source.d.ts.map +0 -1
  215. package/dist/lib/sources/tile-source.js +0 -13
  216. package/dist/lib/sources/utils/utils.d.ts +0 -13
  217. package/dist/lib/sources/utils/utils.d.ts.map +0 -1
  218. package/dist/lib/sources/utils/utils.js +0 -38
  219. package/dist/lib/wfs/parse-wfs.d.ts.map +0 -1
  220. package/dist/lib/wfs/parse-wfs.js +0 -32
  221. package/dist/lib/wmts/parse-wmts.d.ts.map +0 -1
  222. package/dist/lib/wmts/parse-wmts.js +0 -35
  223. package/dist/wip/arcgis-feature-service.d.ts.map +0 -1
  224. package/dist/wip/arcgis-feature-service.js +0 -28
  225. package/dist/wip/data-source.js +0 -59
  226. package/dist/wip/lib/wcs/parse-wcs-capabilities.js +0 -15
  227. package/dist/wip/lib/wfs/parse-wfs-capabilities.js +0 -19
  228. package/dist/wip/lib/wmts/parse-wmts-capabilities.js +0 -77
  229. package/dist/wip/wcs-capabilities-loader.js +0 -31
  230. package/dist/wip/wfs-capabilities-loader.js +0 -31
  231. package/dist/wip/wms-feature-info-loader.js +0 -17
  232. package/dist/wip/wms-layer-description-loader.js +0 -17
  233. package/dist/wip/wmts-capabilities-loader.js +0 -32
  234. package/dist/wms-capabilities-loader.js +0 -35
  235. package/dist/wms-error-loader.js +0 -43
  236. package/src/lib/create-image-source.ts +0 -48
  237. package/src/lib/sources/data-source.ts +0 -73
  238. package/src/lib/sources/image-source.ts +0 -92
  239. package/src/lib/sources/tile-source.ts +0 -61
  240. package/src/lib/sources/utils/utils.ts +0 -42
  241. /package/dist/es5/{lib/services → services}/arcgis/arcgis-server.js +0 -0
  242. /package/dist/es5/{lib → wip/lib}/wfs/parse-wfs.js +0 -0
  243. /package/dist/es5/{lib → wip/lib}/wmts/parse-wmts.js +0 -0
  244. /package/dist/es5/wip/{arcgis-feature-service.js → services/arcgis-feature-service.js} +0 -0
  245. /package/dist/es5/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
  246. /package/dist/esm/{lib/services → services}/arcgis/arcgis-server.js +0 -0
  247. /package/dist/esm/{lib → wip/lib}/wfs/parse-wfs.js +0 -0
  248. /package/dist/esm/{lib → wip/lib}/wmts/parse-wmts.js +0 -0
  249. /package/dist/esm/wip/{arcgis-feature-service.js → services/arcgis-feature-service.js} +0 -0
  250. /package/dist/esm/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
  251. /package/dist/{lib/services → services}/arcgis/arcgis-server.d.ts +0 -0
  252. /package/dist/{lib → wip/lib}/wfs/parse-wfs.d.ts +0 -0
  253. /package/dist/{lib → wip/lib}/wmts/parse-wmts.d.ts +0 -0
  254. /package/dist/wip/{arcgis-feature-service.d.ts → services/arcgis-feature-service.d.ts} +0 -0
  255. /package/src/{lib/services → services}/arcgis/arcgis-server.ts +0 -0
  256. /package/src/{lib → wip/lib}/wfs/parse-wfs.ts +0 -0
  257. /package/src/{lib → wip/lib}/wmts/parse-wmts.ts +0 -0
  258. /package/src/wip/{arcgis-feature-service.ts → services/arcgis-feature-service.ts} +0 -0
  259. /package/src/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
package/src/gml-loader.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
4
+ import type {Geometry} from './lib/parsers/gml/parse-gml';
4
5
  import {parseGML} from './lib/parsers/gml/parse-gml';
5
6
 
6
7
  // __VERSION__ is injected by babel-plugin-version-inline
@@ -14,7 +15,7 @@ export type GMLLoaderOptions = LoaderOptions & {
14
15
  /**
15
16
  * Loader for the response to the GML GetCapability request
16
17
  */
17
- export const GMLLoader = {
18
+ export const GMLLoader: LoaderWithParser<Geometry | null, never, GMLLoaderOptions> = {
18
19
  name: 'GML',
19
20
  id: 'gml',
20
21
 
@@ -36,5 +37,3 @@ function testXMLFile(text: string): boolean {
36
37
  // TODO - There could be space first.
37
38
  return text.startsWith('<?xml');
38
39
  }
39
-
40
- export const _typecheckGMLLoader: LoaderWithParser = GMLLoader;
package/src/index.ts CHANGED
@@ -54,26 +54,27 @@ export {GMLLoader as _GMLLoader} from './gml-loader';
54
54
  // EXPERIMENTAL: DATA SOURCES
55
55
 
56
56
  export type {ImageType} from '@loaders.gl/images';
57
- export type {ImageSourceProps, ImageSourceMetadata} from './lib/sources/image-source';
58
- export {ImageSource} from './lib/sources/image-source';
59
57
 
60
- export type {ImageServiceType} from './lib/create-image-source';
61
- export {createImageSource} from './lib/create-image-source';
58
+ export type {CreateImageServiceProps} from './lib/services/create-image-service';
59
+ export {createImageService} from './lib/services/create-image-service';
60
+
61
+ export type {ImageServiceType} from './services/create-image-source';
62
+ export {createImageSource} from './services/create-image-source';
62
63
 
63
64
  // Generic (Template URL) Services
64
65
 
65
- export type {ImageServiceProps} from './lib/services/generic/image-service';
66
- export {ImageService} from './lib/services/generic/image-service';
66
+ export type {ImageServiceProps} from './lib/services/image-service';
67
+ export {ImageService} from './lib/services/image-service';
67
68
 
68
69
  // OGC Services
69
70
 
70
- export {CSWService} from './lib/services/ogc/csw-service';
71
- export {WMSService} from './lib/services/ogc/wms-service';
71
+ export {CSWService} from './services/ogc/csw-service';
72
+ export {WMSSource, WMSService} from './services/ogc/wms-service';
72
73
 
73
74
  // ArcGIS Services
74
75
 
75
- export {getArcGISServices as _getArcGISServices} from './lib/services/arcgis/arcgis-server';
76
- export {ArcGISImageServer as _ArcGISImageServer} from './lib/services/arcgis/arcgis-image-service';
76
+ export {getArcGISServices as _getArcGISServices} from './services/arcgis/arcgis-server';
77
+ export {ArcGISImageService as _ArcGISImageService} from './services/arcgis/arcgis-image-service';
77
78
 
78
79
  // LERC - Limited Error Raster Compression
79
80
  // TODO - restore once esbuild bundling issues have been resolved
@@ -82,3 +83,6 @@ export {ArcGISImageServer as _ArcGISImageServer} from './lib/services/arcgis/arc
82
83
 
83
84
  /** @deprecated Use WMSCapabilitiesLoaderOptions */
84
85
  export type {WMSCapabilitiesLoaderOptions as WMSLoaderOptions} from './wms-capabilities-loader';
86
+
87
+ // TODO - restore once deck.gl has been udpated
88
+ export {ImageSource} from '@loaders.gl/loader-utils';
@@ -22,7 +22,7 @@ export type LERCLoaderOptions = LoaderOptions & {
22
22
  /**
23
23
  * Loader for the LERC raster format
24
24
  */
25
- export const LERCLoader = {
25
+ export const LERCLoader: LoaderWithParser<LERCData, never, LERCLoaderOptions> = {
26
26
  id: 'lerc',
27
27
  name: 'LERC',
28
28
 
@@ -46,5 +46,3 @@ async function parseLERC(arrayBuffer: ArrayBuffer, options?: LERCLoaderOptions):
46
46
  const pixelBlock = Lerc.decode(arrayBuffer, options?.lerc);
47
47
  return pixelBlock;
48
48
  }
49
-
50
- export const _typecheckLERCLoader: LoaderWithParser = LERCLoader;
@@ -29,6 +29,8 @@ function noTransform(...coords) {
29
29
  return coords;
30
30
  }
31
31
 
32
+ export type {Geometry};
33
+
32
34
  export type ParseGMLOptions = {
33
35
  transformCoords?: Function;
34
36
  stride?: 2 | 3 | 4;
@@ -0,0 +1,55 @@
1
+ // loaders.gl, MIT license
2
+
3
+ import {ImageSource, Service} from '@loaders.gl/loader-utils';
4
+ import {ImageServiceProps} from './image-service';
5
+
6
+ export type CreateImageServiceProps = ImageServiceProps & {
7
+ type?: string | 'auto';
8
+ };
9
+
10
+ /**
11
+ * Creates an image source
12
+ * If type is not supplied, will try to automatically detect the the
13
+ * @param url URL to the image source
14
+ * @param type type of source. if not known, set to 'auto'
15
+ * @returns an ImageSource instance
16
+ */
17
+ export function createImageService(
18
+ props: CreateImageServiceProps,
19
+ services: Service[]
20
+ ): ImageSource {
21
+ const {type = 'auto'} = props;
22
+ const service: Service | null =
23
+ type === 'auto' ? guessServiceType(props.url, services) : getServiceOfType(type, services);
24
+
25
+ if (!service) {
26
+ throw new Error('Not a valid image source type');
27
+ }
28
+ return service.create(props);
29
+ }
30
+
31
+ /** Guess service type from URL */
32
+ function getServiceOfType(type: string, services: Service[]): Service | null {
33
+ // if (type === 'template') {
34
+ // return ImageService;
35
+ // }
36
+
37
+ for (const service of services) {
38
+ if (service.type === type) {
39
+ return service;
40
+ }
41
+ }
42
+
43
+ return null;
44
+ }
45
+
46
+ /** Guess service type from URL */
47
+ function guessServiceType(url: string, services: Service[]): Service | null {
48
+ for (const service of services) {
49
+ if (service.testURL && service.testURL(url)) {
50
+ return service;
51
+ }
52
+ }
53
+
54
+ return null;
55
+ }
@@ -4,8 +4,8 @@ import {LoaderOptions} from '@loaders.gl/loader-utils';
4
4
  import type {ImageType} from '@loaders.gl/images';
5
5
  import {ImageLoader} from '@loaders.gl/images';
6
6
 
7
- import type {ImageSourceMetadata, GetImageParameters} from '../../sources/image-source';
8
- import {ImageSource} from '../../sources/image-source';
7
+ import type {ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';
8
+ import {ImageSource} from '@loaders.gl/loader-utils';
9
9
 
10
10
  /** Template URL string should contain `${width}` etc which will be substituted. */
11
11
  export type ImageServiceProps = {
@@ -20,8 +20,10 @@ export type ImageServiceProps = {
20
20
  * ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources
21
21
  * Accepts a template url string and builds requests URLs
22
22
  */
23
- export class ImageService<PropsT extends ImageServiceProps> extends ImageSource<PropsT> {
24
- static type: 'template' = 'template';
23
+ export class ImageService<
24
+ PropsT extends ImageServiceProps = ImageServiceProps
25
+ > extends ImageSource<PropsT> {
26
+ static type: string = 'template';
25
27
  static testURL = (url: string): boolean => url.toLowerCase().includes('{');
26
28
 
27
29
  constructor(props: PropsT) {
@@ -1,11 +1,15 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  import {ImageType} from '@loaders.gl/images';
4
- import type {ImageSourceMetadata, GetImageParameters} from '../../sources/image-source';
5
- import type {ImageSourceProps} from '../../sources/image-source';
6
- import {ImageSource} from '../../sources/image-source';
4
+ import type {Service, ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';
7
5
 
8
- export type ArcGISImageServerProps = ImageSourceProps & {
6
+ import type {ImageServiceProps} from '../../lib/services/image-service';
7
+ import {ImageService} from '../../lib/services/image-service';
8
+
9
+ // import type {ImageSourceProps} from '@loaders.gl/loader-utils';
10
+ // import {ImageSource} from '@loaders.gl/loader-utils';
11
+
12
+ export type ArcGISImageServerProps = ImageServiceProps & {
9
13
  url: string;
10
14
  };
11
15
 
@@ -14,10 +18,7 @@ export type ArcGISImageServerProps = ImageSourceProps & {
14
18
  * Note - exports a big API, that could be exposed here if there is a use case
15
19
  * @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm
16
20
  */
17
- export class ArcGISImageServer extends ImageSource<ArcGISImageServerProps> {
18
- static type: 'arcgis-image-server' = 'arcgis-image-server';
19
- static testURL = (url: string): boolean => url.toLowerCase().includes('ImageServer');
20
-
21
+ export class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {
21
22
  constructor(props: ArcGISImageServerProps) {
22
23
  super(props);
23
24
  }
@@ -149,3 +150,9 @@ export class ArcGISImageServer extends ImageSource<ArcGISImageServerProps> {
149
150
  }
150
151
  }
151
152
  }
153
+
154
+ export const ArcGISImageService: Service = {
155
+ type: 'arcgis-image-server',
156
+ testURL: (url: string): boolean => url.toLowerCase().includes('ImageServer'),
157
+ create: (props: ArcGISImageServerProps): ArcGISImageSource => new ArcGISImageSource(props)
158
+ };
@@ -0,0 +1,31 @@
1
+ // loaders.gl, MIT license
2
+
3
+ import type {Service, ImageSource} from '@loaders.gl/loader-utils';
4
+ // import {ImageService} from '../lib/services/image-service';
5
+ import {ImageServiceProps} from '../lib/services/image-service';
6
+ import {createImageService, CreateImageServiceProps} from '../lib/services/create-image-service';
7
+
8
+ import type {WMSSourceProps} from './ogc/wms-service';
9
+ import {WMSService} from './ogc/wms-service';
10
+ import {ArcGISImageService} from './arcgis/arcgis-image-service';
11
+
12
+ export type ImageServiceType = 'wms' | 'arcgis-image-server' | 'template';
13
+
14
+ const SERVICES: Service[] = [WMSService, ArcGISImageService];
15
+
16
+ type CreateImageSourceProps = CreateImageServiceProps &
17
+ ImageServiceProps &
18
+ WMSSourceProps & {
19
+ type?: ImageServiceType | 'auto';
20
+ };
21
+
22
+ /**
23
+ * Creates an image source
24
+ * If type is not supplied, will try to automatically detect the the
25
+ * @param url URL to the image source
26
+ * @param type type of source. if not known, set to 'auto'
27
+ * @returns an ImageSource instance
28
+ */
29
+ export function createImageSource(props: CreateImageSourceProps): ImageSource {
30
+ return createImageService(props, SERVICES);
31
+ }
@@ -2,19 +2,19 @@
2
2
 
3
3
  /* eslint-disable camelcase */
4
4
 
5
- import type {DataSourceProps} from '../../sources/data-source';
6
- import {DataSource} from '../../sources/data-source';
5
+ import type {DataSourceProps} from '@loaders.gl/loader-utils';
6
+ import {DataSource} from '@loaders.gl/loader-utils';
7
7
 
8
- import type {CSWCapabilities} from '../../../csw-capabilities-loader';
9
- import {CSWCapabilitiesLoader} from '../../../csw-capabilities-loader';
8
+ import type {CSWCapabilities} from '../../csw-capabilities-loader';
9
+ import {CSWCapabilitiesLoader} from '../../csw-capabilities-loader';
10
10
 
11
- import type {CSWRecords} from '../../../csw-records-loader';
12
- import {CSWRecordsLoader} from '../../../csw-records-loader';
11
+ import type {CSWRecords} from '../../csw-records-loader';
12
+ import {CSWRecordsLoader} from '../../csw-records-loader';
13
13
 
14
- import type {CSWDomain} from '../../../csw-domain-loader';
15
- import {CSWDomainLoader} from '../../../csw-domain-loader';
14
+ import type {CSWDomain} from '../../csw-domain-loader';
15
+ import {CSWDomainLoader} from '../../csw-domain-loader';
16
16
 
17
- import {WMSErrorLoader as CSWErrorLoader} from '../../../wms-error-loader';
17
+ import {WMSErrorLoader as CSWErrorLoader} from '../../wms-error-loader';
18
18
 
19
19
  type CSWCommonParameters = {
20
20
  /** In case the endpoint supports multiple services */
@@ -244,14 +244,14 @@ export class CSWService extends DataSource<CSWServiceProps> {
244
244
  protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {
245
245
  const contentType = response.headers['content-type'];
246
246
  if (!response.ok || CSWErrorLoader.mimeTypes.includes(contentType)) {
247
- const error = CSWErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
247
+ const error = CSWErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);
248
248
  throw new Error(error);
249
249
  }
250
250
  }
251
251
 
252
252
  /** Error situation detected */
253
253
  protected _parseError(arrayBuffer: ArrayBuffer): Error {
254
- const error = CSWErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
254
+ const error = CSWErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);
255
255
  return new Error(error);
256
256
  }
257
257
  }
@@ -5,24 +5,30 @@ import type {ImageType} from '@loaders.gl/images';
5
5
  import {ImageLoader} from '@loaders.gl/images';
6
6
  import {mergeLoaderOptions} from '@loaders.gl/loader-utils';
7
7
 
8
- import type {ImageSourceMetadata, GetImageParameters} from '../../sources/image-source';
9
- import type {ImageSourceProps} from '../../sources/image-source';
10
- import {ImageSource} from '../../sources/image-source';
8
+ import type {Service, ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';
9
+ import {ImageSource} from '@loaders.gl/loader-utils';
10
+ import type {ImageServiceProps} from '../../lib/services/image-service';
11
11
 
12
- import type {WMSCapabilities} from '../../../wms-capabilities-loader';
13
- import type {WMSFeatureInfo} from '../../../wip/wms-feature-info-loader';
14
- import type {WMSLayerDescription} from '../../../wip/wms-layer-description-loader';
12
+ import type {WMSCapabilities} from '../../wms-capabilities-loader';
13
+ import type {WMSFeatureInfo} from '../../wip/wms-feature-info-loader';
14
+ import type {WMSLayerDescription} from '../../wip/wms-layer-description-loader';
15
15
 
16
- import {WMSCapabilitiesLoader} from '../../../wms-capabilities-loader';
17
- import {WMSFeatureInfoLoader} from '../../../wip/wms-feature-info-loader';
18
- import {WMSLayerDescriptionLoader} from '../../../wip/wms-layer-description-loader';
16
+ import {WMSCapabilitiesLoader} from '../../wms-capabilities-loader';
17
+ import {WMSFeatureInfoLoader} from '../../wip/wms-feature-info-loader';
18
+ import {WMSLayerDescriptionLoader} from '../../wip/wms-layer-description-loader';
19
19
 
20
- import type {WMSLoaderOptions} from '../../../wms-error-loader';
21
- import {WMSErrorLoader} from '../../../wms-error-loader';
20
+ import type {WMSLoaderOptions} from '../../wms-error-loader';
21
+ import {WMSErrorLoader} from '../../wms-error-loader';
22
+
23
+ export const WMSService: Service<WMSSource, WMSSourceProps> = {
24
+ type: 'wms',
25
+ testURL: (url: string): boolean => url.toLowerCase().includes('wms'),
26
+ create: (props: WMSSourceProps) => new WMSSource(props)
27
+ };
22
28
 
23
29
  /**
24
30
  * "Static" WMS parameters (not viewport or selected pixel dependent)
25
- * These can be provided as defaults in the WMSService constructor
31
+ * These can be provided as defaults in the WMSSource constructor
26
32
  */
27
33
  export type WMSParameters = {
28
34
  /** WMS version (all requests) */
@@ -40,7 +46,7 @@ export type WMSParameters = {
40
46
  info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';
41
47
  /** Styling - Not yet supported */
42
48
  styles?: unknown;
43
- /** Any additional parameters specific to this WMSService (GetMap) */
49
+ /** Any additional parameters specific to this WMSSource (GetMap) */
44
50
  transparent?: boolean;
45
51
  /** If layer supports time dimension */
46
52
  time?: string;
@@ -152,12 +158,11 @@ export type WMSGetLegendGraphicParameters = {
152
158
  //
153
159
 
154
160
  /** Properties for creating a enw WMS service */
155
- export type WMSServiceProps = ImageSourceProps & {
161
+ export type WMSSourceProps = ImageServiceProps & {
156
162
  /** Base URL to the service */
157
163
  url: string;
158
164
  /** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */
159
165
  substituteCRS84?: boolean;
160
-
161
166
  /** Default WMS parameters. If not provided here, must be provided in the various request */
162
167
  wmsParameters?: WMSParameters;
163
168
  /** Any additional service specific parameters */
@@ -165,16 +170,13 @@ export type WMSServiceProps = ImageSourceProps & {
165
170
  };
166
171
 
167
172
  /**
168
- * The WMSService class provides
173
+ * The WMSSource class provides
169
174
  * - provides type safe methods to form URLs to a WMS service
170
175
  * - provides type safe methods to query and parse results (and errors) from a WMS service
171
176
  * - implements the ImageService interface
172
177
  * @note Only the URL parameter conversion is supported. XML posts are not supported.
173
178
  */
174
- export class WMSService extends ImageSource<WMSServiceProps> {
175
- static type: 'wms' = 'wms';
176
- static testURL = (url: string): boolean => url.toLowerCase().includes('wms');
177
-
179
+ export class WMSSource extends ImageSource<WMSSourceProps> {
178
180
  /** Base URL to the service */
179
181
  readonly url: string;
180
182
 
@@ -190,17 +192,8 @@ export class WMSService extends ImageSource<WMSServiceProps> {
190
192
 
191
193
  capabilities: WMSCapabilities | null = null;
192
194
 
193
- /** A list of loaders used by the WMSService methods */
194
- readonly loaders = [
195
- ImageLoader,
196
- WMSErrorLoader,
197
- WMSCapabilitiesLoader,
198
- WMSFeatureInfoLoader,
199
- WMSLayerDescriptionLoader
200
- ];
201
-
202
- /** Create a WMSService */
203
- constructor(props: WMSServiceProps) {
195
+ /** Create a WMSSource */
196
+ constructor(props: WMSSourceProps) {
204
197
  super(props);
205
198
 
206
199
  // TODO - defaults such as version, layers etc could be extracted from a base URL with parameters
@@ -229,7 +222,7 @@ export class WMSService extends ImageSource<WMSServiceProps> {
229
222
  this.vendorParameters = props.vendorParameters || {};
230
223
  }
231
224
 
232
- // ImageSource implementation
225
+ // ImageService implementation
233
226
  async getMetadata(): Promise<ImageSourceMetadata> {
234
227
  const capabilities = await this.getCapabilities();
235
228
  return this.normalizeMetadata(capabilities);
@@ -555,14 +548,14 @@ export class WMSService extends ImageSource<WMSServiceProps> {
555
548
  const loadOptions = mergeLoaderOptions<WMSLoaderOptions>(this.loadOptions, {
556
549
  wms: {throwOnError: true}
557
550
  });
558
- const error = WMSErrorLoader.parseSync(arrayBuffer, loadOptions);
551
+ const error = WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);
559
552
  throw new Error(error);
560
553
  }
561
554
  }
562
555
 
563
556
  /** Error situation detected */
564
557
  protected _parseError(arrayBuffer: ArrayBuffer): Error {
565
- const error = WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
558
+ const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);
566
559
  return new Error(error);
567
560
  }
568
561
  }
@@ -17,7 +17,7 @@ export type WFSLoaderOptions = LoaderOptions & {
17
17
  /**
18
18
  * Loader for the response to the WFS GetCapability request
19
19
  */
20
- export const WFSCapabilitiesLoader = {
20
+ export const WFSCapabilitiesLoader: LoaderWithParser<WFSCapabilities, never, WFSLoaderOptions> = {
21
21
  id: 'wfs-capabilities',
22
22
  name: 'WFS Capabilities',
23
23
 
@@ -28,7 +28,7 @@ export const WFSCapabilitiesLoader = {
28
28
  mimeTypes: ['application/vnd.ogc.wfs_xml', 'application/xml', 'text/xml'],
29
29
  testText: testXMLFile,
30
30
  options: {
31
- wms: {}
31
+ wfs: {}
32
32
  },
33
33
  parse: async (arrayBuffer: ArrayBuffer, options?: WFSLoaderOptions) =>
34
34
  parseWFSCapabilities(new TextDecoder().decode(arrayBuffer), options),
@@ -12,7 +12,8 @@ export {WMSFeatureInfo};
12
12
  /**
13
13
  * Loader for the response to the WMS GetFeatureInfo request
14
14
  */
15
- export const WMSFeatureInfoLoader = {
15
+ // @ts-expect-error
16
+ export const WMSFeatureInfoLoader: LoaderWithParser<WMSFeatureInfo, never, XMLLoaderOptions> = {
16
17
  ...WMSCapabilitiesLoader,
17
18
 
18
19
  id: 'wms-feature-info',
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type {LoaderWithParser} from '@loaders.gl/loader-utils';
4
4
  import type {XMLLoaderOptions} from '@loaders.gl/xml';
5
- import {parseWMSCapabilities} from './lib/parsers/wms/parse-wms-capabilities';
5
+ import {WMSCapabilities, parseWMSCapabilities} from './lib/parsers/wms/parse-wms-capabilities';
6
6
 
7
7
  // __VERSION__ is injected by babel-plugin-version-inline
8
8
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -34,7 +34,11 @@ export type WMSCapabilitiesLoaderOptions = XMLLoaderOptions & {
34
34
  /**
35
35
  * Loader for the response to the WMS GetCapability request
36
36
  */
37
- export const WMSCapabilitiesLoader = {
37
+ export const WMSCapabilitiesLoader: LoaderWithParser<
38
+ WMSCapabilities,
39
+ never,
40
+ WMSCapabilitiesLoaderOptions
41
+ > = {
38
42
  id: 'wms-capabilities',
39
43
  name: 'WMS Capabilities',
40
44
 
@@ -59,5 +63,3 @@ function testXMLFile(text: string): boolean {
59
63
  // TODO - There could be space first.
60
64
  return text.startsWith('<?xml');
61
65
  }
62
-
63
- export const _typecheckWMSCapabilitiesLoader: LoaderWithParser = WMSCapabilitiesLoader;
@@ -19,7 +19,7 @@ export type WMSLoaderOptions = LoaderOptions & {
19
19
  /**
20
20
  * Loader for the response to the WMS GetCapability request
21
21
  */
22
- export const WMSErrorLoader = {
22
+ export const WMSErrorLoader: LoaderWithParser<string, never, WMSLoaderOptions> = {
23
23
  id: 'wms-error',
24
24
  name: 'WMS Error',
25
25
 
@@ -55,5 +55,3 @@ function parseTextSync(text: string, options?: WMSLoaderOptions): string {
55
55
  }
56
56
  return message;
57
57
  }
58
-
59
- export const _typecheckWMSErrorLoader: LoaderWithParser = WMSErrorLoader;
package/dist/bundle.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- // @ts-nocheck
4
- const moduleExports = require('./index');
5
- globalThis.loaders = globalThis.loaders || {};
6
- module.exports = Object.assign(globalThis.loaders, moduleExports);
@@ -1,31 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports._typecheckCSWCapabilitiesLoader = exports.CSWCapabilitiesLoader = void 0;
5
- const parse_csw_capabilities_1 = require("./lib/parsers/csw/parse-csw-capabilities");
6
- // __VERSION__ is injected by babel-plugin-version-inline
7
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
9
- /**
10
- * Loader for the response to the CSW GetCapability request
11
- */
12
- exports.CSWCapabilitiesLoader = {
13
- id: 'csw-capabilities',
14
- name: 'CSW Capabilities',
15
- module: 'wms',
16
- version: VERSION,
17
- worker: false,
18
- extensions: ['xml'],
19
- mimeTypes: ['application/vnd.ogc.csw_xml', 'application/xml', 'text/xml'],
20
- testText: testXMLFile,
21
- options: {
22
- csw: {}
23
- },
24
- parse: async (arrayBuffer, options) => (0, parse_csw_capabilities_1.parseCSWCapabilities)(new TextDecoder().decode(arrayBuffer), options),
25
- parseTextSync: (text, options) => (0, parse_csw_capabilities_1.parseCSWCapabilities)(text, options)
26
- };
27
- function testXMLFile(text) {
28
- // TODO - There could be space first.
29
- return text.startsWith('<?xml');
30
- }
31
- exports._typecheckCSWCapabilitiesLoader = exports.CSWCapabilitiesLoader;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports._typecheckCSWDomainLoader = exports.CSWDomainLoader = void 0;
5
- const parse_csw_domain_1 = require("./lib/parsers/csw/parse-csw-domain");
6
- // __VERSION__ is injected by babel-plugin-version-inline
7
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
9
- /**
10
- * Loader for the response to the CSW GetCapability request
11
- */
12
- exports.CSWDomainLoader = {
13
- id: 'csw-domain',
14
- name: 'CSW Domain',
15
- module: 'wms',
16
- version: VERSION,
17
- worker: false,
18
- extensions: ['xml'],
19
- mimeTypes: ['application/vnd.ogc.csw_xml', 'application/xml', 'text/xml'],
20
- testText: testXMLFile,
21
- options: {
22
- csw: {}
23
- },
24
- parse: async (arrayBuffer, options) => (0, parse_csw_domain_1.parseCSWDomain)(new TextDecoder().decode(arrayBuffer), options),
25
- parseTextSync: (text, options) => (0, parse_csw_domain_1.parseCSWDomain)(text, options)
26
- };
27
- function testXMLFile(text) {
28
- // TODO - There could be space first.
29
- return text.startsWith('<?xml');
30
- }
31
- exports._typecheckCSWDomainLoader = exports.CSWDomainLoader;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.CSWRecordsLoader = void 0;
5
- const parse_csw_records_1 = require("./lib/parsers/csw/parse-csw-records");
6
- // __VERSION__ is injected by babel-plugin-version-inline
7
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
9
- /**
10
- * Loader for the response to the CSW GetCapability request
11
- */
12
- exports.CSWRecordsLoader = {
13
- id: 'csw-records',
14
- name: 'CSW Domain',
15
- module: 'wms',
16
- version: VERSION,
17
- worker: false,
18
- extensions: ['xml'],
19
- mimeTypes: ['application/vnd.ogc.csw_xml', 'application/xml', 'text/xml'],
20
- testText: testXMLFile,
21
- options: {
22
- csw: {}
23
- },
24
- parse: async (arrayBuffer, options) => (0, parse_csw_records_1.parseCSWRecords)(new TextDecoder().decode(arrayBuffer), options),
25
- parseTextSync: (text, options) => (0, parse_csw_records_1.parseCSWRecords)(text, options)
26
- };
27
- function testXMLFile(text) {
28
- // TODO - There could be space first.
29
- return text.startsWith('<?xml');
30
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-image-source.js","names":["_imageService","require","_wmsService","_arcgisImageService","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","SERVICES","WMSService","ArcGISImageServer","ImageService","createImageSource","props","_props$type","type","serviceType","guessServiceType","url","Error","_iterator","_step","Service","testURL"],"sources":["../../../src/lib/create-image-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {ImageSource} from './sources/image-source';\nimport {ImageService, ImageServiceProps} from './services/generic/image-service';\nimport type {WMSServiceProps} from './services/ogc/wms-service';\nimport {WMSService} from './services/ogc/wms-service';\nimport {ArcGISImageServer} from './services/arcgis/arcgis-image-service';\n\nexport type ImageServiceType = 'wms' | 'arcgis-image-server' | 'template';\n\nconst SERVICES = [WMSService, ArcGISImageServer, ImageService];\n\ntype ImageSourceProps = ImageServiceProps &\n WMSServiceProps & {\n type?: ImageServiceType | 'auto';\n };\n\n/**\n * Creates an image source\n * If type is not supplied, will try to automatically detect the the\n * @param url URL to the image source\n * @param type type of source. if not known, set to 'auto'\n * @returns an ImageSource instance\n */\nexport function createImageSource(props: ImageSourceProps): ImageSource<ImageSourceProps> {\n const {type = 'auto'} = props;\n const serviceType = type === 'auto' ? guessServiceType(props.url) : type;\n switch (serviceType) {\n case 'template':\n return new ImageService(props);\n case 'wms':\n return new WMSService(props);\n default:\n // currently only wms service supported\n throw new Error('Not a valid image source type');\n }\n}\n\n/** Guess service type from URL */\nfunction guessServiceType(url: string): ImageServiceType {\n for (const Service of SERVICES) {\n if (Service.testURL && Service.testURL(url)) {\n return Service.type;\n }\n }\n // If all else fails, guess that this is MS service\n return 'wms';\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAA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