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

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 (184) hide show
  1. package/dist/dist.min.js +359 -174
  2. package/dist/es5/csw-capabilities-loader.js +7 -11
  3. package/dist/es5/csw-capabilities-loader.js.map +1 -1
  4. package/dist/es5/csw-domain-loader.js +7 -10
  5. package/dist/es5/csw-domain-loader.js.map +1 -1
  6. package/dist/es5/csw-records-loader.js +7 -10
  7. package/dist/es5/csw-records-loader.js.map +1 -1
  8. package/dist/es5/gml-loader.js +7 -10
  9. package/dist/es5/gml-loader.js.map +1 -1
  10. package/dist/es5/index.js +0 -7
  11. package/dist/es5/index.js.map +1 -1
  12. package/dist/es5/lerc-loader.js +17 -22
  13. package/dist/es5/lerc-loader.js.map +1 -1
  14. package/dist/es5/lib/create-image-source.js +1 -2
  15. package/dist/es5/lib/create-image-source.js.map +1 -1
  16. package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
  17. package/dist/es5/lib/parsers/csw/parse-csw-domain.js +1 -1
  18. package/dist/es5/lib/parsers/csw/parse-csw-domain.js.map +1 -1
  19. package/dist/es5/lib/parsers/csw/parse-csw-records.js +1 -2
  20. package/dist/es5/lib/parsers/csw/parse-csw-records.js.map +1 -1
  21. package/dist/es5/lib/parsers/csw/parse-exception-report.js +0 -2
  22. package/dist/es5/lib/parsers/csw/parse-exception-report.js.map +1 -1
  23. package/dist/es5/lib/parsers/gml/deep-strict-equal.js +0 -8
  24. package/dist/es5/lib/parsers/gml/deep-strict-equal.js.map +1 -1
  25. package/dist/es5/lib/parsers/gml/parse-gml.js +1 -13
  26. package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
  27. package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js +197 -54
  28. package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
  29. package/dist/es5/lib/parsers/wms/parse-wms-error.js +0 -1
  30. package/dist/es5/lib/parsers/wms/parse-wms-error.js.map +1 -1
  31. package/dist/es5/lib/parsers/wms/parse-wms-features.js +0 -1
  32. package/dist/es5/lib/parsers/wms/parse-wms-features.js.map +1 -1
  33. package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js +0 -1
  34. package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
  35. package/dist/es5/lib/parsers/xml/parse-xml-helpers.js +67 -0
  36. package/dist/es5/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
  37. package/dist/es5/lib/services/arcgis/arcgis-image-service.js +35 -54
  38. package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +1 -1
  39. package/dist/es5/lib/services/arcgis/arcgis-server.js +50 -54
  40. package/dist/es5/lib/services/arcgis/arcgis-server.js.map +1 -1
  41. package/dist/es5/lib/services/generic/image-service.js +27 -36
  42. package/dist/es5/lib/services/generic/image-service.js.map +1 -1
  43. package/dist/es5/lib/services/ogc/csw-service.js +161 -186
  44. package/dist/es5/lib/services/ogc/csw-service.js.map +1 -1
  45. package/dist/es5/lib/services/ogc/wms-service.js +283 -245
  46. package/dist/es5/lib/services/ogc/wms-service.js.map +1 -1
  47. package/dist/es5/lib/sources/data-source.js +1 -6
  48. package/dist/es5/lib/sources/data-source.js.map +1 -1
  49. package/dist/es5/lib/sources/image-source.js.map +1 -1
  50. package/dist/es5/lib/sources/tile-source.js.map +1 -1
  51. package/dist/es5/lib/sources/utils/utils.js +0 -4
  52. package/dist/es5/lib/sources/utils/utils.js.map +1 -1
  53. package/dist/es5/wip/arcgis-feature-service.js +2 -7
  54. package/dist/es5/wip/arcgis-feature-service.js.map +1 -1
  55. package/dist/es5/wip/data-source.js +0 -2
  56. package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
  57. package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
  58. package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
  59. package/dist/es5/wip/wcs-capabilities-loader.js +7 -10
  60. package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -1
  61. package/dist/es5/wip/wfs-capabilities-loader.js +7 -10
  62. package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -1
  63. package/dist/es5/wip/wms-feature-info-loader.js +6 -8
  64. package/dist/es5/wip/wms-feature-info-loader.js.map +1 -1
  65. package/dist/es5/wip/wms-layer-description-loader.js +6 -8
  66. package/dist/es5/wip/wms-layer-description-loader.js.map +1 -1
  67. package/dist/es5/wip/wmts-capabilities-loader.js +7 -16
  68. package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
  69. package/dist/es5/wms-capabilities-loader.js +8 -12
  70. package/dist/es5/wms-capabilities-loader.js.map +1 -1
  71. package/dist/es5/wms-error-loader.js +7 -9
  72. package/dist/es5/wms-error-loader.js.map +1 -1
  73. package/dist/esm/bundle.js +0 -2
  74. package/dist/esm/bundle.js.map +1 -1
  75. package/dist/esm/csw-capabilities-loader.js +1 -5
  76. package/dist/esm/csw-capabilities-loader.js.map +1 -1
  77. package/dist/esm/csw-domain-loader.js +1 -4
  78. package/dist/esm/csw-domain-loader.js.map +1 -1
  79. package/dist/esm/csw-records-loader.js +1 -4
  80. package/dist/esm/csw-records-loader.js.map +1 -1
  81. package/dist/esm/gml-loader.js +1 -4
  82. package/dist/esm/gml-loader.js.map +1 -1
  83. package/dist/esm/index.js +0 -11
  84. package/dist/esm/index.js.map +1 -1
  85. package/dist/esm/lerc-loader.js +1 -4
  86. package/dist/esm/lerc-loader.js.map +1 -1
  87. package/dist/esm/lib/create-image-source.js +0 -3
  88. package/dist/esm/lib/create-image-source.js.map +1 -1
  89. package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js +0 -3
  90. package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
  91. package/dist/esm/lib/parsers/csw/parse-csw-domain.js +0 -3
  92. package/dist/esm/lib/parsers/csw/parse-csw-domain.js.map +1 -1
  93. package/dist/esm/lib/parsers/csw/parse-csw-records.js +0 -3
  94. package/dist/esm/lib/parsers/csw/parse-csw-records.js.map +1 -1
  95. package/dist/esm/lib/parsers/csw/parse-exception-report.js +0 -3
  96. package/dist/esm/lib/parsers/csw/parse-exception-report.js.map +1 -1
  97. package/dist/esm/lib/parsers/gml/deep-strict-equal.js +0 -9
  98. package/dist/esm/lib/parsers/gml/deep-strict-equal.js.map +1 -1
  99. package/dist/esm/lib/parsers/gml/parse-gml.js +0 -14
  100. package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
  101. package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js +151 -42
  102. package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
  103. package/dist/esm/lib/parsers/wms/parse-wms-error.js +0 -3
  104. package/dist/esm/lib/parsers/wms/parse-wms-error.js.map +1 -1
  105. package/dist/esm/lib/parsers/wms/parse-wms-features.js +0 -3
  106. package/dist/esm/lib/parsers/wms/parse-wms-features.js.map +1 -1
  107. package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js +0 -3
  108. package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
  109. package/dist/esm/lib/parsers/xml/parse-xml-helpers.js +53 -0
  110. package/dist/esm/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
  111. package/dist/esm/lib/services/arcgis/arcgis-image-service.js +0 -9
  112. package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +1 -1
  113. package/dist/esm/lib/services/arcgis/arcgis-server.js +0 -2
  114. package/dist/esm/lib/services/arcgis/arcgis-server.js.map +1 -1
  115. package/dist/esm/lib/services/generic/image-service.js +0 -5
  116. package/dist/esm/lib/services/generic/image-service.js.map +1 -1
  117. package/dist/esm/lib/services/ogc/csw-service.js +0 -11
  118. package/dist/esm/lib/services/ogc/csw-service.js.map +1 -1
  119. package/dist/esm/lib/services/ogc/wms-service.js +96 -87
  120. package/dist/esm/lib/services/ogc/wms-service.js.map +1 -1
  121. package/dist/esm/lib/sources/data-source.js +0 -6
  122. package/dist/esm/lib/sources/data-source.js.map +1 -1
  123. package/dist/esm/lib/sources/image-source.js +0 -3
  124. package/dist/esm/lib/sources/image-source.js.map +1 -1
  125. package/dist/esm/lib/sources/tile-source.js +0 -3
  126. package/dist/esm/lib/sources/tile-source.js.map +1 -1
  127. package/dist/esm/lib/sources/utils/utils.js +0 -5
  128. package/dist/esm/lib/sources/utils/utils.js.map +1 -1
  129. package/dist/esm/wip/arcgis-feature-service.js +0 -3
  130. package/dist/esm/wip/arcgis-feature-service.js.map +1 -1
  131. package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js +0 -3
  132. package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
  133. package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js +0 -3
  134. package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
  135. package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js +0 -3
  136. package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
  137. package/dist/esm/wip/wcs-capabilities-loader.js +1 -4
  138. package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -1
  139. package/dist/esm/wip/wfs-capabilities-loader.js +1 -4
  140. package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -1
  141. package/dist/esm/wip/wms-feature-info-loader.js +0 -2
  142. package/dist/esm/wip/wms-feature-info-loader.js.map +1 -1
  143. package/dist/esm/wip/wms-layer-description-loader.js +0 -2
  144. package/dist/esm/wip/wms-layer-description-loader.js.map +1 -1
  145. package/dist/esm/wip/wmts-capabilities-loader.js +1 -6
  146. package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -1
  147. package/dist/esm/wms-capabilities-loader.js +3 -7
  148. package/dist/esm/wms-capabilities-loader.js.map +1 -1
  149. package/dist/esm/wms-error-loader.js +1 -4
  150. package/dist/esm/wms-error-loader.js.map +1 -1
  151. package/dist/index.d.ts +0 -3
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +3 -5
  154. package/dist/lib/parsers/wms/parse-wms-capabilities.d.ts +78 -62
  155. package/dist/lib/parsers/wms/parse-wms-capabilities.d.ts.map +1 -1
  156. package/dist/lib/parsers/wms/parse-wms-capabilities.js +165 -1935
  157. package/dist/lib/parsers/xml/parse-xml-helpers.d.ts +11 -0
  158. package/dist/lib/parsers/xml/parse-xml-helpers.d.ts.map +1 -0
  159. package/dist/lib/parsers/xml/parse-xml-helpers.js +68 -0
  160. package/dist/lib/services/arcgis/arcgis-image-service.js +1 -1
  161. package/dist/lib/services/generic/image-service.js +1 -1
  162. package/dist/lib/services/ogc/csw-service.d.ts +1 -1
  163. package/dist/lib/services/ogc/csw-service.d.ts.map +1 -1
  164. package/dist/lib/services/ogc/csw-service.js +1 -1
  165. package/dist/lib/services/ogc/wms-service.d.ts +63 -58
  166. package/dist/lib/services/ogc/wms-service.d.ts.map +1 -1
  167. package/dist/lib/services/ogc/wms-service.js +106 -71
  168. package/dist/lib/sources/image-source.d.ts +3 -9
  169. package/dist/lib/sources/image-source.d.ts.map +1 -1
  170. package/dist/wip/wmts-capabilities-loader.d.ts +3 -4
  171. package/dist/wip/wmts-capabilities-loader.d.ts.map +1 -1
  172. package/dist/wip/wmts-capabilities-loader.js +1 -0
  173. package/dist/wms-capabilities-loader.d.ts +6 -1
  174. package/dist/wms-capabilities-loader.d.ts.map +1 -1
  175. package/dist/wms-capabilities-loader.js +2 -2
  176. package/package.json +6 -6
  177. package/src/index.ts +3 -4
  178. package/src/lib/parsers/wms/parse-wms-capabilities.ts +293 -2004
  179. package/src/lib/parsers/xml/parse-xml-helpers.ts +65 -0
  180. package/src/lib/services/ogc/csw-service.ts +1 -1
  181. package/src/lib/services/ogc/wms-service.ts +169 -109
  182. package/src/lib/sources/image-source.ts +3 -9
  183. package/src/wip/wmts-capabilities-loader.ts +2 -2
  184. package/src/wms-capabilities-loader.ts +9 -3
package/dist/dist.min.js CHANGED
@@ -430,7 +430,10 @@
430
430
  ignoreDeclaration: false,
431
431
  ignorePiTags: false,
432
432
  transformTagName: false,
433
- transformAttributeName: false
433
+ transformAttributeName: false,
434
+ updateTag: function(tagName, jPath, attrs) {
435
+ return tagName;
436
+ }
434
437
  };
435
438
  var buildOptions = function(options) {
436
439
  return Object.assign({}, defaultOptions, options);
@@ -708,6 +711,7 @@
708
711
  this.replaceEntitiesValue = replaceEntitiesValue;
709
712
  this.readStopNodeData = readStopNodeData;
710
713
  this.saveTextToParentTag = saveTextToParentTag;
714
+ this.addChild = addChild;
711
715
  }
712
716
  };
713
717
  function addExternalEntities(externalEntities) {
@@ -760,7 +764,7 @@
760
764
  return tagname;
761
765
  }
762
766
  var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
763
- function buildAttributesMap(attrStr, jPath) {
767
+ function buildAttributesMap(attrStr, jPath, tagName) {
764
768
  if (!this.options.ignoreAttributes && typeof attrStr === "string") {
765
769
  const matches2 = util.getAllMatches(attrStr, attrsRegx);
766
770
  const len = matches2.length;
@@ -828,7 +832,18 @@
828
832
  if (currentNode) {
829
833
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
830
834
  }
831
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
835
+ const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
836
+ if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
837
+ throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
838
+ }
839
+ let propIndex = 0;
840
+ if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
841
+ propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
842
+ this.tagsNodeStack.pop();
843
+ } else {
844
+ propIndex = jPath.lastIndexOf(".");
845
+ }
846
+ jPath = jPath.substring(0, propIndex);
832
847
  currentNode = this.tagsNodeStack.pop();
833
848
  textData = "";
834
849
  i = closeIndex;
@@ -842,9 +857,9 @@
842
857
  const childNode = new xmlNode(tagData.tagName);
843
858
  childNode.add(this.options.textNodeName, "");
844
859
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
845
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath);
860
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
846
861
  }
847
- currentNode.addChild(childNode);
862
+ this.addChild(currentNode, childNode, jPath);
848
863
  }
849
864
  i = tagData.closeIndex + 1;
850
865
  } else if (xmlData.substr(i + 1, 3) === "!--") {
@@ -886,12 +901,13 @@
886
901
  textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
887
902
  }
888
903
  }
889
- if (tagName !== xmlObj.tagname) {
890
- jPath += jPath ? "." + tagName : tagName;
891
- }
892
904
  const lastTag = currentNode;
893
905
  if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
894
906
  currentNode = this.tagsNodeStack.pop();
907
+ jPath = jPath.substring(0, jPath.lastIndexOf("."));
908
+ }
909
+ if (tagName !== xmlObj.tagname) {
910
+ jPath += jPath ? "." + tagName : tagName;
895
911
  }
896
912
  if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
897
913
  let tagContent = "";
@@ -908,14 +924,14 @@
908
924
  }
909
925
  const childNode = new xmlNode(tagName);
910
926
  if (tagName !== tagExp && attrExpPresent) {
911
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
927
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
912
928
  }
913
929
  if (tagContent) {
914
930
  tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
915
931
  }
916
932
  jPath = jPath.substr(0, jPath.lastIndexOf("."));
917
933
  childNode.add(this.options.textNodeName, tagContent);
918
- currentNode.addChild(childNode);
934
+ this.addChild(currentNode, childNode, jPath);
919
935
  } else {
920
936
  if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
921
937
  if (tagName[tagName.length - 1] === "/") {
@@ -929,17 +945,17 @@
929
945
  }
930
946
  const childNode = new xmlNode(tagName);
931
947
  if (tagName !== tagExp && attrExpPresent) {
932
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
948
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
933
949
  }
950
+ this.addChild(currentNode, childNode, jPath);
934
951
  jPath = jPath.substr(0, jPath.lastIndexOf("."));
935
- currentNode.addChild(childNode);
936
952
  } else {
937
953
  const childNode = new xmlNode(tagName);
938
954
  this.tagsNodeStack.push(currentNode);
939
955
  if (tagName !== tagExp && attrExpPresent) {
940
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
956
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
941
957
  }
942
- currentNode.addChild(childNode);
958
+ this.addChild(currentNode, childNode, jPath);
943
959
  currentNode = childNode;
944
960
  }
945
961
  textData = "";
@@ -952,6 +968,16 @@
952
968
  }
953
969
  return xmlObj.child;
954
970
  };
971
+ function addChild(currentNode, childNode, jPath) {
972
+ const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
973
+ if (result === false) {
974
+ } else if (typeof result === "string") {
975
+ childNode.tagname = result;
976
+ currentNode.addChild(childNode);
977
+ } else {
978
+ currentNode.addChild(childNode);
979
+ }
980
+ }
955
981
  var replaceEntitiesValue = function(val2) {
956
982
  if (this.options.processEntities) {
957
983
  for (let entityName2 in this.docTypeEntities) {
@@ -1200,9 +1226,14 @@
1200
1226
  }
1201
1227
  }
1202
1228
  function isLeafTag(obj, options) {
1229
+ const { textNodeName } = options;
1203
1230
  const propCount = Object.keys(obj).length;
1204
- if (propCount === 0 || propCount === 1 && obj[options.textNodeName])
1231
+ if (propCount === 0) {
1205
1232
  return true;
1233
+ }
1234
+ if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) {
1235
+ return true;
1236
+ }
1206
1237
  return false;
1207
1238
  }
1208
1239
  exports.prettify = prettify;
@@ -1421,7 +1452,8 @@
1421
1452
  { regex: new RegExp('"', "g"), val: "&quot;" }
1422
1453
  ],
1423
1454
  processEntities: true,
1424
- stopNodes: []
1455
+ stopNodes: [],
1456
+ oneListGroup: false
1425
1457
  };
1426
1458
  function Builder(options) {
1427
1459
  this.options = Object.assign({}, defaultOptions, options);
@@ -1484,6 +1516,7 @@
1484
1516
  }
1485
1517
  } else if (Array.isArray(jObj[key])) {
1486
1518
  const arrLen = jObj[key].length;
1519
+ let listTagVal = "";
1487
1520
  for (let j = 0; j < arrLen; j++) {
1488
1521
  const item = jObj[key][j];
1489
1522
  if (typeof item === "undefined") {
@@ -1493,11 +1526,19 @@
1493
1526
  else
1494
1527
  val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
1495
1528
  } else if (typeof item === "object") {
1496
- val2 += this.processTextOrObjNode(item, key, level);
1529
+ if (this.options.oneListGroup) {
1530
+ listTagVal += this.j2x(item, level + 1).val;
1531
+ } else {
1532
+ listTagVal += this.processTextOrObjNode(item, key, level);
1533
+ }
1497
1534
  } else {
1498
- val2 += this.buildTextValNode(item, key, "", level);
1535
+ listTagVal += this.buildTextValNode(item, key, "", level);
1499
1536
  }
1500
1537
  }
1538
+ if (this.options.oneListGroup) {
1539
+ listTagVal = this.buildObjectNode(listTagVal, key, "", level);
1540
+ }
1541
+ val2 += listTagVal;
1501
1542
  } else {
1502
1543
  if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
1503
1544
  const Ks = Object.keys(jObj[key]);
@@ -2042,59 +2083,229 @@
2042
2083
  }
2043
2084
  });
2044
2085
 
2086
+ // src/lib/parsers/xml/parse-xml-helpers.ts
2087
+ function getXMLArray(xmlValue) {
2088
+ if (Array.isArray(xmlValue)) {
2089
+ return xmlValue;
2090
+ }
2091
+ if (xmlValue) {
2092
+ return [xmlValue];
2093
+ }
2094
+ return [];
2095
+ }
2096
+ function getXMLStringArray(xmlValue) {
2097
+ const xmlArray = getXMLArray(xmlValue);
2098
+ if (xmlArray.length > 0 && xmlArray.every((_) => typeof _ === "string")) {
2099
+ return xmlArray;
2100
+ }
2101
+ return [];
2102
+ }
2103
+ function getXMLFloat(xmlValue, defaultValue = void 0) {
2104
+ switch (typeof xmlValue) {
2105
+ case "number":
2106
+ return xmlValue;
2107
+ case "string":
2108
+ return parseFloat(xmlValue);
2109
+ default:
2110
+ return void 0;
2111
+ }
2112
+ }
2113
+ function getXMLInteger(xmlValue, defaultValue = void 0) {
2114
+ switch (typeof xmlValue) {
2115
+ case "number":
2116
+ return xmlValue;
2117
+ case "string":
2118
+ return parseInt(xmlValue, 10);
2119
+ default:
2120
+ return void 0;
2121
+ }
2122
+ }
2123
+ function getXMLBoolean(xmlValue) {
2124
+ switch (xmlValue) {
2125
+ case "true":
2126
+ return true;
2127
+ case "false":
2128
+ return false;
2129
+ case "1":
2130
+ return true;
2131
+ case "0":
2132
+ return false;
2133
+ default:
2134
+ return false;
2135
+ }
2136
+ }
2137
+ var init_parse_xml_helpers = __esm({
2138
+ "src/lib/parsers/xml/parse-xml-helpers.ts"() {
2139
+ }
2140
+ });
2141
+
2045
2142
  // src/lib/parsers/wms/parse-wms-capabilities.ts
2046
- function parseWMSCapabilities(text, options) {
2047
- const parsedXML = XMLLoader.parseTextSync(text, options);
2143
+ function parseWMSCapabilities(xmlText, options) {
2144
+ const parsedXML = XMLLoader.parseTextSync(xmlText, options);
2048
2145
  const xmlCapabilities = parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;
2049
- return extractCapabilities(xmlCapabilities);
2146
+ const capabilities = extractCapabilities(xmlCapabilities);
2147
+ if (options?.inheritedLayerProps) {
2148
+ for (const layer of capabilities.layers) {
2149
+ addInheritedLayerProps(layer, null);
2150
+ }
2151
+ }
2152
+ if (options?.includeRawData || options?.raw) {
2153
+ capabilities.raw = xmlCapabilities;
2154
+ }
2155
+ if (options?.includeXMLText) {
2156
+ capabilities.xml = xmlText;
2157
+ }
2158
+ return capabilities;
2050
2159
  }
2051
2160
  function extractCapabilities(xml) {
2052
2161
  const capabilities = {
2053
- name: xml.Service?.Name || "unnamed",
2054
- title: xml.Service?.Title,
2055
- keywords: [],
2056
- requests: {},
2057
- layer: extractLayer(xml.Capability?.Layer),
2058
- raw: xml
2162
+ version: String(xml.version || ""),
2163
+ name: String(xml.Service?.Name || "unnamed"),
2164
+ title: xml.Service?.Title ? String(xml.Service?.Title) : void 0,
2165
+ abstract: xml.Service?.Abstract ? String(xml.Service?.Abstract) : void 0,
2166
+ keywords: getXMLStringArray(xml.Service?.KeywordList?.Keyword),
2167
+ fees: xml.Service?.Fees ? JSON.stringify(xml.Service?.Fees) : void 0,
2168
+ accessConstraints: xml.Service?.AccessConstraints ? JSON.stringify(xml.Service?.AccessConstraints) : void 0,
2169
+ layerLimit: getXMLInteger(xml.Service?.LayerLimit),
2170
+ maxWidth: getXMLInteger(xml.Service?.maxWidth),
2171
+ maxHeight: getXMLInteger(xml.Service?.maxHeight),
2172
+ layers: [],
2173
+ requests: extractRequests(xml.Capability?.Request),
2174
+ exceptions: extractExceptions(xml.Exception)
2059
2175
  };
2060
- for (const keyword of xml.Service?.KeywordList?.Keyword || []) {
2061
- capabilities.keywords.push(keyword);
2176
+ const xmlLayers = getXMLArray(xml.Capability?.Layer);
2177
+ for (const xmlSubLayer of xmlLayers) {
2178
+ capabilities.layers.push(extractLayer(xmlSubLayer));
2062
2179
  }
2063
- for (const [name, xmlRequest] of Object.entries(xml.Capability?.Request || {})) {
2064
- capabilities.requests[name] = extractRequest(name, xmlRequest);
2180
+ for (const [key, value] of Object.entries(capabilities)) {
2181
+ if (value === void 0) {
2182
+ delete capabilities[key];
2183
+ }
2065
2184
  }
2066
2185
  return capabilities;
2067
2186
  }
2068
- function extractRequest(name, xmlRequest) {
2069
- const format = xmlRequest?.Format;
2070
- const mimeTypes = Array.isArray(format) ? format : [format];
2071
- return { name, mimeTypes };
2187
+ function extractRequests(xmlRequests) {
2188
+ const requests = {};
2189
+ for (const [name, xmlRequest] of Object.entries(xmlRequests || {})) {
2190
+ const mimeTypes = getXMLStringArray(xmlRequest?.Format);
2191
+ requests[name] = { mimeTypes };
2192
+ }
2193
+ return requests;
2194
+ }
2195
+ function extractExceptions(xmlException) {
2196
+ const xmlExceptionFormats = getXMLArray(xmlException?.Format);
2197
+ if (xmlExceptionFormats.length > 0) {
2198
+ return {
2199
+ mimeTypes: getXMLStringArray(xmlException)
2200
+ };
2201
+ }
2202
+ return void 0;
2072
2203
  }
2073
2204
  function extractLayer(xmlLayer) {
2074
2205
  const layer = {
2075
- name: xmlLayer?.Name,
2076
- title: xmlLayer?.Title,
2077
- srs: xmlLayer?.SRS || [],
2078
- layers: []
2206
+ title: String(xmlLayer?.Title || ""),
2207
+ name: String(xmlLayer?.Name),
2208
+ abstract: String(xmlLayer?.Abstract),
2209
+ keywords: getXMLStringArray(xmlLayer.KeywordList?.Keyword)
2079
2210
  };
2211
+ const crs = xmlLayer?.CRS || xmlLayer?.SRS;
2212
+ if (crs && Array.isArray(crs) && crs.every((_) => typeof _ === "string")) {
2213
+ layer.crs = crs;
2214
+ }
2215
+ let geographicBoundingBox = xmlLayer?.EX_GeographicBoundingBox && extractEXBoundingBox(xmlLayer?.EX_GeographicBoundingBox);
2216
+ if (geographicBoundingBox) {
2217
+ layer.geographicBoundingBox = geographicBoundingBox;
2218
+ }
2219
+ geographicBoundingBox = xmlLayer?.LatLonBoundingBox && extractLatLonBoundingBox(xmlLayer?.LatLonBoundingBox);
2220
+ if (geographicBoundingBox) {
2221
+ layer.geographicBoundingBox = geographicBoundingBox;
2222
+ }
2223
+ const boundingBoxes = xmlLayer?.BoundingBox && extractWMSBoundingBoxes(xmlLayer?.BoundingBox);
2224
+ if (boundingBoxes && boundingBoxes.length > 0) {
2225
+ layer.boundingBoxes = boundingBoxes;
2226
+ }
2227
+ if (xmlLayer?.opaque) {
2228
+ layer.opaque = getXMLBoolean(xmlLayer?.opaque);
2229
+ }
2230
+ if (xmlLayer?.cascaded) {
2231
+ layer.cascaded = getXMLBoolean(xmlLayer?.cascaded);
2232
+ }
2233
+ if (xmlLayer?.queryable) {
2234
+ layer.queryable = getXMLBoolean(xmlLayer?.queryable);
2235
+ }
2080
2236
  const xmlLayers = getXMLArray(xmlLayer?.Layer);
2237
+ const layers = [];
2081
2238
  for (const xmlSubLayer of xmlLayers) {
2082
- layer.layers?.push(extractLayer(xmlSubLayer));
2239
+ layers.push(extractLayer(xmlSubLayer));
2240
+ }
2241
+ if (layers.length > 0) {
2242
+ layer.layers = layers;
2243
+ }
2244
+ for (const [key, value] of Object.entries(layer)) {
2245
+ if (value === void 0) {
2246
+ delete layer[key];
2247
+ }
2083
2248
  }
2084
2249
  return layer;
2085
2250
  }
2086
- function getXMLArray(xmlValue) {
2087
- if (Array.isArray(xmlValue)) {
2088
- return xmlValue;
2251
+ function extractEXBoundingBox(xmlBoundingBox) {
2252
+ const {
2253
+ westBoundLongitude: w,
2254
+ northBoundLatitude: n,
2255
+ eastBoundLongitude: e,
2256
+ southBoundLatitude: s
2257
+ } = xmlBoundingBox;
2258
+ return [
2259
+ [w, s],
2260
+ [e, n]
2261
+ ];
2262
+ }
2263
+ function extractLatLonBoundingBox(xmlBoundingBox) {
2264
+ const { minx, miny, maxx, maxy } = xmlBoundingBox;
2265
+ return [
2266
+ [minx, miny],
2267
+ [maxx, maxy]
2268
+ ];
2269
+ }
2270
+ function extractWMSBoundingBoxes(xmlBoundingBoxes) {
2271
+ const xmlBoxes = getXMLArray(xmlBoundingBoxes);
2272
+ return xmlBoxes.map((xmlBox) => extractWMSBoundingBox(xmlBox));
2273
+ }
2274
+ function extractWMSBoundingBox(xmlBoundingBox) {
2275
+ const { CRS, SRS, minx, miny, maxx, maxy, resx, resy } = xmlBoundingBox;
2276
+ const boundingBox = {
2277
+ crs: CRS || SRS,
2278
+ boundingBox: [
2279
+ [getXMLFloat(minx), getXMLFloat(miny)],
2280
+ [getXMLFloat(maxx), getXMLFloat(maxy)]
2281
+ ]
2282
+ };
2283
+ if (resx) {
2284
+ boundingBox.xResolution = resx;
2089
2285
  }
2090
- if (xmlValue) {
2091
- return [xmlValue];
2286
+ if (resy) {
2287
+ boundingBox.yResolution = resy;
2288
+ }
2289
+ return boundingBox;
2290
+ }
2291
+ function addInheritedLayerProps(layer, parent) {
2292
+ if (parent && parent.geographicBoundingBox && !layer.geographicBoundingBox) {
2293
+ layer.geographicBoundingBox = [...parent.geographicBoundingBox];
2294
+ }
2295
+ if (parent && parent.crs && !layer.crs) {
2296
+ layer.crs = [...parent.crs];
2297
+ }
2298
+ if (parent && parent.boundingBoxes && !layer.boundingBoxes) {
2299
+ layer.boundingBoxes = [...parent.boundingBoxes];
2300
+ }
2301
+ for (const subLayer of layer.layers || []) {
2302
+ addInheritedLayerProps(subLayer, layer);
2092
2303
  }
2093
- return [];
2094
2304
  }
2095
2305
  var init_parse_wms_capabilities = __esm({
2096
2306
  "src/lib/parsers/wms/parse-wms-capabilities.ts"() {
2097
2307
  init_src2();
2308
+ init_parse_xml_helpers();
2098
2309
  }
2099
2310
  });
2100
2311
 
@@ -2119,8 +2330,8 @@
2119
2330
  options: {
2120
2331
  wms: {}
2121
2332
  },
2122
- parse: async (arrayBuffer, options) => parseWMSCapabilities(new TextDecoder().decode(arrayBuffer), options),
2123
- parseTextSync: (text, options) => parseWMSCapabilities(text, options)
2333
+ parse: async (arrayBuffer, options) => parseWMSCapabilities(new TextDecoder().decode(arrayBuffer), options?.wms),
2334
+ parseTextSync: (text, options) => parseWMSCapabilities(text, options?.wms)
2124
2335
  };
2125
2336
  }
2126
2337
  });
@@ -2191,49 +2402,6 @@
2191
2402
  }
2192
2403
  });
2193
2404
 
2194
- // src/wip/lib/wmts/parse-wmts-capabilities.ts
2195
- function parseWMTSCapabilities(text, options) {
2196
- const parsedXML = XMLLoader.parseTextSync(text, { ...options, xml: {
2197
- ...options?.xml,
2198
- removeNSPrefix: true,
2199
- uncapitalizeKeys: true
2200
- } });
2201
- const xmlCapabilities = parsedXML.Capabilities || parsedXML;
2202
- return xmlCapabilities;
2203
- }
2204
- var init_parse_wmts_capabilities = __esm({
2205
- "src/wip/lib/wmts/parse-wmts-capabilities.ts"() {
2206
- init_src2();
2207
- }
2208
- });
2209
-
2210
- // src/wip/wmts-capabilities-loader.ts
2211
- function testXMLFile7(text) {
2212
- return text.startsWith("<?xml");
2213
- }
2214
- var VERSION7, WMTSCapabilitiesLoader;
2215
- var init_wmts_capabilities_loader = __esm({
2216
- "src/wip/wmts-capabilities-loader.ts"() {
2217
- init_parse_wmts_capabilities();
2218
- VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2219
- WMTSCapabilitiesLoader = {
2220
- id: "wmts-capabilities",
2221
- name: "WMTS Capabilities",
2222
- module: "wms",
2223
- version: VERSION7,
2224
- worker: false,
2225
- extensions: ["xml"],
2226
- mimeTypes: ["application/vnd.ogc.wmts_xml", "application/xml", "text/xml"],
2227
- testText: testXMLFile7,
2228
- options: {
2229
- wms: {}
2230
- },
2231
- parse: async (arrayBuffer, options) => parseWMTSCapabilities(new TextDecoder().decode(arrayBuffer), options),
2232
- parseTextSync: (text, options) => parseWMTSCapabilities(text, options)
2233
- };
2234
- }
2235
- });
2236
-
2237
2405
  // src/wip/lib/wfs/parse-wfs-capabilities.ts
2238
2406
  function parseWFSCapabilities(text, options) {
2239
2407
  const parsedXML = XMLLoader.parseTextSync(text, { ...options, xml: {
@@ -2251,23 +2419,23 @@
2251
2419
  });
2252
2420
 
2253
2421
  // src/wip/wfs-capabilities-loader.ts
2254
- function testXMLFile8(text) {
2422
+ function testXMLFile7(text) {
2255
2423
  return text.startsWith("<?xml");
2256
2424
  }
2257
- var VERSION8, WFSCapabilitiesLoader;
2425
+ var VERSION7, WFSCapabilitiesLoader;
2258
2426
  var init_wfs_capabilities_loader = __esm({
2259
2427
  "src/wip/wfs-capabilities-loader.ts"() {
2260
2428
  init_parse_wfs_capabilities();
2261
- VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2429
+ VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2262
2430
  WFSCapabilitiesLoader = {
2263
2431
  id: "wfs-capabilities",
2264
2432
  name: "WFS Capabilities",
2265
2433
  module: "wms",
2266
- version: VERSION8,
2434
+ version: VERSION7,
2267
2435
  worker: false,
2268
2436
  extensions: ["xml"],
2269
2437
  mimeTypes: ["application/vnd.ogc.wfs_xml", "application/xml", "text/xml"],
2270
- testText: testXMLFile8,
2438
+ testText: testXMLFile7,
2271
2439
  options: {
2272
2440
  wms: {}
2273
2441
  },
@@ -3045,23 +3213,23 @@
3045
3213
  });
3046
3214
 
3047
3215
  // src/gml-loader.ts
3048
- function testXMLFile9(text) {
3216
+ function testXMLFile8(text) {
3049
3217
  return text.startsWith("<?xml");
3050
3218
  }
3051
- var VERSION9, GMLLoader;
3219
+ var VERSION8, GMLLoader;
3052
3220
  var init_gml_loader = __esm({
3053
3221
  "src/gml-loader.ts"() {
3054
3222
  init_parse_gml();
3055
- VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3223
+ VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3056
3224
  GMLLoader = {
3057
3225
  name: "GML",
3058
3226
  id: "gml",
3059
3227
  module: "wms",
3060
- version: VERSION9,
3228
+ version: VERSION8,
3061
3229
  worker: false,
3062
3230
  extensions: ["xml"],
3063
3231
  mimeTypes: ["application/vnd.ogc.gml", "application/xml", "text/xml"],
3064
- testText: testXMLFile9,
3232
+ testText: testXMLFile8,
3065
3233
  options: {
3066
3234
  gml: {}
3067
3235
  },
@@ -3106,10 +3274,10 @@
3106
3274
  });
3107
3275
 
3108
3276
  // ../images/src/lib/utils/version.ts
3109
- var VERSION10;
3277
+ var VERSION9;
3110
3278
  var init_version = __esm({
3111
3279
  "../images/src/lib/utils/version.ts"() {
3112
- VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3280
+ VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3113
3281
  }
3114
3282
  });
3115
3283
 
@@ -3558,7 +3726,7 @@
3558
3726
  id: "image",
3559
3727
  module: "images",
3560
3728
  name: "Images",
3561
- version: VERSION10,
3729
+ version: VERSION9,
3562
3730
  mimeTypes: MIME_TYPES,
3563
3731
  extensions: EXTENSIONS,
3564
3732
  parse: parseImage,
@@ -3636,23 +3804,27 @@
3636
3804
  WMSFeatureInfoLoader,
3637
3805
  WMSLayerDescriptionLoader
3638
3806
  ];
3639
- this.props = {
3640
- loadOptions: void 0,
3807
+ this.url = props.url;
3808
+ this.wmsParameters = {
3641
3809
  layers: void 0,
3642
3810
  styles: void 0,
3643
- version: "1.1.1",
3644
- srs: "EPSG:4326",
3811
+ version: "1.3.0",
3812
+ crs: "EPSG:4326",
3645
3813
  format: "image/png",
3646
3814
  info_format: "text/plain",
3647
- ...props
3815
+ transparent: void 0,
3816
+ ...props.wmsParameters
3648
3817
  };
3818
+ this.vendorParameters = props.vendorParameters || {};
3649
3819
  }
3650
3820
  async getMetadata() {
3651
3821
  const capabilities = await this.getCapabilities();
3652
3822
  return this.normalizeMetadata(capabilities);
3653
3823
  }
3654
3824
  async getImage(parameters) {
3655
- return await this.getMap(parameters);
3825
+ const wmsParameters = { ...parameters, crs: parameters.srs };
3826
+ delete wmsParameters.srs;
3827
+ return await this.getMap(wmsParameters);
3656
3828
  }
3657
3829
  normalizeMetadata(capabilities) {
3658
3830
  return capabilities;
@@ -3662,128 +3834,143 @@
3662
3834
  const response = await this.fetch(url);
3663
3835
  const arrayBuffer = await response.arrayBuffer();
3664
3836
  this._checkResponse(response, arrayBuffer);
3665
- const capabilities = await WMSCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);
3837
+ const capabilities = await WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);
3666
3838
  this.capabilities = capabilities;
3667
3839
  return capabilities;
3668
3840
  }
3669
- async getMap(options, vendorParameters) {
3670
- const url = this.getMapURL(options, vendorParameters);
3841
+ async getMap(wmsParameters, vendorParameters) {
3842
+ const url = this.getMapURL(wmsParameters, vendorParameters);
3671
3843
  const response = await this.fetch(url);
3672
3844
  const arrayBuffer = await response.arrayBuffer();
3673
3845
  this._checkResponse(response, arrayBuffer);
3674
3846
  try {
3675
- return await ImageLoader.parse(arrayBuffer, this.props.loadOptions);
3847
+ return await ImageLoader.parse(arrayBuffer, this.loadOptions);
3676
3848
  } catch {
3677
3849
  throw this._parseError(arrayBuffer);
3678
3850
  }
3679
3851
  }
3680
- async getFeatureInfo(options, vendorParameters) {
3681
- const url = this.getFeatureInfoURL(options, vendorParameters);
3852
+ async getFeatureInfo(wmsParameters, vendorParameters) {
3853
+ const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
3682
3854
  const response = await this.fetch(url);
3683
3855
  const arrayBuffer = await response.arrayBuffer();
3684
3856
  this._checkResponse(response, arrayBuffer);
3685
- return await WMSFeatureInfoLoader.parse(arrayBuffer, this.props.loadOptions);
3857
+ return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
3686
3858
  }
3687
- async getFeatureInfoText(options, vendorParameters) {
3688
- const url = this.getFeatureInfoURL(options, vendorParameters);
3859
+ async getFeatureInfoText(wmsParameters, vendorParameters) {
3860
+ const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
3689
3861
  const response = await this.fetch(url);
3690
3862
  const arrayBuffer = await response.arrayBuffer();
3691
3863
  this._checkResponse(response, arrayBuffer);
3692
3864
  return new TextDecoder().decode(arrayBuffer);
3693
3865
  }
3694
- async describeLayer(options, vendorParameters) {
3695
- const url = this.describeLayerURL(options, vendorParameters);
3866
+ async describeLayer(wmsParameters, vendorParameters) {
3867
+ const url = this.describeLayerURL(wmsParameters, vendorParameters);
3696
3868
  const response = await this.fetch(url);
3697
3869
  const arrayBuffer = await response.arrayBuffer();
3698
3870
  this._checkResponse(response, arrayBuffer);
3699
- return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.props.loadOptions);
3871
+ return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
3700
3872
  }
3701
- async getLegendGraphic(options, vendorParameters) {
3702
- const url = this.getLegendGraphicURL(options, vendorParameters);
3873
+ async getLegendGraphic(wmsParameters, vendorParameters) {
3874
+ const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);
3703
3875
  const response = await this.fetch(url);
3704
3876
  const arrayBuffer = await response.arrayBuffer();
3705
3877
  this._checkResponse(response, arrayBuffer);
3706
3878
  try {
3707
- return await ImageLoader.parse(arrayBuffer, this.props.loadOptions);
3879
+ return await ImageLoader.parse(arrayBuffer, this.loadOptions);
3708
3880
  } catch {
3709
3881
  throw this._parseError(arrayBuffer);
3710
3882
  }
3711
3883
  }
3712
3884
  getCapabilitiesURL(wmsParameters, vendorParameters) {
3713
3885
  const options = {
3714
- service: "WMS",
3715
- version: this.props.version,
3716
- request: "GetCapabilities",
3717
- ...wmsParameters,
3718
- ...vendorParameters
3886
+ version: this.wmsParameters.version,
3887
+ ...wmsParameters
3719
3888
  };
3720
- return this._getWMSUrl(options, vendorParameters);
3889
+ return this._getWMSUrl("GetCapabilities", options, vendorParameters);
3721
3890
  }
3722
3891
  getMapURL(wmsParameters, vendorParameters) {
3723
3892
  const options = {
3724
- service: "WMS",
3725
- version: this.props.version,
3726
- request: "GetMap",
3727
- styles: this.props.styles,
3728
- srs: this.props.srs,
3729
- format: this.props.format,
3730
- ...wmsParameters,
3731
- ...vendorParameters
3893
+ version: this.wmsParameters.version,
3894
+ styles: this.wmsParameters.styles,
3895
+ crs: this.wmsParameters.crs,
3896
+ format: this.wmsParameters.format,
3897
+ transparent: this.wmsParameters.transparent,
3898
+ ...wmsParameters
3732
3899
  };
3733
- return this._getWMSUrl(options, vendorParameters);
3900
+ return this._getWMSUrl("GetMap", options, vendorParameters);
3734
3901
  }
3735
3902
  getFeatureInfoURL(wmsParameters, vendorParameters) {
3736
3903
  const options = {
3737
- service: "WMS",
3738
- version: this.props.version,
3739
- request: "GetFeatureInfo",
3740
- srs: this.props.srs,
3741
- format: this.props.format,
3742
- info_format: this.props.info_format,
3743
- styles: this.props.styles,
3744
- ...wmsParameters,
3745
- ...vendorParameters
3904
+ version: this.wmsParameters.version,
3905
+ srs: this.wmsParameters.crs,
3906
+ format: this.wmsParameters.format,
3907
+ info_format: this.wmsParameters.info_format,
3908
+ styles: this.wmsParameters.styles,
3909
+ ...wmsParameters
3746
3910
  };
3747
- return this._getWMSUrl(options, vendorParameters);
3911
+ return this._getWMSUrl("GetFeatureInfo", options, vendorParameters);
3748
3912
  }
3749
3913
  describeLayerURL(wmsParameters, vendorParameters) {
3750
3914
  const options = {
3751
- service: "WMS",
3752
- version: this.props.version,
3753
- request: "DescribeLayer",
3754
- ...wmsParameters,
3755
- ...vendorParameters
3915
+ version: this.wmsParameters.version,
3916
+ ...wmsParameters
3756
3917
  };
3757
- return this._getWMSUrl(options, vendorParameters);
3918
+ return this._getWMSUrl("DescribeLayer", options, vendorParameters);
3758
3919
  }
3759
3920
  getLegendGraphicURL(wmsParameters, vendorParameters) {
3760
3921
  const options = {
3922
+ version: this.wmsParameters.version,
3923
+ ...wmsParameters
3924
+ };
3925
+ return this._getWMSUrl("GetLegendGraphic", options, vendorParameters);
3926
+ }
3927
+ _parseWMSUrl(url) {
3928
+ const [baseUrl, search] = url.split("?");
3929
+ const searchParams = search.split("&");
3930
+ const parameters = {};
3931
+ for (const parameter of searchParams) {
3932
+ const [key, value] = parameter.split("=");
3933
+ parameters[key] = value;
3934
+ }
3935
+ return { url: baseUrl, parameters };
3936
+ }
3937
+ _getWMSUrl(request, wmsParameters, vendorParameters) {
3938
+ let url = this.url;
3939
+ let first = true;
3940
+ const allParameters = {
3761
3941
  service: "WMS",
3762
- version: this.props.version,
3763
- request: "GetLegendGraphic",
3942
+ version: wmsParameters.version,
3943
+ request,
3764
3944
  ...wmsParameters,
3945
+ ...this.vendorParameters,
3765
3946
  ...vendorParameters
3766
3947
  };
3767
- return this._getWMSUrl(options, vendorParameters);
3768
- }
3769
- _getWMSUrl(options, vendorParameters) {
3770
- let url = this.props.url;
3771
- let first = true;
3772
- for (const [key, value] of Object.entries(options)) {
3773
- url += first ? "?" : "&";
3774
- first = false;
3775
- if (Array.isArray(value)) {
3776
- url += `${key.toUpperCase()}=${value.join(",")}`;
3777
- } else {
3778
- url += `${key.toUpperCase()}=${value ? String(value) : ""}`;
3948
+ for (const [key, value] of Object.entries(allParameters)) {
3949
+ if (key !== "transparent" || value) {
3950
+ url += first ? "?" : "&";
3951
+ first = false;
3952
+ url += this._getParameterValue(wmsParameters.version, key, value);
3779
3953
  }
3780
3954
  }
3781
3955
  return encodeURI(url);
3782
3956
  }
3957
+ _getParameterValue(version, key, value) {
3958
+ if (key === "crs" && version !== "1.3.0") {
3959
+ key = "srs";
3960
+ }
3961
+ key = key.toUpperCase();
3962
+ return Array.isArray(value) ? `${key}=${value.join(",")}` : `${key}=${value ? String(value) : ""}`;
3963
+ }
3964
+ async _fetchArrayBuffer(url) {
3965
+ const response = await this.fetch(url);
3966
+ const arrayBuffer = await response.arrayBuffer();
3967
+ this._checkResponse(response, arrayBuffer);
3968
+ return arrayBuffer;
3969
+ }
3783
3970
  _checkResponse(response, arrayBuffer) {
3784
3971
  const contentType = response.headers["content-type"];
3785
3972
  if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
3786
- const loadOptions = mergeLoaderOptions(this.props.loadOptions, {
3973
+ const loadOptions = mergeLoaderOptions(this.loadOptions, {
3787
3974
  wms: { throwOnError: true }
3788
3975
  });
3789
3976
  const error = WMSErrorLoader.parseSync(arrayBuffer, loadOptions);
@@ -3791,7 +3978,7 @@
3791
3978
  }
3792
3979
  }
3793
3980
  _parseError(arrayBuffer) {
3794
- const error = WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
3981
+ const error = WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
3795
3982
  return new Error(error);
3796
3983
  }
3797
3984
  };
@@ -4090,7 +4277,6 @@
4090
4277
  _WFSCapabilitiesLoader: () => WFSCapabilitiesLoader,
4091
4278
  _WMSFeatureInfoLoader: () => WMSFeatureInfoLoader,
4092
4279
  _WMSLayerDescriptionLoader: () => WMSLayerDescriptionLoader,
4093
- _WMTSCapabilitiesLoader: () => WMTSCapabilitiesLoader,
4094
4280
  _getArcGISServices: () => getArcGISServices,
4095
4281
  createImageSource: () => createImageSource
4096
4282
  });
@@ -4103,7 +4289,6 @@
4103
4289
  init_wms_capabilities_loader();
4104
4290
  init_wms_feature_info_loader();
4105
4291
  init_wms_layer_description_loader();
4106
- init_wmts_capabilities_loader();
4107
4292
  init_wfs_capabilities_loader();
4108
4293
  init_gml_loader();
4109
4294
  init_image_source();