@loaders.gl/wms 3.4.0-alpha.3 → 3.4.0-alpha.5

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 (139) hide show
  1. package/dist/dist.min.js +90 -14
  2. package/dist/es5/csw-capabilities-loader.js +1 -1
  3. package/dist/es5/csw-capabilities-loader.js.map +1 -1
  4. package/dist/es5/csw-domain-loader.js +1 -1
  5. package/dist/es5/csw-domain-loader.js.map +1 -1
  6. package/dist/es5/csw-records-loader.js +1 -1
  7. package/dist/es5/csw-records-loader.js.map +1 -1
  8. package/dist/es5/gml-loader.js +1 -1
  9. package/dist/es5/gml-loader.js.map +1 -1
  10. package/dist/es5/index.js.map +1 -1
  11. package/dist/es5/lerc-loader.js +1 -1
  12. package/dist/es5/lerc-loader.js.map +1 -1
  13. package/dist/es5/lib/create-image-source.js.map +1 -1
  14. package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
  15. package/dist/es5/lib/parsers/csw/parse-csw-domain.js.map +1 -1
  16. package/dist/es5/lib/parsers/csw/parse-csw-records.js.map +1 -1
  17. package/dist/es5/lib/parsers/csw/parse-exception-report.js.map +1 -1
  18. package/dist/es5/lib/parsers/gml/deep-strict-equal.js.map +1 -1
  19. package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
  20. package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js +33 -0
  21. package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
  22. package/dist/es5/lib/parsers/xml/parse-xml-helpers.js.map +1 -1
  23. package/dist/es5/lib/services/arcgis/arcgis-image-service.js +1 -6
  24. package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +1 -1
  25. package/dist/es5/lib/services/arcgis/arcgis-server.js.map +1 -1
  26. package/dist/es5/lib/services/generic/image-service.js +1 -6
  27. package/dist/es5/lib/services/generic/image-service.js.map +1 -1
  28. package/dist/es5/lib/services/ogc/csw-service.js +0 -2
  29. package/dist/es5/lib/services/ogc/csw-service.js.map +1 -1
  30. package/dist/es5/lib/services/ogc/wms-service.js +62 -20
  31. package/dist/es5/lib/services/ogc/wms-service.js.map +1 -1
  32. package/dist/es5/lib/sources/data-source.js +36 -8
  33. package/dist/es5/lib/sources/data-source.js.map +1 -1
  34. package/dist/es5/lib/sources/image-source.js.map +1 -1
  35. package/dist/es5/lib/sources/tile-source.js.map +1 -1
  36. package/dist/es5/wip/arcgis-feature-service.js.map +1 -1
  37. package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
  38. package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
  39. package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
  40. package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
  41. package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -1
  42. package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
  43. package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -1
  44. package/dist/es5/wip/wms-feature-info-loader.js.map +1 -1
  45. package/dist/es5/wip/wms-layer-description-loader.js.map +1 -1
  46. package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
  47. package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
  48. package/dist/es5/wms-capabilities-loader.js +1 -1
  49. package/dist/es5/wms-capabilities-loader.js.map +1 -1
  50. package/dist/es5/wms-error-loader.js +1 -1
  51. package/dist/es5/wms-error-loader.js.map +1 -1
  52. package/dist/esm/csw-capabilities-loader.js +1 -1
  53. package/dist/esm/csw-capabilities-loader.js.map +1 -1
  54. package/dist/esm/csw-domain-loader.js +1 -1
  55. package/dist/esm/csw-domain-loader.js.map +1 -1
  56. package/dist/esm/csw-records-loader.js +1 -1
  57. package/dist/esm/csw-records-loader.js.map +1 -1
  58. package/dist/esm/gml-loader.js +1 -1
  59. package/dist/esm/gml-loader.js.map +1 -1
  60. package/dist/esm/index.js.map +1 -1
  61. package/dist/esm/lerc-loader.js +1 -1
  62. package/dist/esm/lerc-loader.js.map +1 -1
  63. package/dist/esm/lib/create-image-source.js.map +1 -1
  64. package/dist/esm/lib/parsers/csw/parse-exception-report.js.map +1 -1
  65. package/dist/esm/lib/parsers/gml/deep-strict-equal.js.map +1 -1
  66. package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
  67. package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js +33 -0
  68. package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
  69. package/dist/esm/lib/parsers/xml/parse-xml-helpers.js.map +1 -1
  70. package/dist/esm/lib/services/arcgis/arcgis-image-service.js +0 -2
  71. package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +1 -1
  72. package/dist/esm/lib/services/arcgis/arcgis-server.js.map +1 -1
  73. package/dist/esm/lib/services/generic/image-service.js +0 -2
  74. package/dist/esm/lib/services/generic/image-service.js.map +1 -1
  75. package/dist/esm/lib/services/ogc/csw-service.js +0 -2
  76. package/dist/esm/lib/services/ogc/csw-service.js.map +1 -1
  77. package/dist/esm/lib/services/ogc/wms-service.js +54 -14
  78. package/dist/esm/lib/services/ogc/wms-service.js.map +1 -1
  79. package/dist/esm/lib/sources/data-source.js +20 -0
  80. package/dist/esm/lib/sources/data-source.js.map +1 -1
  81. package/dist/esm/lib/sources/image-source.js.map +1 -1
  82. package/dist/esm/lib/sources/tile-source.js.map +1 -1
  83. package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
  84. package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -1
  85. package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
  86. package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -1
  87. package/dist/esm/wip/wms-feature-info-loader.js.map +1 -1
  88. package/dist/esm/wip/wms-layer-description-loader.js.map +1 -1
  89. package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
  90. package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -1
  91. package/dist/esm/wms-capabilities-loader.js +1 -1
  92. package/dist/esm/wms-capabilities-loader.js.map +1 -1
  93. package/dist/esm/wms-error-loader.js +1 -1
  94. package/dist/esm/wms-error-loader.js.map +1 -1
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/lib/create-image-source.d.ts +1 -1
  98. package/dist/lib/create-image-source.d.ts.map +1 -1
  99. package/dist/lib/parsers/wms/parse-wms-capabilities.d.ts +24 -0
  100. package/dist/lib/parsers/wms/parse-wms-capabilities.d.ts.map +1 -1
  101. package/dist/lib/parsers/wms/parse-wms-capabilities.js +33 -0
  102. package/dist/lib/services/arcgis/arcgis-image-service.d.ts +1 -2
  103. package/dist/lib/services/arcgis/arcgis-image-service.d.ts.map +1 -1
  104. package/dist/lib/services/arcgis/arcgis-image-service.js +0 -1
  105. package/dist/lib/services/generic/image-service.d.ts +2 -3
  106. package/dist/lib/services/generic/image-service.d.ts.map +1 -1
  107. package/dist/lib/services/generic/image-service.js +0 -1
  108. package/dist/lib/services/ogc/csw-service.d.ts +1 -2
  109. package/dist/lib/services/ogc/csw-service.d.ts.map +1 -1
  110. package/dist/lib/services/ogc/csw-service.js +0 -1
  111. package/dist/lib/services/ogc/wms-service.d.ts +83 -32
  112. package/dist/lib/services/ogc/wms-service.d.ts.map +1 -1
  113. package/dist/lib/services/ogc/wms-service.js +73 -27
  114. package/dist/lib/sources/data-source.d.ts +12 -2
  115. package/dist/lib/sources/data-source.d.ts.map +1 -1
  116. package/dist/lib/sources/data-source.js +22 -0
  117. package/dist/lib/sources/image-source.d.ts +6 -6
  118. package/dist/lib/sources/image-source.d.ts.map +1 -1
  119. package/dist/lib/sources/tile-source.d.ts +4 -2
  120. package/dist/lib/sources/tile-source.d.ts.map +1 -1
  121. package/package.json +6 -6
  122. package/src/index.ts +1 -1
  123. package/src/lib/create-image-source.ts +1 -1
  124. package/src/lib/parsers/wms/parse-wms-capabilities.ts +65 -0
  125. package/src/lib/services/arcgis/arcgis-image-service.ts +1 -4
  126. package/src/lib/services/generic/image-service.ts +2 -5
  127. package/src/lib/services/ogc/csw-service.ts +1 -3
  128. package/src/lib/services/ogc/wms-service.ts +165 -60
  129. package/src/lib/sources/data-source.ts +29 -2
  130. package/src/lib/sources/image-source.ts +8 -6
  131. package/src/lib/sources/tile-source.ts +4 -2
  132. package/dist/es5/lib/services/generic/tile-service.js +0 -2
  133. package/dist/es5/lib/services/generic/tile-service.js.map +0 -1
  134. package/dist/esm/lib/services/generic/tile-service.js +0 -2
  135. package/dist/esm/lib/services/generic/tile-service.js.map +0 -1
  136. package/dist/lib/services/generic/tile-service.d.ts +0 -1
  137. package/dist/lib/services/generic/tile-service.d.ts.map +0 -1
  138. package/dist/lib/services/generic/tile-service.js +0 -1
  139. package/src/lib/services/generic/tile-service.ts +0 -0
@@ -17,7 +17,7 @@ export type ImageSourceMetadata = {
17
17
  export type ImageSourceLayer = {
18
18
  name?: string;
19
19
  title?: string;
20
- srs?: string[];
20
+ crs?: string[];
21
21
  boundingBox?: [number, number, number, number];
22
22
  layers?: ImageSourceLayer[];
23
23
  };
@@ -32,8 +32,8 @@ export type GetImageParameters = {
32
32
  width: number;
33
33
  /** pixels */
34
34
  height: number;
35
- /** srs for the image (not the bounding box) */
36
- srs?: string;
35
+ /** crs for the image (not the bounding box) */
36
+ crs?: string;
37
37
  /** requested format for the return image */
38
38
  format?: 'image/png';
39
39
  };
@@ -52,8 +52,8 @@ export type ImageFormat = {
52
52
  width: number;
53
53
  /** pixels */
54
54
  height: number;
55
- /** srs for the image (not the bounding box) */
56
- srs?: string;
55
+ /** crs for the image (not the bounding box) */
56
+ crs?: string;
57
57
  /** requested format for the return image */
58
58
  format?: 'image/png';
59
59
  };
@@ -63,7 +63,7 @@ export type ImageSourceProps = DataSourceProps;
63
63
  * @note
64
64
  * - If geospatial, bounding box is expected to be in web mercator coordinates
65
65
  */
66
- export declare abstract class ImageSource extends DataSource {
66
+ export declare abstract class ImageSource<PropsT extends ImageSourceProps = ImageSourceProps> extends DataSource<PropsT> {
67
67
  abstract getMetadata(): Promise<ImageSourceMetadata>;
68
68
  abstract getImage(parameters: GetImageParameters): Promise<ImageType>;
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"image-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/image-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uBAAuB;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,cAAc;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa;IACb,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC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,MAAM,CAAC;IACb,4CAA4C;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAE/C;;;;GAIG;AACH,8BAAsB,WAAW,CAC/B,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,CAClD,SAAQ,UAAU,CAAC,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IACpD,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;CACtE"}
@@ -1,5 +1,5 @@
1
1
  import type { ImageType } from '@loaders.gl/images';
2
- import { DataSource } from './data-source';
2
+ import { DataSource, DataSourceProps } from './data-source';
3
3
  /**
4
4
  * Normalized capabilities of an Image service
5
5
  * @example
@@ -42,13 +42,15 @@ export type GetTileParameters = {
42
42
  /** requested format for the return image */
43
43
  format?: 'image/png';
44
44
  };
45
+ type TileSourceProps = DataSourceProps;
45
46
  /**
46
47
  * MapTileSource - data sources that allow data to be queried by (geospatial) extents
47
48
  * @note
48
49
  * - If geospatial, bounding box is expected to be in web mercator coordinates
49
50
  */
50
- export declare abstract class TileSource extends DataSource {
51
+ export declare abstract class TileSource<PropsT extends TileSourceProps> extends DataSource<PropsT> {
51
52
  abstract getMetadata(): Promise<TileSourceMetadata>;
52
53
  abstract getTile(parameters: GetTileParameters): Promise<ImageType>;
53
54
  }
55
+ export {};
54
56
  //# sourceMappingURL=tile-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,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G,CAAC,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,KAAK,eAAe,GAAG,eAAe,CAAC;AAEvC;;;;GAIG;AACH,8BAAsB,UAAU,CAAC,MAAM,SAAS,eAAe,CAAE,SAAQ,UAAU,CAAC,MAAM,CAAC;IACzF,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CACpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/wms",
3
- "version": "3.4.0-alpha.3",
3
+ "version": "3.4.0-alpha.5",
4
4
  "description": "Framework-independent loaders for the WMS (Web Map Service) standard",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@babel/runtime": "^7.3.1",
42
- "@loaders.gl/images": "3.4.0-alpha.3",
43
- "@loaders.gl/loader-utils": "3.4.0-alpha.3",
44
- "@loaders.gl/schema": "3.4.0-alpha.3",
45
- "@loaders.gl/xml": "3.4.0-alpha.3",
42
+ "@loaders.gl/images": "3.4.0-alpha.5",
43
+ "@loaders.gl/loader-utils": "3.4.0-alpha.5",
44
+ "@loaders.gl/schema": "3.4.0-alpha.5",
45
+ "@loaders.gl/xml": "3.4.0-alpha.5",
46
46
  "@turf/rewind": "^5.1.5",
47
47
  "deep-strict-equal": "^0.2.0",
48
48
  "lerc": "^4.0.1"
@@ -50,5 +50,5 @@
50
50
  "devDependencies": {
51
51
  "xmldom": "0.6.0"
52
52
  },
53
- "gitHead": "a954528dd1d78a1f128d8f6b07e4baeb7a296924"
53
+ "gitHead": "686929f85b3420c15df051eab769942b260dd242"
54
54
  }
package/src/index.ts CHANGED
@@ -49,8 +49,8 @@ export {GMLLoader as _GMLLoader} from './gml-loader';
49
49
 
50
50
  // EXPERIMENTAL: DATA SOURCES
51
51
 
52
- export type {ImageSourceMetadata} from './lib/sources/image-source';
53
52
  export type {ImageType} from '@loaders.gl/images';
53
+ export type {ImageSourceProps, ImageSourceMetadata} from './lib/sources/image-source';
54
54
  export {ImageSource} from './lib/sources/image-source';
55
55
 
56
56
  export type {ImageServiceType} from './lib/create-image-source';
@@ -22,7 +22,7 @@ type ImageSourceProps = ImageServiceProps &
22
22
  * @param type type of source. if not known, set to 'auto'
23
23
  * @returns an ImageSource instance
24
24
  */
25
- export function createImageSource(props: ImageSourceProps): ImageSource {
25
+ export function createImageSource(props: ImageSourceProps): ImageSource<ImageSourceProps> {
26
26
  const {type = 'auto'} = props;
27
27
  const serviceType = type === 'auto' ? guessServiceType(props.url) : type;
28
28
  switch (serviceType) {
@@ -73,6 +73,9 @@ export type WMSLayer = {
73
73
  // FeatureListURL
74
74
  // DataURL
75
75
 
76
+ /** any extra dimension such as time */
77
+ dimensions?: WMSDimension[];
78
+
76
79
  /** Whether queries can be performed on the layer */
77
80
  queryable?: boolean;
78
81
  /** `false` if layer has significant no-data areas that the client can display as transparent. */
@@ -105,6 +108,30 @@ export type WMSBoundingBox = {
105
108
  yResolution?: number;
106
109
  };
107
110
 
111
+ /**
112
+ * An optional dimension that can be queried using the `name=...` parameter
113
+ * Note that layers that have at least one dimension without `default` value
114
+ * become unrenderable unless the dimension value is supplied to GetMap requests.
115
+ */
116
+ export type WMSDimension = {
117
+ /** name of dimension, becomes a valid parameter key for this layer */
118
+ name: string;
119
+ /** Textual units for this dimensional axis */
120
+ units: string;
121
+ /** Unit symbol for this dimensional axis */
122
+ unitSymbol?: string;
123
+ /** Default value if no value is supplied. If dimension lacks defaultValue, requests fail if no value is supplied */
124
+ defaultValue?: string;
125
+ /** Can multiple values of the dimension be requested? */
126
+ multipleValues?: boolean;
127
+ /* Will nearest values will be substituted when out of range, if false exact values are required */
128
+ nearestValue?: boolean;
129
+ /** A special value "current" is supported, typically for time dimension */
130
+ current?: boolean;
131
+ /** Text content indicating available values for dimension */
132
+ extent: string;
133
+ };
134
+
108
135
  /** Metadata about a supported WMS request */
109
136
  export type WMSRequest = {
110
137
  /** MIMEtypes that can be returned by this request. */
@@ -258,6 +285,13 @@ function extractLayer(xmlLayer: any): WMSLayer {
258
285
  layer.boundingBoxes = boundingBoxes;
259
286
  }
260
287
 
288
+ // Extract dimensions
289
+ const xmlDimensions = getXMLArray(xmlLayer?.Dimension);
290
+ const dimensions = xmlDimensions.map((xml) => extractDimension(xml));
291
+ if (dimensions.length) {
292
+ layer.dimensions = dimensions;
293
+ }
294
+
261
295
  if (xmlLayer?.opaque) {
262
296
  layer.opaque = getXMLBoolean(xmlLayer?.opaque);
263
297
  }
@@ -339,7 +373,38 @@ function extractWMSBoundingBox(xmlBoundingBox: any): WMSBoundingBox {
339
373
  return boundingBox;
340
374
  }
341
375
 
376
+ /**
377
+ * Extracts optional WMS Dimension layer field
378
+ * @param xmlDimension
379
+ * @example <Dimension name="time" units="ISO8601" default="2018-01-01" nearestValue="0">2001-01-01/2018-01-01/P1Y</Dimension>
380
+ * @see https://mapserver.org/ogc/wms_dimension.html
381
+ */
382
+ function extractDimension(xmlDimension: any): WMSDimension {
383
+ const {name, units, value: extent} = xmlDimension;
384
+
385
+ const dimension: WMSDimension = {name, units, extent};
386
+
387
+ if (xmlDimension.unitSymbol) {
388
+ dimension.unitSymbol = xmlDimension.unitSymbol;
389
+ }
390
+ if (xmlDimension.default) {
391
+ dimension.defaultValue = xmlDimension.default;
392
+ }
393
+ if (xmlDimension.multipleValues) {
394
+ dimension.multipleValues = getXMLBoolean(xmlDimension.multipleValues);
395
+ }
396
+ if (xmlDimension.nearestValue) {
397
+ dimension.nearestValue = getXMLBoolean(xmlDimension.nearestValue);
398
+ }
399
+ if (xmlDimension.current) {
400
+ dimension.current = getXMLBoolean(xmlDimension.current);
401
+ }
402
+
403
+ return dimension;
404
+ }
405
+
342
406
  /** Traverse layers and inject missing props from parents */
407
+ // eslint-disable-next-line complexity
343
408
  function addInheritedLayerProps(layer: WMSLayer, parent: WMSLayer | null): void {
344
409
  if (parent && parent.geographicBoundingBox && !layer.geographicBoundingBox) {
345
410
  layer.geographicBoundingBox = [...parent.geographicBoundingBox];
@@ -14,15 +14,12 @@ export type ArcGISImageServerProps = ImageSourceProps & {
14
14
  * Note - exports a big API, that could be exposed here if there is a use case
15
15
  * @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm
16
16
  */
17
- export class ArcGISImageServer extends ImageSource {
17
+ export class ArcGISImageServer extends ImageSource<ArcGISImageServerProps> {
18
18
  static type: 'arcgis-image-server' = 'arcgis-image-server';
19
19
  static testURL = (url: string): boolean => url.toLowerCase().includes('ImageServer');
20
20
 
21
- props: ArcGISImageServerProps;
22
-
23
21
  constructor(props: ArcGISImageServerProps) {
24
22
  super(props);
25
- this.props = props;
26
23
  }
27
24
 
28
25
  // ImageSource (normalized endpoints)
@@ -20,15 +20,12 @@ 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 extends ImageSource {
23
+ export class ImageService<PropsT extends ImageServiceProps> extends ImageSource<PropsT> {
24
24
  static type: 'template' = 'template';
25
25
  static testURL = (url: string): boolean => url.toLowerCase().includes('{');
26
26
 
27
- props: ImageServiceProps;
28
-
29
- constructor(props: ImageServiceProps) {
27
+ constructor(props: PropsT) {
30
28
  super(props);
31
- this.props = props;
32
29
  }
33
30
 
34
31
  // IMAGE SOURCE API
@@ -54,11 +54,10 @@ export type CSWServiceProps = DataSourceProps & {
54
54
  * - implements the ImageService interface
55
55
  * @note Only the URL parameter conversion is supported. XML posts are not supported.
56
56
  */
57
- export class CSWService extends DataSource {
57
+ export class CSWService extends DataSource<CSWServiceProps> {
58
58
  static type: 'csw' = 'csw';
59
59
  static testURL = (url: string): boolean => url.toLowerCase().includes('csw');
60
60
 
61
- props: CSWServiceProps;
62
61
  capabilities: CSWCapabilities | null = null;
63
62
 
64
63
  /** A list of loaders used by the CSWService methods */
@@ -67,7 +66,6 @@ export class CSWService extends DataSource {
67
66
  /** Create a CSWService */
68
67
  constructor(props: CSWServiceProps) {
69
68
  super(props);
70
- this.props = props;
71
69
  }
72
70
 
73
71
  async getMetadata(): Promise<CSWCapabilities> {
@@ -1,7 +1,6 @@
1
1
  // loaders.gl, MIT license
2
2
 
3
3
  /* eslint-disable camelcase */
4
-
5
4
  import type {ImageType} from '@loaders.gl/images';
6
5
  import {ImageLoader} from '@loaders.gl/images';
7
6
  import {mergeLoaderOptions} from '@loaders.gl/loader-utils';
@@ -21,68 +20,87 @@ import {WMSLayerDescriptionLoader} from '../../../wip/wms-layer-description-load
21
20
  import type {WMSLoaderOptions} from '../../../wms-error-loader';
22
21
  import {WMSErrorLoader} from '../../../wms-error-loader';
23
22
 
24
- /** Static WMS parameters (not viewport or selected pixel dependent) that can be provided as defaults */
23
+ /**
24
+ * "Static" WMS parameters (not viewport or selected pixel dependent)
25
+ * These can be provided as defaults in the WMSService constructor
26
+ */
25
27
  export type WMSParameters = {
26
- /** WMS version */
28
+ /** WMS version (all requests) */
27
29
  version?: '1.3.0' | '1.1.1';
28
- /** Layers to render */
30
+ /** Layers to render (GetMap, GetFeatureInfo) */
29
31
  layers?: string[];
32
+ /** list of layers to query.. (GetFeatureInfo) */
33
+ query_layers?: string[];
34
+
30
35
  /** Coordinate Reference System (CRS) for the image (not the bounding box) */
31
36
  crs?: string;
32
- /** Requested format for the return image */
37
+ /** Requested format for the return image (GetMap, GetLegendGraphic) */
33
38
  format?: 'image/png';
34
- /** Requested MIME type of returned feature info */
39
+ /** Requested MIME type of returned feature info (GetFeatureInfo) */
35
40
  info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';
36
41
  /** Styling - Not yet supported */
37
42
  styles?: unknown;
38
- /** Any additional parameters specific to this WMSService */
43
+ /** Any additional parameters specific to this WMSService (GetMap) */
39
44
  transparent?: boolean;
40
45
  };
41
46
 
42
- type WMSCommonParameters = {
47
+ /** Parameters for GetCapabilities */
48
+ export type WMSGetCapabilitiesParameters = {
43
49
  /** In case the endpoint supports multiple WMS versions */
44
50
  version?: '1.3.0' | '1.1.1';
45
51
  };
46
52
 
47
- /** Parameters for GetCapabilities */
48
- export type WMSGetCapabilitiesParameters = WMSCommonParameters;
49
-
50
53
  /** Parameters for GetMap */
51
- export type WMSGetMapParameters = WMSCommonParameters & {
52
- /** Layers to render */
53
- layers: string | string[];
54
+ export type WMSGetMapParameters = {
55
+ /** In case the endpoint supports multiple WMS versions */
56
+ version?: '1.3.0' | '1.1.1';
54
57
  /** bounding box of the requested map image */
55
58
  bbox: [number, number, number, number];
56
59
  /** pixel width of returned image */
57
60
  width: number;
58
61
  /** pixels */
59
62
  height: number;
60
- /** Coordinate Reference System for the image (not the bounding box). */
63
+ /** Layers to render - can be provided in service constructor */
64
+ layers?: string | string[];
65
+ /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */
61
66
  crs?: string;
62
- /** Styling */
67
+ /** Styling. can be provided in service constructor */
63
68
  styles?: unknown;
64
- /** Don't render background when no data */
69
+ /** Don't render background when no data. can be provided in service constructor */
65
70
  transparent?: boolean;
66
- /** requested format for the return image */
71
+ /** requested format for the return image. can be provided in service constructor */
67
72
  format?: 'image/png';
68
73
  };
69
74
 
75
+ /** GetMap parameters that are specific to the current view */
76
+ export type WMSGetMapViewParameters = {
77
+ /** pixel width of returned image */
78
+ width: number;
79
+ /** pixels */
80
+ height: number;
81
+ /** bounding box of the requested map image */
82
+ bbox: [number, number, number, number];
83
+ /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */
84
+ crs?: string;
85
+ };
86
+
70
87
  /**
71
88
  * Parameters for GetFeatureInfo
72
89
  * @see https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&
73
90
  */
74
- export type WMSGetFeatureInfoParameters = WMSCommonParameters & {
91
+ export type WMSGetFeatureInfoParameters = {
92
+ /** In case the endpoint supports multiple WMS versions */
93
+ version?: '1.3.0' | '1.1.1';
75
94
  /** x coordinate for the feature info request */
76
95
  x: number;
77
96
  /** y coordinate for the feature info request */
78
97
  y: number;
79
- /** list of layers to query (could be different from rendered layers) */
80
- query_layers: string[];
81
- /** Requested MIME type of returned feature info */
98
+ /** MIME type of returned feature info. Can be specified in service constructor */
82
99
  info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';
83
-
84
- /** Layers to render */
85
- layers: string[];
100
+ /** list of layers to query. Required but can be specified in service constructor. */
101
+ query_layers?: string[];
102
+ /** Layers to render. Required, but can be specified in service constructor */
103
+ layers?: string[];
86
104
  /** Styling */
87
105
  styles?: unknown;
88
106
  /** bounding box of the requested map image */
@@ -92,16 +110,36 @@ export type WMSGetFeatureInfoParameters = WMSCommonParameters & {
92
110
  /** pixels */
93
111
  height: number;
94
112
  /** srs for the image (not the bounding box) */
95
- srs?: string;
96
- /** requested format for the return image */
97
- format?: 'image/png';
113
+ crs?: string;
114
+ };
115
+
116
+ /** GetMap parameters that are specific to the current view */
117
+ export type WMSGetFeatureInfoViewParameters = {
118
+ /** x coordinate for the feature info request */
119
+ x: number;
120
+ /** y coordinate for the feature info request */
121
+ y: number;
122
+ /** pixel width of returned image */
123
+ width: number;
124
+ /** pixels */
125
+ height: number;
126
+ /** bounding box of the requested map image */
127
+ bbox: [number, number, number, number];
128
+ /** srs for the image (not the bounding box) */
129
+ crs?: string;
98
130
  };
99
131
 
100
132
  /** Parameters for DescribeLayer */
101
- export type WMSDescribeLayerParameters = WMSCommonParameters;
133
+ export type WMSDescribeLayerParameters = {
134
+ /** In case the endpoint supports multiple WMS versions */
135
+ version?: '1.3.0' | '1.1.1';
136
+ };
102
137
 
103
138
  /** Parameters for GetLegendGraphic */
104
- export type WMSGetLegendGraphicParameters = WMSCommonParameters;
139
+ export type WMSGetLegendGraphicParameters = {
140
+ /** In case the endpoint supports multiple WMS versions */
141
+ version?: '1.3.0' | '1.1.1';
142
+ };
105
143
 
106
144
  //
107
145
 
@@ -109,6 +147,9 @@ export type WMSGetLegendGraphicParameters = WMSCommonParameters;
109
147
  export type WMSServiceProps = ImageSourceProps & {
110
148
  /** Base URL to the service */
111
149
  url: string;
150
+ /** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */
151
+ substituteCRS84?: boolean;
152
+
112
153
  /** Default WMS parameters. If not provided here, must be provided in the various request */
113
154
  wmsParameters?: WMSParameters;
114
155
  /** Any additional service specific parameters */
@@ -122,11 +163,18 @@ export type WMSServiceProps = ImageSourceProps & {
122
163
  * - implements the ImageService interface
123
164
  * @note Only the URL parameter conversion is supported. XML posts are not supported.
124
165
  */
125
- export class WMSService extends ImageSource {
166
+ export class WMSService extends ImageSource<WMSServiceProps> {
126
167
  static type: 'wms' = 'wms';
127
168
  static testURL = (url: string): boolean => url.toLowerCase().includes('wms');
128
169
 
170
+ /** Base URL to the service */
129
171
  readonly url: string;
172
+
173
+ /** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */
174
+ substituteCRS84: boolean;
175
+ /** In WMS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */
176
+ flipCRS: string[];
177
+
130
178
  /** Default static WMS parameters */
131
179
  wmsParameters: Required<WMSParameters>;
132
180
  /** Default static vendor parameters */
@@ -153,8 +201,12 @@ export class WMSService extends ImageSource {
153
201
 
154
202
  this.url = props.url;
155
203
 
204
+ this.substituteCRS84 = props.substituteCRS84 ?? false;
205
+ this.flipCRS = ['EPSG:4326'];
206
+
156
207
  this.wmsParameters = {
157
208
  layers: undefined!,
209
+ query_layers: undefined!,
158
210
  styles: undefined,
159
211
  version: '1.3.0',
160
212
  crs: 'EPSG:4326',
@@ -174,10 +226,7 @@ export class WMSService extends ImageSource {
174
226
  }
175
227
 
176
228
  async getImage(parameters: GetImageParameters): Promise<ImageType> {
177
- // WMS 1.3.0 renamed SRS to CRS (sigh...)
178
- const wmsParameters = {...parameters, crs: parameters.srs};
179
- delete wmsParameters.srs;
180
- return await this.getMap(wmsParameters);
229
+ return await this.getMap(parameters);
181
230
  }
182
231
 
183
232
  normalizeMetadata(capabilities: WMSCapabilities): ImageSourceMetadata {
@@ -288,16 +337,17 @@ export class WMSService extends ImageSource {
288
337
  wmsParameters: WMSGetMapParameters,
289
338
  vendorParameters?: Record<string, unknown>
290
339
  ): string {
340
+ wmsParameters = this._getWMS130Parameters(wmsParameters);
291
341
  const options: Required<WMSGetMapParameters> = {
292
342
  version: this.wmsParameters.version,
293
- // layers: [],
343
+ format: this.wmsParameters.format,
344
+ transparent: this.wmsParameters.transparent,
345
+ layers: this.wmsParameters.layers,
346
+ styles: this.wmsParameters.styles,
347
+ crs: this.wmsParameters.crs,
294
348
  // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
295
349
  // width: 1200,
296
350
  // height: 900,
297
- styles: this.wmsParameters.styles,
298
- crs: this.wmsParameters.crs,
299
- format: this.wmsParameters.format,
300
- transparent: this.wmsParameters.transparent,
301
351
  ...wmsParameters
302
352
  };
303
353
  return this._getWMSUrl('GetMap', options, vendorParameters);
@@ -310,17 +360,18 @@ export class WMSService extends ImageSource {
310
360
  ): string {
311
361
  const options: Required<WMSGetFeatureInfoParameters> = {
312
362
  version: this.wmsParameters.version,
313
- // layers: this.props.layers,
363
+ // query_layers: [],
364
+ // format: this.wmsParameters.format,
365
+ info_format: this.wmsParameters.info_format,
366
+ layers: this.wmsParameters.layers,
367
+ query_layers: this.wmsParameters.query_layers,
368
+ styles: this.wmsParameters.styles,
369
+ crs: this.wmsParameters.crs,
314
370
  // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
315
371
  // width: 1200,
316
372
  // height: 900,
317
373
  // x: undefined!,
318
374
  // y: undefined!,
319
- // query_layers: [],
320
- srs: this.wmsParameters.crs,
321
- format: this.wmsParameters.format,
322
- info_format: this.wmsParameters.info_format,
323
- styles: this.wmsParameters.styles,
324
375
  ...wmsParameters
325
376
  };
326
377
  return this._getWMSUrl('GetFeatureInfo', options, vendorParameters);
@@ -372,7 +423,7 @@ export class WMSService extends ImageSource {
372
423
  * */
373
424
  protected _getWMSUrl(
374
425
  request: string,
375
- wmsParameters: WMSCommonParameters & {[key: string]: unknown},
426
+ wmsParameters: {version?: '1.3.0' | '1.1.1'; [key: string]: unknown},
376
427
  vendorParameters?: Record<string, unknown>
377
428
  ): string {
378
429
  let url = this.url;
@@ -394,34 +445,88 @@ export class WMSService extends ImageSource {
394
445
  if (key !== 'transparent' || value) {
395
446
  url += first ? '?' : '&';
396
447
  first = false;
397
- url += this._getParameterValue(wmsParameters.version!, key, value);
448
+ url += this._getURLParameter(key, value, wmsParameters);
398
449
  }
399
450
  }
400
451
 
401
452
  return encodeURI(url);
402
453
  }
403
454
 
404
- _getParameterValue(version: string, key: string, value: unknown): string {
405
- // SRS parameter changed to CRS in 1.3.0, in non-backwards compatible way (sigh...)
406
- if (key === 'crs' && version !== '1.3.0') {
407
- key = 'srs';
455
+ _getWMS130Parameters<ParametersT extends {crs?: string; srs?: string}>(
456
+ wmsParameters: ParametersT
457
+ ): ParametersT {
458
+ const newParameters = {...wmsParameters};
459
+ if (newParameters.srs) {
460
+ newParameters.crs = newParameters.crs || newParameters.srs;
461
+ delete newParameters.srs;
408
462
  }
463
+ return newParameters;
464
+ }
409
465
 
410
- key = key.toUpperCase();
466
+ // eslint-disable-complexity
467
+ _getURLParameter(key: string, value: unknown, wmsParameters: WMSParameters): string {
468
+ // Substitute by key
469
+ switch (key) {
470
+ case 'crs':
471
+ // CRS was called SRS before WMS 1.3.0
472
+ if (wmsParameters.version !== '1.3.0') {
473
+ key = 'srs';
474
+ } else if (this.substituteCRS84 && value === 'EPSG:4326') {
475
+ /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */
476
+ // Substitute by value
477
+ value = 'CRS:84';
478
+ }
479
+ break;
480
+
481
+ case 'srs':
482
+ // CRS was called SRS before WMS 1.3.0
483
+ if (wmsParameters.version === '1.3.0') {
484
+ key = 'crs';
485
+ }
486
+ break;
487
+
488
+ case 'bbox':
489
+ // Coordinate order is flipped for certain CRS in WMS 1.3.0
490
+ const bbox = this._flipBoundingBox(value, wmsParameters);
491
+ if (bbox) {
492
+ value = bbox;
493
+ }
494
+ break;
495
+
496
+ default:
497
+ // do nothing
498
+ }
411
499
 
412
- // TODO - in v1.3.0 only, the order of parameters for BBOX depends on whether the CRS definition has flipped axes
413
- // You will see this in the GetCapabilities request at 1.3.0 - the response should show the flipped axes.
414
- // BBOX=xmin,ymin,xmax,ymax NON-FLIPPED
415
- // BBOX=ymin,xmin,ymax,xmax FLIPPED
416
- // / EPSG:4326 needs to have flipped axes. 4326 1 WGS 84 Latitude North Longitude East
417
- // In WMS 1.1.1 EPSG:4326 is wrongly defined as having long/lat coordinate axes. In WMS 1.3.0 the correct axes lat/long are used. CRS:84 is defined by OGC as having the same datum as EPSG:4326 (that is the World Geodetic System 1984 datum ~ EPSG::6326) but axis order of long/lat.
418
- // CRS:84 was introduced with the publication of the WMS 1.3.0 specification, to overcome this issue.
500
+ key = key.toUpperCase();
419
501
 
420
502
  return Array.isArray(value)
421
503
  ? `${key}=${value.join(',')}`
422
504
  : `${key}=${value ? String(value) : ''}`;
423
505
  }
424
506
 
507
+ /** Coordinate order is flipped for certain CRS in WMS 1.3.0 */
508
+ _flipBoundingBox(
509
+ bboxValue: unknown,
510
+ wmsParameters: WMSParameters
511
+ ): [number, number, number, number] | null {
512
+ // Sanity checks
513
+ if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {
514
+ return null;
515
+ }
516
+
517
+ const flipCoordinates =
518
+ // Only affects WMS 1.3.0
519
+ wmsParameters.version === '1.3.0' &&
520
+ // Flip if we are dealing with a CRS that was flipped in 1.3.0
521
+ this.flipCRS.includes(wmsParameters.crs || '') &&
522
+ // Don't flip if we are subsituting EPSG:4326 with CRS:84
523
+ !(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');
524
+
525
+ const bbox = bboxValue as [number, number, number, number];
526
+ return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;
527
+ }
528
+
529
+ /** Fetches an array buffer and checks the response (boilerplate reduction) */
425
530
  protected async _fetchArrayBuffer(url: string): Promise<ArrayBuffer> {
426
531
  const response = await this.fetch(url);
427
532
  const arrayBuffer = await response.arrayBuffer();