@loaders.gl/wms 4.2.0-alpha.4 → 4.2.0-alpha.6

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 (109) hide show
  1. package/dist/csw-capabilities-loader.d.ts +1 -1
  2. package/dist/csw-capabilities-loader.d.ts.map +1 -1
  3. package/dist/csw-capabilities-loader.js +24 -16
  4. package/dist/csw-domain-loader.d.ts +1 -1
  5. package/dist/csw-domain-loader.d.ts.map +1 -1
  6. package/dist/csw-domain-loader.js +24 -16
  7. package/dist/csw-records-loader.d.ts +1 -1
  8. package/dist/csw-records-loader.d.ts.map +1 -1
  9. package/dist/csw-records-loader.js +24 -16
  10. package/dist/gml-loader.d.ts +1 -1
  11. package/dist/gml-loader.d.ts.map +1 -1
  12. package/dist/gml-loader.js +24 -16
  13. package/dist/index.cjs +76 -65
  14. package/dist/index.cjs.map +7 -0
  15. package/dist/index.d.ts +30 -30
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +8 -1
  18. package/dist/lib/parsers/csw/parse-csw-capabilities.js +18 -13
  19. package/dist/lib/parsers/csw/parse-csw-domain.js +26 -18
  20. package/dist/lib/parsers/csw/parse-csw-records.js +47 -36
  21. package/dist/lib/parsers/csw/parse-exception-report.js +26 -8
  22. package/dist/lib/parsers/gml/deep-strict-equal.js +107 -39
  23. package/dist/lib/parsers/gml/parse-gml.js +299 -280
  24. package/dist/lib/parsers/wms/parse-wms-capabilities.js +207 -187
  25. package/dist/lib/parsers/wms/parse-wms-error.js +17 -6
  26. package/dist/lib/parsers/wms/parse-wms-features.js +20 -19
  27. package/dist/lib/parsers/wms/parse-wms-layer-description.js +10 -4
  28. package/dist/lib/parsers/xml/parse-xml-helpers.js +54 -45
  29. package/dist/lib/services/create-image-service.d.ts +1 -1
  30. package/dist/lib/services/create-image-service.d.ts.map +1 -1
  31. package/dist/lib/services/create-image-service.js +31 -19
  32. package/dist/lib/services/image-service.js +40 -33
  33. package/dist/services/arcgis/arcgis-image-service.d.ts +2 -2
  34. package/dist/services/arcgis/arcgis-image-service.d.ts.map +1 -1
  35. package/dist/services/arcgis/arcgis-image-service.js +92 -55
  36. package/dist/services/arcgis/arcgis-server.js +35 -28
  37. package/dist/services/create-image-source.d.ts +3 -3
  38. package/dist/services/create-image-source.d.ts.map +1 -1
  39. package/dist/services/create-image-source.js +11 -2
  40. package/dist/services/ogc/csw-service.d.ts +3 -3
  41. package/dist/services/ogc/csw-service.d.ts.map +1 -1
  42. package/dist/services/ogc/csw-service.js +159 -143
  43. package/dist/services/ogc/wms-service.d.ts +4 -4
  44. package/dist/services/ogc/wms-service.d.ts.map +1 -1
  45. package/dist/services/ogc/wms-service.js +306 -242
  46. package/dist/wip/data-source.js +58 -1
  47. package/dist/wip/lib/wcs/parse-wcs-capabilities.js +8 -11
  48. package/dist/wip/lib/wfs/parse-wfs-capabilities.js +12 -12
  49. package/dist/wip/lib/wfs/parse-wfs.js +20 -20
  50. package/dist/wip/lib/wmts/parse-wmts-capabilities.js +70 -12
  51. package/dist/wip/lib/wmts/parse-wmts.js +23 -20
  52. package/dist/wip/services/arcgis-feature-service.js +25 -22
  53. package/dist/wip/wcs-capabilities-loader.d.ts +1 -1
  54. package/dist/wip/wcs-capabilities-loader.d.ts.map +1 -1
  55. package/dist/wip/wcs-capabilities-loader.js +22 -16
  56. package/dist/wip/wfs-capabilities-loader.d.ts +1 -1
  57. package/dist/wip/wfs-capabilities-loader.d.ts.map +1 -1
  58. package/dist/wip/wfs-capabilities-loader.js +22 -16
  59. package/dist/wip/wms-feature-info-loader.d.ts +1 -1
  60. package/dist/wip/wms-feature-info-loader.d.ts.map +1 -1
  61. package/dist/wip/wms-feature-info-loader.js +10 -6
  62. package/dist/wip/wms-layer-description-loader.d.ts +1 -1
  63. package/dist/wip/wms-layer-description-loader.d.ts.map +1 -1
  64. package/dist/wip/wms-layer-description-loader.js +9 -6
  65. package/dist/wip/wmts-capabilities-loader.js +23 -16
  66. package/dist/wms-capabilities-loader.d.ts +2 -2
  67. package/dist/wms-capabilities-loader.d.ts.map +1 -1
  68. package/dist/wms-capabilities-loader.js +28 -16
  69. package/dist/wms-error-loader.js +34 -29
  70. package/package.json +10 -8
  71. package/dist/csw-capabilities-loader.js.map +0 -1
  72. package/dist/csw-domain-loader.js.map +0 -1
  73. package/dist/csw-records-loader.js.map +0 -1
  74. package/dist/gml-loader.js.map +0 -1
  75. package/dist/index.js.map +0 -1
  76. package/dist/lib/parsers/csw/parse-csw-capabilities.js.map +0 -1
  77. package/dist/lib/parsers/csw/parse-csw-domain.js.map +0 -1
  78. package/dist/lib/parsers/csw/parse-csw-records.js.map +0 -1
  79. package/dist/lib/parsers/csw/parse-exception-report.js.map +0 -1
  80. package/dist/lib/parsers/gml/deep-strict-equal.js.map +0 -1
  81. package/dist/lib/parsers/gml/parse-gml.js.map +0 -1
  82. package/dist/lib/parsers/wms/parse-wms-capabilities.js.map +0 -1
  83. package/dist/lib/parsers/wms/parse-wms-error.js.map +0 -1
  84. package/dist/lib/parsers/wms/parse-wms-features.js.map +0 -1
  85. package/dist/lib/parsers/wms/parse-wms-layer-description.js.map +0 -1
  86. package/dist/lib/parsers/xml/parse-xml-helpers.js.map +0 -1
  87. package/dist/lib/services/create-image-service.js.map +0 -1
  88. package/dist/lib/services/image-service.js.map +0 -1
  89. package/dist/services/arcgis/arcgis-image-service.js.map +0 -1
  90. package/dist/services/arcgis/arcgis-server.js.map +0 -1
  91. package/dist/services/create-image-source.js.map +0 -1
  92. package/dist/services/ogc/csw-service.js.map +0 -1
  93. package/dist/services/ogc/wms-service.js.map +0 -1
  94. package/dist/wip/data-source.js.map +0 -1
  95. package/dist/wip/lib/wcs/parse-wcs-capabilities.js.map +0 -1
  96. package/dist/wip/lib/wfs/parse-wfs-capabilities.js.map +0 -1
  97. package/dist/wip/lib/wfs/parse-wfs.js.map +0 -1
  98. package/dist/wip/lib/wmts/parse-wmts-capabilities.js.map +0 -1
  99. package/dist/wip/lib/wmts/parse-wmts.js.map +0 -1
  100. package/dist/wip/services/arcgis-feature-service.js.map +0 -1
  101. package/dist/wip/services/wmts-service.ts.disabled +0 -348
  102. package/dist/wip/wcs-capabilities-loader.js.map +0 -1
  103. package/dist/wip/wfs-capabilities-loader.js.map +0 -1
  104. package/dist/wip/wms-feature-info-loader.js.map +0 -1
  105. package/dist/wip/wms-layer-description-loader.js.map +0 -1
  106. package/dist/wip/wms-layer-description-loader.md.disabled.md +0 -47
  107. package/dist/wip/wmts-capabilities-loader.js.map +0 -1
  108. package/dist/wms-capabilities-loader.js.map +0 -1
  109. package/dist/wms-error-loader.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"wms-service.js","names":["ImageLoader","mergeLoaderOptions","ImageSource","WMSCapabilitiesLoader","WMSFeatureInfoLoader","WMSLayerDescriptionLoader","WMSErrorLoader","WMSService","type","testURL","url","toLowerCase","includes","create","props","WMSSource","constructor","_props$substituteCRS","data","substituteCRS84","flipCRS","wmsParameters","vendorParameters","capabilities","layers","undefined","query_layers","styles","version","crs","format","info_format","transparent","time","elevation","getMetadata","getCapabilities","normalizeMetadata","getImage","parameters","boundingBox","bbox","rest","getMap","getCapabilitiesURL","response","fetch","arrayBuffer","_checkResponse","parse","loadOptions","getMapURL","_parseError","getFeatureInfo","getFeatureInfoURL","getFeatureInfoText","TextDecoder","decode","describeLayer","describeLayerURL","getLegendGraphic","getLegendGraphicURL","options","_getWMSUrl","_getWMS130Parameters","_parseWMSUrl","baseUrl","search","split","searchParams","parameter","key","value","request","first","allParameters","service","IGNORE_EMPTY_KEYS","Object","entries","_getURLParameter","encodeURI","newParameters","srs","_flipBoundingBox","toUpperCase","Array","isArray","join","String","bboxValue","length","flipCoordinates","_fetchArrayBuffer","contentType","headers","ok","mimeTypes","_WMSErrorLoader$parse","wms","throwOnError","error","parseSync","call","Error","_WMSErrorLoader$parse2"],"sources":["../../../src/services/ogc/wms-service.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\nimport type {ImageType} from '@loaders.gl/images';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {mergeLoaderOptions} from '@loaders.gl/loader-utils';\n\nimport type {Service, ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';\nimport {ImageSource} from '@loaders.gl/loader-utils';\nimport type {ImageServiceProps} from '../../lib/services/image-service';\n\nimport type {WMSCapabilities} from '../../wms-capabilities-loader';\nimport type {WMSFeatureInfo} from '../../wip/wms-feature-info-loader';\nimport type {WMSLayerDescription} from '../../wip/wms-layer-description-loader';\n\nimport {WMSCapabilitiesLoader} from '../../wms-capabilities-loader';\nimport {WMSFeatureInfoLoader} from '../../wip/wms-feature-info-loader';\nimport {WMSLayerDescriptionLoader} from '../../wip/wms-layer-description-loader';\n\nimport type {WMSLoaderOptions} from '../../wms-error-loader';\nimport {WMSErrorLoader} from '../../wms-error-loader';\n\nexport const WMSService: Service<WMSSource, WMSSourceProps> = {\n type: 'wms',\n testURL: (url: string): boolean => url.toLowerCase().includes('wms'),\n create: (props: WMSSourceProps) => new WMSSource(props)\n};\n\n/**\n * \"Static\" WMS parameters (not viewport or selected pixel dependent)\n * These can be provided as defaults in the WMSSource constructor\n */\nexport type WMSParameters = {\n /** WMS version (all requests) */\n version?: '1.3.0' | '1.1.1';\n /** Layers to render (GetMap, GetFeatureInfo) */\n layers?: string[];\n /** list of layers to query.. (GetFeatureInfo) */\n query_layers?: string[];\n\n /** Coordinate Reference System (CRS) for the image (not the bounding box) */\n crs?: string;\n /** Requested format for the return image (GetMap, GetLegendGraphic) */\n format?: 'image/png';\n /** Requested MIME type of returned feature info (GetFeatureInfo) */\n info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';\n /** Styling - Not yet supported */\n styles?: unknown;\n /** Any additional parameters specific to this WMSSource (GetMap) */\n transparent?: boolean;\n /** If layer supports time dimension */\n time?: string;\n /** If layer supports elevation dimension */\n elevation?: string;\n};\n\n/** Parameters for GetCapabilities */\nexport type WMSGetCapabilitiesParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n/** Parameters for GetMap */\nexport type WMSGetMapParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n /** bounding box of the requested map image `[[w, s], [e, n]]` */\n // boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];\n /** bounding box of the requested map image @deprecated Use .boundingBox */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** requested format for the return image. can be provided in service constructor */\n format?: 'image/png';\n /** Layers to render - can be provided in service constructor */\n layers?: string | string[];\n /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */\n crs?: string;\n /** Styling. can be provided in service constructor */\n styles?: unknown;\n /** Don't render background when no data. can be provided in service constructor */\n transparent?: boolean;\n /** If layer supports time dimension */\n time?: string;\n /** If layer supports elevation dimension */\n elevation?: string;\n};\n\n// /** GetMap parameters that are specific to the current view */\n// export type WMSGetMapViewParameters = {\n// /** pixel width of returned image */\n// width: number;\n// /** pixels */\n// height: number;\n// /** bounding box of the requested map image */\n// bbox: [number, number, number, number];\n// /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */\n// crs?: string;\n// };\n\n/**\n * Parameters for GetFeatureInfo\n * @see https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&\n */\nexport type WMSGetFeatureInfoParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** MIME type of returned feature info. Can be specified in service constructor */\n info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';\n /** list of layers to query. Required but can be specified in service constructor. */\n query_layers?: string[];\n /** Layers to render. Required, but can be specified in service constructor */\n layers?: string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** srs for the image (not the bounding box) */\n crs?: string;\n};\n\n/** GetMap parameters that are specific to the current view */\nexport type WMSGetFeatureInfoViewParameters = {\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** srs for the image (not the bounding box) */\n crs?: string;\n};\n\n/** Parameters for DescribeLayer */\nexport type WMSDescribeLayerParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n/** Parameters for GetLegendGraphic */\nexport type WMSGetLegendGraphicParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n//\n\n/** Properties for creating a enw WMS service */\nexport type WMSSourceProps = ImageServiceProps & {\n /** Base URL to the service */\n url: string;\n /** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */\n substituteCRS84?: boolean;\n /** Default WMS parameters. If not provided here, must be provided in the various request */\n wmsParameters?: WMSParameters;\n /** Any additional service specific parameters */\n vendorParameters?: Record<string, unknown>;\n};\n\n/**\n * The WMSSource class provides\n * - provides type safe methods to form URLs to a WMS service\n * - provides type safe methods to query and parse results (and errors) from a WMS service\n * - implements the ImageService interface\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class WMSSource extends ImageSource<WMSSourceProps> {\n /** Base URL to the service */\n readonly url: string;\n readonly data: string;\n\n /** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */\n substituteCRS84: boolean;\n /** In WMS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */\n flipCRS: string[];\n\n /** Default static WMS parameters */\n wmsParameters: Required<WMSParameters>;\n /** Default static vendor parameters */\n vendorParameters?: Record<string, unknown>;\n\n capabilities: WMSCapabilities | null = null;\n\n /** Create a WMSSource */\n constructor(props: WMSSourceProps) {\n super(props);\n\n // TODO - defaults such as version, layers etc could be extracted from a base URL with parameters\n // This would make pasting in any WMS URL more likely to make this class just work.\n // const {baseUrl, parameters} = this._parseWMSUrl(props.url);\n\n this.url = props.url;\n this.data = props.url;\n\n this.substituteCRS84 = props.substituteCRS84 ?? false;\n this.flipCRS = ['EPSG:4326'];\n\n this.wmsParameters = {\n layers: undefined!,\n query_layers: undefined!,\n styles: undefined,\n version: '1.3.0',\n crs: 'EPSG:4326',\n format: 'image/png',\n info_format: 'text/plain',\n transparent: undefined!,\n time: undefined!,\n elevation: undefined!,\n ...props.wmsParameters\n };\n\n this.vendorParameters = props.vendorParameters || {};\n }\n\n // ImageService implementation\n async getMetadata(): Promise<ImageSourceMetadata> {\n const capabilities = await this.getCapabilities();\n return this.normalizeMetadata(capabilities);\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n // Replace the GetImage `boundingBox` parameter with the WMS flat `bbox` parameter.\n const {boundingBox, bbox, ...rest} = parameters;\n const wmsParameters: WMSGetMapParameters = {\n bbox: boundingBox ? [...boundingBox[0], ...boundingBox[1]] : bbox!,\n ...rest\n };\n return await this.getMap(wmsParameters);\n }\n\n normalizeMetadata(capabilities: WMSCapabilities): ImageSourceMetadata {\n return capabilities;\n }\n\n // WMS Service API Stubs\n\n /** Get Capabilities */\n async getCapabilities(\n wmsParameters?: WMSGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSCapabilities> {\n const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n const capabilities = await WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);\n this.capabilities = capabilities;\n return capabilities;\n }\n\n /** Get a map image */\n async getMap(\n wmsParameters: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getMapURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n try {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfo(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSFeatureInfo> {\n const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfoText(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<string> {\n const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return new TextDecoder().decode(arrayBuffer);\n }\n\n /** Get more information about a layer */\n async describeLayer(\n wmsParameters: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSLayerDescription> {\n const url = this.describeLayerURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);\n }\n\n /** Get an image with a semantic legend */\n async getLegendGraphic(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n try {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n // Typed URL creators\n // For applications that want full control of fetching and parsing\n\n /** Generate a URL for the GetCapabilities request */\n getCapabilitiesURL(\n wmsParameters?: WMSGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetCapabilitiesParameters> = {\n version: this.wmsParameters.version,\n ...wmsParameters\n };\n return this._getWMSUrl('GetCapabilities', options, vendorParameters);\n }\n\n /** Generate a URL for the GetMap request */\n getMapURL(\n wmsParameters: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n wmsParameters = this._getWMS130Parameters(wmsParameters);\n const options: Required<WMSGetMapParameters> = {\n version: this.wmsParameters.version,\n format: this.wmsParameters.format,\n transparent: this.wmsParameters.transparent,\n time: this.wmsParameters.time,\n elevation: this.wmsParameters.elevation,\n layers: this.wmsParameters.layers,\n styles: this.wmsParameters.styles,\n crs: this.wmsParameters.crs,\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n ...wmsParameters\n };\n return this._getWMSUrl('GetMap', options, vendorParameters);\n }\n\n /** Generate a URL for the GetFeatureInfo request */\n getFeatureInfoURL(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n wmsParameters = this._getWMS130Parameters(wmsParameters);\n const options: Required<WMSGetFeatureInfoParameters> = {\n version: this.wmsParameters.version,\n // query_layers: [],\n // format: this.wmsParameters.format,\n info_format: this.wmsParameters.info_format,\n layers: this.wmsParameters.layers,\n query_layers: this.wmsParameters.query_layers,\n styles: this.wmsParameters.styles,\n crs: this.wmsParameters.crs,\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n // x: undefined!,\n // y: undefined!,\n ...wmsParameters\n };\n return this._getWMSUrl('GetFeatureInfo', options, vendorParameters);\n }\n\n /** Generate a URL for the GetFeatureInfo request */\n describeLayerURL(\n wmsParameters: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSDescribeLayerParameters> = {\n version: this.wmsParameters.version,\n ...wmsParameters\n };\n return this._getWMSUrl('DescribeLayer', options, vendorParameters);\n }\n\n getLegendGraphicURL(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetLegendGraphicParameters> = {\n version: this.wmsParameters.version,\n // format?\n ...wmsParameters\n };\n return this._getWMSUrl('GetLegendGraphic', options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n _parseWMSUrl(url: string): {url: string; parameters: Record<string, unknown>} {\n const [baseUrl, search] = url.split('?');\n const searchParams = search.split('&');\n\n const parameters: Record<string, unknown> = {};\n for (const parameter of searchParams) {\n const [key, value] = parameter.split('=');\n parameters[key] = value;\n }\n\n return {url: baseUrl, parameters};\n }\n\n /**\n * Generate a URL with parameters\n * @note case _getWMSUrl may need to be overridden to handle certain backends?\n * @note at the moment, only URLs with parameters are supported (no XML payloads)\n * */\n protected _getWMSUrl(\n request: string,\n wmsParameters: {version?: '1.3.0' | '1.1.1'; [key: string]: unknown},\n vendorParameters?: Record<string, unknown>\n ): string {\n let url = this.url;\n let first = true;\n\n // Add any vendor searchParams\n const allParameters = {\n service: 'WMS',\n version: wmsParameters.version,\n request,\n ...wmsParameters,\n ...this.vendorParameters,\n ...vendorParameters\n };\n\n // Encode the keys\n const IGNORE_EMPTY_KEYS = ['transparent', 'time', 'elevation'];\n for (const [key, value] of Object.entries(allParameters)) {\n // hack to preserve test cases. Not super clear if keys should be included when values are undefined\n if (!IGNORE_EMPTY_KEYS.includes(key) || value) {\n url += first ? '?' : '&';\n first = false;\n url += this._getURLParameter(key, value, wmsParameters);\n }\n }\n\n return encodeURI(url);\n }\n\n _getWMS130Parameters<ParametersT extends {crs?: string; srs?: string}>(\n wmsParameters: ParametersT\n ): ParametersT {\n const newParameters = {...wmsParameters};\n if (newParameters.srs) {\n newParameters.crs = newParameters.crs || newParameters.srs;\n delete newParameters.srs;\n }\n return newParameters;\n }\n\n // eslint-disable-next-line complexity\n _getURLParameter(key: string, value: unknown, wmsParameters: WMSParameters): string {\n // Substitute by key\n switch (key) {\n case 'crs':\n // CRS was called SRS before WMS 1.3.0\n if (wmsParameters.version !== '1.3.0') {\n key = 'srs';\n } else if (this.substituteCRS84 && value === 'EPSG:4326') {\n /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */\n // Substitute by value\n value = 'CRS:84';\n }\n break;\n\n case 'srs':\n // CRS was called SRS before WMS 1.3.0\n if (wmsParameters.version === '1.3.0') {\n key = 'crs';\n }\n break;\n\n case 'bbox':\n // Coordinate order is flipped for certain CRS in WMS 1.3.0\n const bbox = this._flipBoundingBox(value, wmsParameters);\n if (bbox) {\n value = bbox;\n }\n break;\n\n default:\n // do nothing\n }\n\n key = key.toUpperCase();\n\n return Array.isArray(value)\n ? `${key}=${value.join(',')}`\n : `${key}=${value ? String(value) : ''}`;\n }\n\n /** Coordinate order is flipped for certain CRS in WMS 1.3.0 */\n _flipBoundingBox(\n bboxValue: unknown,\n wmsParameters: WMSParameters\n ): [number, number, number, number] | null {\n // Sanity checks\n if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {\n return null;\n }\n\n const flipCoordinates =\n // Only affects WMS 1.3.0\n wmsParameters.version === '1.3.0' &&\n // Flip if we are dealing with a CRS that was flipped in 1.3.0\n this.flipCRS.includes(wmsParameters.crs || '') &&\n // Don't flip if we are subsituting EPSG:4326 with CRS:84\n !(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');\n\n const bbox = bboxValue as [number, number, number, number];\n return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;\n }\n\n /** Fetches an array buffer and checks the response (boilerplate reduction) */\n protected async _fetchArrayBuffer(url: string): Promise<ArrayBuffer> {\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return arrayBuffer;\n }\n\n /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */\n protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {\n const contentType = response.headers['content-type'];\n if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {\n // We want error responses to throw exceptions, the WMSErrorLoader can do this\n const loadOptions = mergeLoaderOptions<WMSLoaderOptions>(this.loadOptions, {\n wms: {throwOnError: true}\n });\n const error = WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);\n throw new Error(error);\n }\n }\n\n /** Error situation detected */\n protected _parseError(arrayBuffer: ArrayBuffer): Error {\n const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":"AAMA,SAAQA,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,kBAAkB,QAAO,0BAA0B;AAG3D,SAAQC,WAAW,QAAO,0BAA0B;AAAC,SAO7CC,qBAAqB;AAAA,SACrBC,oBAAoB;AAAA,SACpBC,yBAAyB;AAAA,SAGzBC,cAAc;AAEtB,OAAO,MAAMC,UAA8C,GAAG;EAC5DC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAGC,GAAW,IAAcA,GAAG,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,KAAK,CAAC;EACpEC,MAAM,EAAGC,KAAqB,IAAK,IAAIC,SAAS,CAACD,KAAK;AACxD,CAAC;AA0JD,OAAO,MAAMC,SAAS,SAASb,WAAW,CAAiB;EAkBzDc,WAAWA,CAACF,KAAqB,EAAE;IAAA,IAAAG,oBAAA;IACjC,KAAK,CAACH,KAAK,CAAC;IAAC,KAjBNJ,GAAG;IAAA,KACHQ,IAAI;IAAA,KAGbC,eAAe;IAAA,KAEfC,OAAO;IAAA,KAGPC,aAAa;IAAA,KAEbC,gBAAgB;IAAA,KAEhBC,YAAY,GAA2B,IAAI;IAUzC,IAAI,CAACb,GAAG,GAAGI,KAAK,CAACJ,GAAG;IACpB,IAAI,CAACQ,IAAI,GAAGJ,KAAK,CAACJ,GAAG;IAErB,IAAI,C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AAjG,cAAc,EAAayC,WAAW,EAAE,IAAI,CAACG,WAAW,CAAC;IACvE,OAAO,IAAIsD,KAAK,CAACH,KAAK,CAAC;EACzB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-source.js","names":[],"sources":["../../src/wip/data-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/** General data source class */\n// export abstract class DataSource {};\n// export type DataSourceMetadata = {};\n\n// ImageSource\n\n// Tile Source\n\n/** Data source that serves data by tile index *\nexport abstract class TileDataSource extends DataSource {};\n\n// Image Tile Data Source\n\nexport type ImageTileDataSourceCapabilities = {\n}\n\nexport type ImageTile = Record<string, any>;\n\nexport type FeatureInfo = {};\n\nexport abstract class ImageTileDataSource extends TileDataSource {\n source: ImageDataSource;\n \n constructor(source: ImageDataSource) {\n super();\n this.source = source;\n }\n\n getCapabilities(): Promise<ImageTileDataSourceCapabilities> {\n return this.source.getCapabilities();\n }\n\n getTile({x, y, z, width, height, layers, parameters}): Promise<ImageType> {\n const boundingBox = this.getBoundingBoxFromTileIndex(x, y, z);\n return this.source.getImage({boundingBox, width, height, layers, parameters});\n }\n\n getFeatureInfo(): FeatureInfo | null {\n return null;\n }\n\n getBoundingBoxFromTileIndex(x: number, y: number, z: number): [number, number, number, number] {\n return [0, 0, 1, 1];\n }\n}\n\n// Vector Tile Source\n\nexport type VectorTileDataSourceCapabilities = {\n // check tile.json\n}\n\nexport type VectorTile = Record<string, any>;\n\nexport abstract class VectorTileDataSource extends TileDataSource {\n abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;\n abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;\n}\n\n*/\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-wcs-capabilities.js","names":["XMLLoader","parseWCSCapabilities","text","options","_XMLLoader$parseTextS","parsedXML","parseTextSync","call","xml","removeNSPrefix","xmlCapabilities","Capabilities"],"sources":["../../../../src/wip/lib/wcs/parse-wcs-capabilities.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n/** All capabilities of a WCS service - response to a WCS `GetCapabilities` data structure extracted from XML */\nexport type WCSCapabilities = {\n serviceIdentification: {\n title: string;\n serviceTypeVersion: string;\n serviceType: string;\n };\n\n serviceProvider: {\n providerName: string;\n providerSite: string;\n serviceContact: {\n individualName: string;\n positionName: string;\n contactInfo: {\n address: {\n administrativeArea: string;\n city: string;\n country: string;\n deliveryPoint: string;\n electronicMailAddress: string;\n postalCode: string;\n };\n phone: {\n voice: string;\n };\n };\n };\n };\n\n operationsMetadata: {\n GetCapabilities: any;\n GetFeatureInfo: any;\n GetTile: any;\n };\n\n contents: {\n layers: {\n abstract: string;\n identifier: string;\n title: string;\n formats: string[];\n styles: {\n identifier: string;\n isDefault: string;\n title: string;\n abstract?: string;\n }[];\n bounds: {\n left: number;\n right: number;\n bottom: number;\n top: number;\n };\n tileMatrixSetLinks: {\n tileMatrixSet: string;\n }[];\n tileMatrixSets: {\n identifier: string;\n matrixIds: {\n identifier: string;\n matrixHeight: number;\n matrixWidth: number;\n scaleDenominator: number;\n tileWidth: number;\n tileHeight: number;\n topLeftCorner: {\n lon: number;\n lat: number;\n };\n }[];\n };\n }[];\n };\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWCSCapabilities(text: string, options): WCSCapabilities {\n const parsedXML = XMLLoader.parseTextSync?.(text, {...options, xml: {...options?.xml, removeNSPrefix: true}});\n const xmlCapabilities: any = parsedXML.Capabilities || parsedXML;\n return xmlCapabilities;\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAkFzC,OAAO,SAASC,oBAAoBA,CAACC,IAAY,EAAEC,OAAO,EAAmB;EAAA,IAAAC,qBAAA;EAC3E,MAAMC,SAAS,IAAAD,qBAAA,GAAGJ,SAAS,CAACM,aAAa,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,SAAS,EAAiBE,IAAI,EAAE;IAAC,GAAGC,OAAO;IAAEK,GAAG,EAAE;MAAC,IAAGL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,GAAG;MAAEC,cAAc,EAAE;IAAI;EAAC,CAAC,CAAC;EAC7G,MAAMC,eAAoB,GAAGL,SAAS,CAACM,YAAY,IAAIN,SAAS;EAChE,OAAOK,eAAe;AACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-wfs-capabilities.js","names":["XMLLoader","parseWFSCapabilities","text","options","_XMLLoader$parseTextS","parsedXML","parseTextSync","call","xml","removeNSPrefix","uncapitalizeKeys","xmlCapabilities","Capabilities"],"sources":["../../../../src/wip/lib/wfs/parse-wfs-capabilities.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n/** All capabilities of a WFS service - response to a WFS `GetCapabilities` data structure extracted from XML */\nexport type WFSCapabilities = {\n serviceIdentification: {\n title: string;\n serviceTypeVersion: string;\n serviceType: string;\n };\n\n serviceProvider: {\n providerName: string;\n providerSite: string;\n serviceContact: {\n individualName: string;\n positionName: string;\n contactInfo: {\n address: {\n administrativeArea: string;\n city: string;\n country: string;\n deliveryPoint: string;\n electronicMailAddress: string;\n postalCode: string;\n };\n phone: {\n voice: string;\n };\n };\n };\n };\n\n operationsMetadata: {\n GetCapabilities: any;\n GetFeatureInfo: any;\n GetTile: any;\n };\n\n contents: {\n layers: {\n abstract: string;\n identifier: string;\n title: string;\n formats: string[];\n styles: {\n identifier: string;\n isDefault: string;\n title: string;\n abstract?: string;\n }[];\n bounds: {\n left: number;\n right: number;\n bottom: number;\n top: number;\n };\n tileMatrixSetLinks: {\n tileMatrixSet: string;\n }[];\n tileMatrixSets: {\n identifier: string;\n matrixIds: {\n identifier: string;\n matrixHeight: number;\n matrixWidth: number;\n scaleDenominator: number;\n tileWidth: number;\n tileHeight: number;\n topLeftCorner: {\n lon: number;\n lat: number;\n };\n }[];\n };\n }[];\n };\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWFSCapabilities(text: string, options): WFSCapabilities {\n const parsedXML = XMLLoader.parseTextSync?.(text, {...options, xml: {\n ...options?.xml, \n removeNSPrefix: true,\n uncapitalizeKeys: true\n }});\n\n const xmlCapabilities: any = parsedXML.Capabilities || parsedXML;\n return xmlCapabilities;\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAkFzC,OAAO,SAASC,oBAAoBA,CAACC,IAAY,EAAEC,OAAO,EAAmB;EAAA,IAAAC,qBAAA;EAC3E,MAAMC,SAAS,IAAAD,qBAAA,GAAGJ,SAAS,CAACM,aAAa,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,SAAS,EAAiBE,IAAI,EAAE;IAAC,GAAGC,OAAO;IAAEK,GAAG,EAAE;MAClE,IAAGL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,GAAG;MACfC,cAAc,EAAE,IAAI;MACpBC,gBAAgB,EAAE;IACpB;EAAC,CAAC,CAAC;EAEH,MAAMC,eAAoB,GAAGN,SAAS,CAACO,YAAY,IAAIP,SAAS;EAChE,OAAOM,eAAe;AACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-wfs.js","names":["XMLLoader","parseWFSCapabilities","text","options","_options","_XMLLoader$parseTextS","xml","removeNSPrefix","parsedXML","parseTextSync","call","xmlCapabilities","Capabilities","uncapitalizeKeys","object","newObject","key","value","Object","entries","uncapitalize","str","charAt","toLowerCase","slice"],"sources":["../../../../src/wip/lib/wfs/parse-wfs.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\nexport type WFSCapabilities = {};\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWFSCapabilities(text: string, options): WFSCapabilities {\n // Remove namespaces in XML\n options = {...options, xml: {...options?.xml, removeNSPrefix: true}};\n const parsedXML = XMLLoader.parseTextSync?.(text, options);\n const xmlCapabilities: any = parsedXML.Capabilities || parsedXML;\n return uncapitalizeKeys(xmlCapabilities);\n}\n\n/** Uncapitalize all keys of an object */\nfunction uncapitalizeKeys(object: any): any {\n if (object && typeof object === 'object') {\n const newObject = {};\n for (const [key, value] of Object.entries(object)) {\n newObject[uncapitalize(key)] = uncapitalizeKeys(value);\n }\n return newObject;\n }\n return object;\n}\n\n/** Uncapitalize first letter of a string */\nfunction uncapitalize(str: string): string {\n return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAQzC,OAAO,SAASC,oBAAoBA,CAACC,IAAY,EAAEC,OAAO,EAAmB;EAAA,IAAAC,QAAA,EAAAC,qBAAA;EAE3EF,OAAO,GAAG;IAAC,GAAGA,OAAO;IAAEG,GAAG,EAAE;MAAC,KAAAF,QAAA,GAAGD,OAAO,cAAAC,QAAA,uBAAPA,QAAA,CAASE,GAAG;MAAEC,cAAc,EAAE;IAAI;EAAC,CAAC;EACpE,MAAMC,SAAS,IAAAH,qBAAA,GAAGL,SAAS,CAACS,aAAa,cAAAJ,qBAAA,uBAAvBA,qBAAA,CAAAK,IAAA,CAAAV,SAAS,EAAiBE,IAAI,EAAEC,OAAO,CAAC;EAC1D,MAAMQ,eAAoB,GAAGH,SAAS,CAACI,YAAY,IAAIJ,SAAS;EAChE,OAAOK,gBAAgB,CAACF,eAAe,CAAC;AAC1C;AAGA,SAASE,gBAAgBA,CAACC,MAAW,EAAO;EAC1C,IAAIA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACxC,MAAMC,SAAS,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,MAAM,CAAC,EAAE;MACjDC,SAAS,CAACK,YAAY,CAACJ,GAAG,CAAC,CAAC,GAAGH,gBAAgB,CAACI,KAAK,CAAC;IACxD;IACA,OAAOF,SAAS;EAClB;EACA,OAAOD,MAAM;AACf;AAGA,SAASM,YAAYA,CAACC,GAAW,EAAU;EACzC,OAAO,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,GAAG,CAACG,KAAK,CAAC,CAAC,CAAC,GAAGH,GAAG;AACnF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-wmts-capabilities.js","names":["XMLLoader","parseWMTSCapabilities","text","options","_XMLLoader$parseTextS","parsedXML","parseTextSync","call","xml","removeNSPrefix","uncapitalizeKeys","xmlCapabilities","Capabilities"],"sources":["../../../../src/wip/lib/wmts/parse-wmts-capabilities.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n\n/** All capabilities of a WMTS service - response to a WMTS `GetCapabilities` data structure extracted from XML */\nexport type WMTSCapabilities = {\n serviceIdentification: {\n title: string;\n serviceTypeVersion: string;\n serviceType: string;\n };\n\n serviceProvider: {\n providerName: string;\n providerSite: string;\n serviceContact: {\n individualName: string;\n positionName: string;\n contactInfo: {\n address: {\n administrativeArea: string;\n city: string;\n country: string;\n deliveryPoint: string;\n electronicMailAddress: string;\n postalCode: string;\n };\n phone: {\n voice: string;\n };\n };\n };\n };\n\n operationsMetadata: {\n GetCapabilities: any;\n GetFeatureInfo: any;\n GetTile: any;\n };\n\n contents: {\n layers: WMTSLayer[];\n };\n};\n\n/** A layer in WMTS */\nexport type WMTSLayer = {\n abstract: string;\n identifier: string;\n title: string;\n formats: string[];\n styles: {\n identifier: string;\n isDefault: string;\n title: string;\n abstract?: string;\n }[];\n bounds: {\n left: number;\n right: number;\n bottom: number;\n top: number;\n };\n tileMatrixSetLinks: {\n tileMatrixSet: string;\n }[];\n tileMatrixSets: WMTSTileMatrixSet[];\n};\n\n/** A zoom level in WMTS */\nexport type WMTSTileMatrixSet = {\n identifier: string;\n matrixIds: {\n identifier: string;\n matrixHeight: number;\n matrixWidth: number;\n scaleDenominator: number;\n tileWidth: number;\n tileHeight: number;\n topLeftCorner: {\n lon: number;\n lat: number;\n };\n };\n}\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMTSCapabilities(text: string, options): WMTSCapabilities {\n const parsedXML = XMLLoader.parseTextSync?.(text, {...options, xml: {\n ...options?.xml, \n removeNSPrefix: true,\n uncapitalizeKeys: true\n }});\n\n const xmlCapabilities: any = parsedXML.Capabilities || parsedXML;\n return xmlCapabilities;\n}\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\n// export function parseWMTSCapabilities(text: string, options): WMTSCapabilities {\n// const parsedXML = XMLLoader.parseTextSync(text, options);\n// const xmlCapabilities: any =\n// parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;\n// return extractCapabilities(xmlCapabilities);\n// }\n\n/** Extract typed capability data from XML */\n// function extractCapabilities(xml: any): WMTSCapabilities {\n// const capabilities: WMTSCapabilities = {\n// name: xml.Service?.Name || 'unnamed',\n// title: xml.Service?.Title,\n// keywords: [],\n// requests: {},\n// layer: extractLayer(xml.Capability?.Layer),\n// raw: xml\n// };\n\n// for (const keyword of xml.Service?.KeywordList?.Keyword || []) {\n// capabilities.keywords.push(keyword);\n// }\n\n// for (const [name, xmlRequest] of Object.entries(xml.Capability?.Request || {})) {\n// capabilities.requests[name] = extractRequest(name, xmlRequest);\n// }\n\n// return capabilities;\n// }\n\n// /** Extract typed request data from XML */\n// function extractRequest(name: string, xmlRequest: any): WMSRequest {\n// const format: string | string[] = xmlRequest?.Format;\n// const mimeTypes: string[] = Array.isArray(format) ? format : [format];\n// return {name, mimeTypes};\n// }\n\n// /** Extract request data */\n// function extractLayer(xmlLayer: any): WMSLayer {\n// const layer: WMSLayer = {\n// name: xmlLayer?.Name,\n// title: xmlLayer?.Title,\n// srs: xmlLayer?.SRS || [],\n// layers: []\n// };\n\n// // Single layer is not represented as array in XML\n// const xmlLayers = getXMLArray(xmlLayer?.Layer);\n\n// for (const xmlSubLayer of xmlLayers) {\n// layer.layers?.push(extractLayer(xmlSubLayer));\n// }\n\n// return layer;\n// }\n\n// function getXMLArray(xmlValue: any) {\n// if (Array.isArray(xmlValue)) {\n// return xmlValue;\n// }\n// if (xmlValue) {\n// return [xmlValue];\n// }\n// return [];\n// }\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAyFzC,OAAO,SAASC,qBAAqBA,CAACC,IAAY,EAAEC,OAAO,EAAoB;EAAA,IAAAC,qBAAA;EAC7E,MAAMC,SAAS,IAAAD,qBAAA,GAAGJ,SAAS,CAACM,aAAa,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,SAAS,EAAiBE,IAAI,EAAE;IAAC,GAAGC,OAAO;IAAEK,GAAG,EAAE;MAClE,IAAGL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,GAAG;MACfC,cAAc,EAAE,IAAI;MACpBC,gBAAgB,EAAE;IACpB;EAAC,CAAC,CAAC;EAEH,MAAMC,eAAoB,GAAGN,SAAS,CAACO,YAAY,IAAIP,SAAS;EAChE,OAAOM,eAAe;AACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-wmts.js","names":["XMLLoader","parseWMTSCapabilities","text","options","_options","_XMLLoader$parseTextS","xml","removeNSPrefix","parsedXML","parseTextSync","call","xmlCapabilities","Capabilities","uncapitalizeKeys","object","newObject","key","value","Object","entries","uncapitalize","str","charAt","toLowerCase","slice"],"sources":["../../../../src/wip/lib/wmts/parse-wmts.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\nexport type WMTSCapabilities = {};\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMTSCapabilities(text: string, options): WMTSCapabilities {\n // Remove namespaces in XML\n options = {...options, xml: {...options?.xml, removeNSPrefix: true}};\n const parsedXML = XMLLoader.parseTextSync?.(text, options);\n const xmlCapabilities: any = parsedXML.Capabilities || parsedXML;\n return uncapitalizeKeys(xmlCapabilities);\n}\n\nfunction uncapitalizeKeys(object: any): any {\n if (object && typeof object === 'object') {\n const newObject = {};\n for (const [key, value] of Object.entries(object)) {\n newObject[uncapitalize(key)] = uncapitalizeKeys(value);\n }\n return newObject;\n }\n return object;\n}\n\n/**\n * Uncapitalize first letter of a string\n * @param {string} str\n * @returns {string}\n */\nfunction uncapitalize(str: string): string {\n return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAQzC,OAAO,SAASC,qBAAqBA,CAACC,IAAY,EAAEC,OAAO,EAAoB;EAAA,IAAAC,QAAA,EAAAC,qBAAA;EAE7EF,OAAO,GAAG;IAAC,GAAGA,OAAO;IAAEG,GAAG,EAAE;MAAC,KAAAF,QAAA,GAAGD,OAAO,cAAAC,QAAA,uBAAPA,QAAA,CAASE,GAAG;MAAEC,cAAc,EAAE;IAAI;EAAC,CAAC;EACpE,MAAMC,SAAS,IAAAH,qBAAA,GAAGL,SAAS,CAACS,aAAa,cAAAJ,qBAAA,uBAAvBA,qBAAA,CAAAK,IAAA,CAAAV,SAAS,EAAiBE,IAAI,EAAEC,OAAO,CAAC;EAC1D,MAAMQ,eAAoB,GAAGH,SAAS,CAACI,YAAY,IAAIJ,SAAS;EAChE,OAAOK,gBAAgB,CAACF,eAAe,CAAC;AAC1C;AAEA,SAASE,gBAAgBA,CAACC,MAAW,EAAO;EAC1C,IAAIA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACxC,MAAMC,SAAS,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,MAAM,CAAC,EAAE;MACjDC,SAAS,CAACK,YAAY,CAACJ,GAAG,CAAC,CAAC,GAAGH,gBAAgB,CAACI,KAAK,CAAC;IACxD;IACA,OAAOF,SAAS;EAClB;EACA,OAAOD,MAAM;AACf;AAOA,SAASM,YAAYA,CAACC,GAAW,EAAU;EACzC,OAAO,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,GAAG,CAACG,KAAK,CAAC,CAAC,CAAC,GAAGH,GAAG;AACnF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"arcgis-feature-service.js","names":["ArcGISFeatureService","constructor","props","url","loadOptions","fetch","metadataURL","options","getUrl","exportImageURL","boundingBox","path"],"sources":["../../../src/wip/services/arcgis-feature-service.ts"],"sourcesContent":["// @ts-nocheck\n\nimport {LoaderOptions} from '@loaders.gl/loader-utils';\n// import {GeoJSONLoader} from '@loaders.gl/geojson';\n\ntype FetchLike = (url: string, options?: RequestInit) => Promise<Response>;\n\nexport type ArcGISImageServiceQueryOptions = {\n returnGeometry: boolean;\n where: '1%3D1';\n outSR: 4326;\n outFields: string | '*';\n inSR: 4326;\n geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`;\n geometryType: 'esriGeometryEnvelope'; // TODO - look up valid values in Esri docs\n spatialRel: 'esriSpatialRelIntersects'; // TODO - look up valid values in Esri docs\n geometryPrecision: number; // TODO - look up valid values in Esri docs\n resultType: 'tile'; // TODO - look up valid values in Esri docs\n f?: 'geojson'; // TODO - look up valid values in Esri docs\n}\n\n// const DEFAULT_QUERY_OPTIONS: Required<ArcGISImageServiceQueryOptions> = {\n// returnGeometry:true,\n// where: '1%3D1',\n// outSR: 4326,\n// outFields: '*',\n// inSR: 4326,\n// geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`,\n// geometryType: 'esriGeometryEnvelope',\n// spatialRel: 'esriSpatialRelIntersects',\n// geometryPrecision: 6,\n// resultType: 'tile',\n// f: 'geojson'\n// };\n\nexport type ArcGISFeatureServiceProps = ArcGISImageServiceQueryOptions & {\n url: string;\n loadOptions?: LoaderOptions;\n fetch?: typeof fetch | FetchLike;\n};\n\nexport class ArcGISFeatureService {\n url: string;\n loadOptions: LoaderOptions;\n fetch: typeof fetch | FetchLike;\n\n constructor(props: ArcGISFeatureServiceProps) {\n this.url = props.url;\n this.loadOptions = props.loadOptions || {};\n this.fetch = props.fetch || fetch;\n }\n\n // URL creators\n\n metadataURL(options: {parameters?: Record<string, unknown>}): string {\n return this.getUrl({...options});\n }\n\n /** \n * Form a URL to an ESRI FeatureServer\n// https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?\n// returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&\n// geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`\n */\n exportImageURL(options: {\n boundingBox: [number, number, number, number];\n boundingBoxSR?: string;\n width: number;\n height: number;\n imageSR?: string;\n time?: never;\n f?: 'geojson';\n resultType?: 'tile';\n noData?: never;\n noDataInterpretation?: 'esriNoDataMatchAny';\n interpolation?: '+RSP_NearestNeighbor';\n compression?: never\n compressionQuality?: never;\n bandIds?: never;\n mosaicRule?: never;\n renderingRule?: never;\n f?: 'image';\n }): string {\n const {boundingBox} = options;\n // const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;\n // const size = `size=${width},${height}`\n return this.getUrl({path: 'exportImage', });\n }\n}\n"],"mappings":"AAyCA,OAAO,MAAMA,oBAAoB,CAAC;EAKhCC,WAAWA,CAACC,KAAgC,EAAE;IAAA,KAJ9CC,GAAG;IAAA,KACHC,WAAW;IAAA,KACXC,KAAK;IAGH,IAAI,CAACF,GAAG,GAAGD,KAAK,CAACC,GAAG;IACpB,IAAI,CAACC,WAAW,GAAGF,KAAK,CAACE,WAAW,IAAI,CAAC,CAAC;IAC1C,IAAI,CAACC,KAAK,GAAGH,KAAK,CAACG,KAAK,IAAIA,KAAK;EACnC;EAIAC,WAAWA,CAACC,OAA+C,EAAU;IACnE,OAAO,IAAI,CAACC,MAAM,CAAC;MAAC,GAAGD;IAAO,CAAC,CAAC;EAClC;EAQAE,cAAcA,CAACF,OAkBd,EAAU;IACT,MAAM;MAACG;IAAW,CAAC,GAAGH,OAAO;IAG7B,OAAO,IAAI,CAACC,MAAM,CAAC;MAACG,IAAI,EAAE;IAAe,CAAC,CAAC;EAC7C;AACF"}
@@ -1,348 +0,0 @@
1
- // loaders.gl, MIT license
2
-
3
- /* eslint-disable camelcase */
4
-
5
- import type {ImageType} from '@loaders.gl/images';
6
- import {ImageLoader} from '@loaders.gl/images';
7
-
8
- import type {TileSourceMetadata, GetTileParameters} from '../sources/tile-source';
9
- import {TileSource} from '../sources/tile-source';
10
- import {ImageServiceProps, getFetchFunction, mergeImageServiceProps} from '../sources/tile-service';
11
-
12
- import type {WMTSCapabilities} from '../../wmts/wmts-types';
13
- import {WMTSCapabilitiesLoader} from '../../../wmts-capabilities-loader';
14
- // import {GMLLoader} from '../../../wip/wms-feature-info-loader';
15
- import {WMSErrorLoader as WMTSErrorLoader} from '../../../wms-error-loader';
16
-
17
- type WMTSCommonParameters = {
18
- /** In case the endpoint supports multiple services */
19
- service?: 'WMTS';
20
- /** In case the endpoint supports multiple WMTS versions */
21
- version?: '1.0.0' | '1.3.0';
22
- };
23
-
24
- export type WMTSGetCapabilitiesParameters = WMTSCommonParameters & {
25
- /** Request type */
26
- request?: 'GetCapabilities';
27
- };
28
-
29
- export type WMTSGetTileParameters = WMTSCommonParameters & {
30
- /** Request type */
31
- request?: 'GetTile';
32
- /** requested format for the return image */
33
- format?: 'image/png';
34
- /** Styling */
35
- style?: string;
36
- /** Layer to render */
37
- layer: string;
38
- /** Tiling "Schema" (e.g. 'google_maps') */
39
- tileMatrixSet: string;
40
- /** Tile zoom level, named */
41
- tileMatrix: string | number;
42
- /** tile x coordinate */
43
- tileCol: number;
44
- /** tile y coordinate */
45
- tileRow: number;
46
- };
47
-
48
- export type WMTSGetFeatureInfoParameters = WMTSCommonParameters & {
49
- /** Request type */
50
- request?: 'GetFeatureInfo';
51
- /** Layer to render */
52
- layer: string[];
53
- /** Styling */
54
- style?: string;
55
-
56
- /** x coordinate for the feature info request */
57
- x: number;
58
- /** y coordinate for the feature info request */
59
- y: number;
60
- /** list of layer to query (could be different from rendered layer) */
61
- query_layer: string[];
62
- /** MIME type of returned feature info */
63
- info_format?: 'text/plain' | 'application/vnd.ogc.gml';
64
- };
65
-
66
- export type WMTSDescribeLayerParameters = WMTSCommonParameters & {
67
- /** Request type */
68
- request?: 'DescribeLayer';
69
- };
70
-
71
- export type WMTSGetLegendGraphicParameters = WMTSCommonParameters & {
72
- /** Request type */
73
- request?: 'GetLegendGraphic';
74
- };
75
-
76
- type WMTSServiceProps = {
77
- url: string;
78
- attribution: string;
79
- layer: string;
80
- matrixSet: string;
81
- style: string;
82
- format: string;
83
- requestFormat: string;
84
- };
85
-
86
- /**
87
- * The WMTSService class provides
88
- * - provides type safe methods to form URLs to a WMTS service
89
- * - provides type safe methods to query and parse results (and errors) from a WMTS service
90
- * - implements the ImageService interface
91
- * @note Only the URL parameter conversion is supported. XML posts are not supported.
92
- */
93
- export class WMTSService extends TileSource {
94
- static type: 'wms' = 'wms';
95
- static testURL = (url: string): boolean => url.toLowerCase().includes('wms');
96
-
97
- props: Required<ImageServiceProps>;
98
- fetch: (url: string, options?: RequestInit) => Promise<Response>;
99
- capabilities: WMTSCapabilities | null = null;
100
-
101
- /** A list of loaders used by the WMTSService methods */
102
- readonly loaders = [
103
- ImageLoader,
104
- WMTSErrorLoader,
105
- WMTSCapabilitiesLoader,
106
- GMLLoader
107
- ];
108
-
109
- readonly requestEncoding = 'kvp';
110
-
111
- /** Create a WMTSService */
112
- constructor(props: ImageServiceProps) {
113
- super();
114
- this.props = mergeImageServiceProps(props);
115
- this.fetch = getFetchFunction(this.props);
116
- this.props.loadOptions = {
117
- ...this.props.loadOptions,
118
- // We want error responses to throw exceptions, the WMTSErrorLoader can do this
119
- wms: {...this.props.loadOptions?.wms, throwOnError: true}
120
- };
121
- }
122
-
123
- // TileSource implementation
124
- getMetadata(): Promise<TileSourceMetadata> {
125
- return this.getCapabilities();
126
- }
127
-
128
- getTile(parameters: GetTileParameters): Promise<ImageType> {
129
- const wmtsParameters: WMTSGetTileParameters = {
130
- layer: parameters.layer,
131
- tileMatrix: String(parameters.zoom),
132
- tileCol: parameters.x,
133
- tileRow: parameters.y
134
- };
135
- return this.getTile_(wmtsParameters);
136
- }
137
-
138
- // WMTS Service API Stubs
139
-
140
- /** Get Capabilities */
141
- async getCapabilities(
142
- wmtsParameters?: WMTSGetCapabilitiesParameters,
143
- vendorParameters?: Record<string, unknown>
144
- ): Promise<WMTSCapabilities> {
145
- const url = this.getCapabilitiesURL(wmtsParameters, vendorParameters);
146
- const response = await this.fetch(url);
147
- const arrayBuffer = await response.arrayBuffer();
148
- this._checkResponse(response, arrayBuffer);
149
- const capabilities = await WMTSCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);
150
- this.capabilities = capabilities;
151
- return capabilities;
152
- }
153
-
154
- /** Get a map image */
155
- async getTile_(
156
- options: WMTSGetTileParameters,
157
- vendorParameters?: Record<string, unknown>
158
- ): Promise<ImageType> {
159
- const url = this.getTileURL(options, vendorParameters);
160
- const response = await this.fetch(url);
161
- const arrayBuffer = await response.arrayBuffer();
162
- this._checkResponse(response, arrayBuffer);
163
- try {
164
- return await ImageLoader.parse(arrayBuffer, this.props.loadOptions);
165
- } catch {
166
- throw this._parseError(arrayBuffer);
167
- }
168
- }
169
-
170
- /** Get Feature Info for a coordinate */
171
- async getFeatureInfo(
172
- options: WMTSGetFeatureInfoParameters,
173
- vendorParameters?: Record<string, unknown>
174
- ): Promise<WMTSFeatureInfo> {
175
- const url = this.getFeatureInfoURL(options, vendorParameters);
176
- const response = await this.fetch(url);
177
- const arrayBuffer = await response.arrayBuffer();
178
- this._checkResponse(response, arrayBuffer);
179
- return await GMLLoader.parse(arrayBuffer, this.props.loadOptions);
180
- }
181
-
182
- /** Get Feature Info for a coordinate */
183
- async getFeatureInfoText(
184
- options: WMTSGetFeatureInfoParameters,
185
- vendorParameters?: Record<string, unknown>
186
- ): Promise<string> {
187
- options = {...options, info_format: 'text/plain'};
188
- const url = this.getFeatureInfoURL(options, vendorParameters);
189
- const response = await this.fetch(url);
190
- const arrayBuffer = await response.arrayBuffer();
191
- this._checkResponse(response, arrayBuffer);
192
- return new TextDecoder().decode(arrayBuffer);
193
- }
194
-
195
- /** Get an image with a semantic legend */
196
- async getLegendGraphic(
197
- options: WMTSGetLegendGraphicParameters,
198
- vendorParameters?: Record<string, unknown>
199
- ): Promise<ImageType> {
200
- const url = this.getLegendGraphicURL(options, vendorParameters);
201
- const response = await this.fetch(url);
202
- const arrayBuffer = await response.arrayBuffer();
203
- this._checkResponse(response, arrayBuffer);
204
- try {
205
- return await ImageLoader.parse(arrayBuffer, this.props.loadOptions);
206
- } catch {
207
- throw this._parseError(arrayBuffer);
208
- }
209
- }
210
-
211
- // Typed URL creators
212
- // For applications that want full control of fetching and parsing
213
-
214
- /** Generate a URL for the GetCapabilities request */
215
- getCapabilitiesURL(
216
- wmtsParameters?: WMTSGetCapabilitiesParameters,
217
- vendorParameters?: Record<string, unknown>
218
- ): string {
219
- const options: Required<WMTSGetCapabilitiesParameters> = {
220
- service: 'WMTS',
221
- version: '1.0.0',
222
- request: 'GetCapabilities',
223
- ...wmtsParameters,
224
- ...vendorParameters
225
- };
226
- const url = `${this.props.url}/WMTSCapabilities.xml`;
227
- return this._getWMTSUrl(options, vendorParameters);
228
- }
229
-
230
- /** Generate a URL for the GetTile request */
231
- getTileURL(
232
- wmtsParameters: WMTSGetTileParameters,
233
- vendorParameters?: Record<string, unknown>
234
- ): string {
235
- const options: Required<WMTSGetTileParameters> = {
236
- service: 'WMTS',
237
- version: '1.0.0',
238
- request: 'GetTile',
239
- style: undefined,
240
- format: 'image/png',
241
- // tileMatrixSet
242
- // tileMatrix
243
- // tileCol
244
- // tileRow
245
- ...wmtsParameters,
246
- ...vendorParameters
247
- };
248
- const {version, layer = 'default', style = 'default', tileMatrixSet = 'default', tileMatrix, tileCol, tileRow} = options;
249
- const extension = options.format.replace('image/', '');
250
- const url = `${this.props.url}/tile/${version}/${layer}/${style}/${tileMatrixSet}/${tileMatrix}/${tileCol}/${tileRow}.${extension}`;
251
- return this._getWMTSUrl(options, vendorParameters);
252
- }
253
-
254
- /** Generate a URL for the GetFeatureInfo request */
255
- getFeatureInfoURL(
256
- wmtsParameters: WMTSGetFeatureInfoParameters,
257
- vendorParameters?: Record<string, unknown>
258
- ): string {
259
- const options: Required<WMTSGetFeatureInfoParameters> = {
260
- service: 'WMTS',
261
- version: '1.0.0',
262
- request: 'GetFeatureInfo',
263
- // layer: [],
264
- // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
265
- // width: 1200,
266
- // height: 900,
267
- // x: undefined!,
268
- // y: undefined!,
269
- // query_layer: [],
270
- // srs: 'EPSG:4326',
271
- // format: 'image/png',
272
- info_format: 'text/plain',
273
- style: undefined!,
274
- ...wmtsParameters,
275
- ...vendorParameters
276
- };
277
- return this._getWMTSUrl(options, vendorParameters);
278
- }
279
-
280
- getLegendGraphicURL(
281
- wmtsParameters: WMTSGetLegendGraphicParameters,
282
- vendorParameters?: Record<string, unknown>
283
- ): string {
284
- const options: Required<WMTSGetLegendGraphicParameters> = {
285
- service: 'WMTS',
286
- version: '1.0.0',
287
- request: 'GetLegendGraphic',
288
- ...wmtsParameters,
289
- ...vendorParameters
290
- };
291
- return this._getWMTSUrl(options, vendorParameters);
292
- }
293
-
294
- // INTERNAL METHODS
295
-
296
- /**
297
- * @note case _getWMTSUrl may need to be overridden to handle certain backends?
298
- * */
299
- protected _getWMTSUrl(
300
- options: Record<string, unknown>,
301
- vendorParameters?: Record<string, unknown>
302
- ): string {
303
- switch (this.requestEncoding) {
304
- case 'kvp':
305
- return this._getWMTSUrlKVP(options, vendorParameters);
306
- // case 'REST':
307
- // case 'SOAP':
308
- default:
309
- throw new Error(this.requestEncoding);
310
- }
311
- }
312
-
313
- /**
314
- * @note case _getWMTSUrl may need to be overridden to handle certain backends?
315
- * */
316
- protected _getWMTSUrlKVP(
317
- options: Record<string, unknown>,
318
- vendorParameters?: Record<string, unknown>
319
- ): string {
320
- let url = this.props.url;
321
- let first = true;
322
- for (const [key, value] of Object.entries(options)) {
323
- url += first ? '?' : '&';
324
- first = false;
325
- if (Array.isArray(value)) {
326
- url += `${key.toUpperCase()}=${value.join(',')}`;
327
- } else {
328
- url += `${key.toUpperCase()}=${value ? String(value) : ''}`;
329
- }
330
- }
331
- return encodeURI(url);
332
- }
333
-
334
- /** Checks for and parses a WMTS XML formatted ServiceError and throws an exception */
335
- protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {
336
- const contentType = response.headers['content-type'];
337
- if (!response.ok || WMTSErrorLoader.mimeTypes.includes(contentType)) {
338
- const error = WMTSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
339
- throw new Error(error);
340
- }
341
- }
342
-
343
- /** Error situation detected */
344
- protected _parseError(arrayBuffer: ArrayBuffer): Error {
345
- const error = WMTSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
346
- return new Error(error);
347
- }
348
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"wcs-capabilities-loader.js","names":["parseWCSCapabilities","VERSION","WCSCapabilitiesLoader","id","name","module","version","worker","extensions","mimeTypes","testText","testXMLFile","options","wms","parse","arrayBuffer","TextDecoder","decode","parseTextSync","text","startsWith","_typecheckWFSCapabilitiesLoader"],"sources":["../../src/wip/wcs-capabilities-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {WCSCapabilities} from './lib/wcs/parse-wcs-capabilities';\nimport {parseWCSCapabilities} from './lib/wcs/parse-wcs-capabilities';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport {WCSCapabilities};\n\nexport type WCSLoaderOptions = LoaderOptions & {\n wcs?: {};\n};\n\n/**\n * Loader for the response to the WCS GetCapability request\n */\nexport const WCSCapabilitiesLoader = {\n id: 'wcs-capabilities',\n name: 'WFS Capabilities',\n\n module: 'wms',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/vnd.ogc.wcs_xml', 'application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n wms: {}\n },\n parse: async (arrayBuffer: ArrayBuffer, options?: WCSLoaderOptions) =>\n parseWCSCapabilities(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: WCSLoaderOptions) => parseWCSCapabilities(text, options)\n};\n\nfunction testXMLFile(text: string): boolean {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n\nexport const _typecheckWFSCapabilitiesLoader: LoaderWithParser = WCSCapabilitiesLoader;\n"],"mappings":"SAIQA,oBAAoB;AAI5B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAW3E,OAAO,MAAMC,qBAAqB,GAAG;EACnCC,EAAE,EAAE,kBAAkB;EACtBC,IAAI,EAAE,kBAAkB;EAExBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,6BAA6B,EAAE,iBAAiB,EAAE,UAAU,CAAC;EACzEC,QAAQ,EAAEC,WAAW;EACrBC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;EACR,CAAC;EACDC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEH,OAA0B,KAChEZ,oBAAoB,CAAC,IAAIgB,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEH,OAAO,CAAC;EACtEM,aAAa,EAAEA,CAACC,IAAY,EAAEP,OAA0B,KAAKZ,oBAAoB,CAACmB,IAAI,EAAEP,OAAO;AACjG,CAAC;AAED,SAASD,WAAWA,CAACQ,IAAY,EAAW;EAE1C,OAAOA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC;AACjC;AAEA,OAAO,MAAMC,+BAAiD,GAAGnB,qBAAqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wfs-capabilities-loader.js","names":["parseWFSCapabilities","VERSION","WFSCapabilitiesLoader","id","name","module","version","worker","extensions","mimeTypes","testText","testXMLFile","options","wfs","parse","arrayBuffer","TextDecoder","decode","parseTextSync","text","startsWith","_typecheckWFSCapabilitiesLoader"],"sources":["../../src/wip/wfs-capabilities-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {WFSCapabilities} from './lib/wfs/parse-wfs-capabilities';\nimport {parseWFSCapabilities} from './lib/wfs/parse-wfs-capabilities';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type {WFSCapabilities};\n\nexport type WFSLoaderOptions = LoaderOptions & {\n wfs?: {};\n};\n\n/**\n * Loader for the response to the WFS GetCapability request\n */\nexport const WFSCapabilitiesLoader: LoaderWithParser<WFSCapabilities, never, WFSLoaderOptions> = {\n id: 'wfs-capabilities',\n name: 'WFS Capabilities',\n\n module: 'wms',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/vnd.ogc.wfs_xml', 'application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n wfs: {}\n },\n parse: async (arrayBuffer: ArrayBuffer, options?: WFSLoaderOptions) =>\n parseWFSCapabilities(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: WFSLoaderOptions) => parseWFSCapabilities(text, options)\n};\n\nfunction testXMLFile(text: string): boolean {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n\nexport const _typecheckWFSCapabilitiesLoader: LoaderWithParser = WFSCapabilitiesLoader;\n"],"mappings":"SAIQA,oBAAoB;AAI5B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAW3E,OAAO,MAAMC,qBAAiF,GAAG;EAC/FC,EAAE,EAAE,kBAAkB;EACtBC,IAAI,EAAE,kBAAkB;EAExBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,6BAA6B,EAAE,iBAAiB,EAAE,UAAU,CAAC;EACzEC,QAAQ,EAAEC,WAAW;EACrBC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;EACR,CAAC;EACDC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEH,OAA0B,KAChEZ,oBAAoB,CAAC,IAAIgB,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEH,OAAO,CAAC;EACtEM,aAAa,EAAEA,CAACC,IAAY,EAAEP,OAA0B,KAAKZ,oBAAoB,CAACmB,IAAI,EAAEP,OAAO;AACjG,CAAC;AAED,SAASD,WAAWA,CAACQ,IAAY,EAAW;EAE1C,OAAOA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC;AACjC;AAEA,OAAO,MAAMC,+BAAiD,GAAGnB,qBAAqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wms-feature-info-loader.js","names":["WMSCapabilitiesLoader","parseWMSFeatureInfo","WMSFeatureInfoLoader","id","name","parse","arrayBuffer","options","TextDecoder","decode","parseTextSync","text","_typecheckWMSFeatureInfoLoader"],"sources":["../../src/wip/wms-feature-info-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {XMLLoaderOptions} from '@loaders.gl/xml';\nimport {WMSCapabilitiesLoader} from '../wms-capabilities-loader';\n\nimport type {WMSFeatureInfo} from '../lib/parsers/wms/parse-wms-features';\nimport {parseWMSFeatureInfo} from '../lib/parsers/wms/parse-wms-features';\n\nexport {WMSFeatureInfo};\n\n/**\n * Loader for the response to the WMS GetFeatureInfo request\n */\n// @ts-expect-error\nexport const WMSFeatureInfoLoader: LoaderWithParser<WMSFeatureInfo, never, XMLLoaderOptions> = {\n ...WMSCapabilitiesLoader,\n\n id: 'wms-feature-info',\n name: 'WMS FeatureInfo',\n\n parse: async (arrayBuffer: ArrayBuffer, options?: XMLLoaderOptions) =>\n parseWMSFeatureInfo(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: XMLLoaderOptions) => parseWMSFeatureInfo(text, options)\n};\n\nexport const _typecheckWMSFeatureInfoLoader: LoaderWithParser = WMSFeatureInfoLoader;\n"],"mappings":"SAIQA,qBAAqB;AAAA,SAGrBC,mBAAmB;AAQ3B,OAAO,MAAMC,oBAA+E,GAAG;EAC7F,GAAGF,qBAAqB;EAExBG,EAAE,EAAE,kBAAkB;EACtBC,IAAI,EAAE,iBAAiB;EAEvBC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEC,OAA0B,KAChEN,mBAAmB,CAAC,IAAIO,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,WAAW,CAAC,EAAEC,OAAO,CAAC;EACrEG,aAAa,EAAEA,CAACC,IAAY,EAAEJ,OAA0B,KAAKN,mBAAmB,CAACU,IAAI,EAAEJ,OAAO;AAChG,CAAC;AAED,OAAO,MAAMK,8BAAgD,GAAGV,oBAAoB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wms-layer-description-loader.js","names":["WMSCapabilitiesLoader","parseWMSLayerDescription","WMSLayerDescriptionLoader","id","name","parse","arrayBuffer","options","TextDecoder","decode","parseTextSync","text","_typecheckWMSFeatureInfoLoader"],"sources":["../../src/wip/wms-layer-description-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {XMLLoaderOptions} from '@loaders.gl/xml';\nimport {WMSCapabilitiesLoader} from '../wms-capabilities-loader';\n\nimport type {WMSLayerDescription} from '../lib/parsers/wms/parse-wms-layer-description';\nimport {parseWMSLayerDescription} from '../lib/parsers/wms/parse-wms-layer-description';\n\nexport {WMSLayerDescription};\n\n/**\n * Loader for the response to the WMS DescribeLayer request\n */\nexport const WMSLayerDescriptionLoader = {\n ...WMSCapabilitiesLoader,\n\n id: 'wms-layer-description',\n name: 'WMS DescribeLayer',\n\n parse: async (arrayBuffer: ArrayBuffer, options?: XMLLoaderOptions) =>\n parseWMSLayerDescription(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: XMLLoaderOptions) => parseWMSLayerDescription(text, options)\n};\n\nexport const _typecheckWMSFeatureInfoLoader: LoaderWithParser = WMSLayerDescriptionLoader;\n"],"mappings":"SAIQA,qBAAqB;AAAA,SAGrBC,wBAAwB;AAOhC,OAAO,MAAMC,yBAAyB,GAAG;EACvC,GAAGF,qBAAqB;EAExBG,EAAE,EAAE,uBAAuB;EAC3BC,IAAI,EAAE,mBAAmB;EAEzBC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEC,OAA0B,KAChEN,wBAAwB,CAAC,IAAIO,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC1EG,aAAa,EAAEA,CAACC,IAAY,EAAEJ,OAA0B,KAAKN,wBAAwB,CAACU,IAAI,EAAEJ,OAAO;AACrG,CAAC;AAED,OAAO,MAAMK,8BAAgD,GAAGV,yBAAyB"}
@@ -1,47 +0,0 @@
1
- # WMSLayerDescriptionLoader
2
-
3
- <p class="badges">
4
- <img src="https://img.shields.io/badge/From-v3.3-blue.svg?style=flat-square" alt="From-v3.3" />
5
- <img src="https://img.shields.io/badge/-BETA-teal.svg" alt="BETA" />
6
- </p>
7
-
8
- The `WMSLayerDescriptionLoader` parses the XML-formatted response from the
9
- the [OGC](https://www.opengeospatial.org/) [WMS](https://www.ogc.org/standards/wms) (Web Map Service) standard `DescribeLayer` request into a typed JavaScript data structure.
10
-
11
- > Note that the WMS standard is rather verbose and the XML responses can contain many rarely used metadata fields, not all of which are extracted by this loader. If this is a problem, it is possible to use the `XMLLoader` directly though the result will be untyped and not normalized.
12
-
13
- | Loader | Characteristic |
14
- | --------------------- | ---------------------------------------------------- |
15
- | File Extension | `.xml` |
16
- | File Type | Text |
17
- | File Format | [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) |
18
- | Data Format | Data structure |
19
- | Decoder Type | Synchronous |
20
- | Worker Thread Support | No |
21
- | Streaming Support | No |
22
-
23
- ## Usage
24
-
25
- ```js
26
- import {WMSLayerDescriptionLoader} from '@loaders.gl/wms';
27
- import {load} from '@loaders.gl/core';
28
-
29
- // Form a WMS request
30
- const url = `${WMS_SERVICE_URL}?REQUEST=DescribeLayer&LAYER=...`;
31
-
32
- const data = await load(url, WMSLayerDescriptionLoader, options);
33
- ```
34
-
35
- ## Parsed Data Format
36
-
37
- ```typescript
38
- /** All capabilities of a WMS service. Typed data structure extracted from XML */
39
- export type WMSLayerDescription = {
40
- // TO BE DOCUMENTED
41
- }
42
- ```
43
-
44
- ## Options
45
-
46
- | Option | Type | Default | Description |
47
- | ------ | ---- | ------- | ----------- |
@@ -1 +0,0 @@
1
- {"version":3,"file":"wmts-capabilities-loader.js","names":["parseWMTSCapabilities","VERSION","WMTSCapabilitiesLoader","id","name","module","version","worker","extensions","mimeTypes","testText","testXMLFile","options","wms","parse","arrayBuffer","TextDecoder","decode","parseTextSync","text","startsWith","_typecheckWMTSCapabilitiesLoader"],"sources":["../../src/wip/wmts-capabilities-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {XMLLoaderOptions} from '@loaders.gl/xml';\n// import type {WMTSCapabilities} from './lib/wmts/parse-wmts-capabilities';\nimport {parseWMTSCapabilities} from './lib/wmts/parse-wmts-capabilities';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n// export type {WMTSCapabilities};\n\nexport type WMTSLoaderOptions = XMLLoaderOptions & {\n wmts?: {};\n};\n\n/**\n * Loader for the response to the WMTS GetCapability request\n */\nexport const WMTSCapabilitiesLoader = {\n id: 'wmts-capabilities',\n name: 'WMTS Capabilities',\n\n module: 'wms',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/vnd.ogc.wmts_xml', 'application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n wms: {}\n },\n parse: async (arrayBuffer: ArrayBuffer, options?: WMTSLoaderOptions) =>\n parseWMTSCapabilities(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: WMTSLoaderOptions) => parseWMTSCapabilities(text, options)\n};\n\nfunction testXMLFile(text: string): boolean {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n\nexport const _typecheckWMTSCapabilitiesLoader: LoaderWithParser = WMTSCapabilitiesLoader;\n"],"mappings":"SAKQA,qBAAqB;AAI7B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAW3E,OAAO,MAAMC,sBAAsB,GAAG;EACpCC,EAAE,EAAE,mBAAmB;EACvBC,IAAI,EAAE,mBAAmB;EAEzBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,8BAA8B,EAAE,iBAAiB,EAAE,UAAU,CAAC;EAC1EC,QAAQ,EAAEC,WAAW;EACrBC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;EACR,CAAC;EACDC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEH,OAA2B,KACjEZ,qBAAqB,CAAC,IAAIgB,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEH,OAAO,CAAC;EACvEM,aAAa,EAAEA,CAACC,IAAY,EAAEP,OAA2B,KAAKZ,qBAAqB,CAACmB,IAAI,EAAEP,OAAO;AACnG,CAAC;AAED,SAASD,WAAWA,CAACQ,IAAY,EAAW;EAE1C,OAAOA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC;AACjC;AAEA,OAAO,MAAMC,gCAAkD,GAAGnB,sBAAsB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wms-capabilities-loader.js","names":["parseWMSCapabilities","VERSION","WMSCapabilitiesLoader","id","name","module","version","worker","extensions","mimeTypes","testText","testXMLFile","options","wms","parse","arrayBuffer","TextDecoder","decode","parseTextSync","text","startsWith"],"sources":["../src/wms-capabilities-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {XMLLoaderOptions} from '@loaders.gl/xml';\nimport {WMSCapabilities, parseWMSCapabilities} from './lib/parsers/wms/parse-wms-capabilities';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n// Parsed data types\nexport type {\n WMSCapabilities,\n WMSLayer,\n WMSBoundingBox,\n WMSDimension,\n WMSRequest,\n WMSExceptions\n} from './lib/parsers/wms/parse-wms-capabilities';\n\nexport type WMSCapabilitiesLoaderOptions = XMLLoaderOptions & {\n wms?: {\n /** Add inherited layer information to sub layers */\n inheritedLayerProps?: boolean;\n /** Include the \"raw\" JSON (parsed but untyped, unprocessed XML). May contain additional fields */\n includeRawJSON?: boolean;\n /** Include the original XML document text. May contain additional information. */\n includeXMLText?: boolean;\n };\n};\n\n/**\n * Loader for the response to the WMS GetCapability request\n */\nexport const WMSCapabilitiesLoader: LoaderWithParser<\n WMSCapabilities,\n never,\n WMSCapabilitiesLoaderOptions\n> = {\n id: 'wms-capabilities',\n name: 'WMS Capabilities',\n\n module: 'wms',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/vnd.ogc.wms_xml', 'application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n wms: {}\n },\n parse: async (arrayBuffer: ArrayBuffer, options?: WMSCapabilitiesLoaderOptions) =>\n // TODO pass in XML options\n parseWMSCapabilities(new TextDecoder().decode(arrayBuffer), options?.wms),\n parseTextSync: (text: string, options?: WMSCapabilitiesLoaderOptions) =>\n // TODO pass in XML options\n parseWMSCapabilities(text, options?.wms)\n};\n\nfunction testXMLFile(text: string): boolean {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n"],"mappings":"SAMyBA,oBAAoB;AAI7C,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AA0B3E,OAAO,MAAMC,qBAIZ,GAAG;EACFC,EAAE,EAAE,kBAAkB;EACtBC,IAAI,EAAE,kBAAkB;EAExBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,6BAA6B,EAAE,iBAAiB,EAAE,UAAU,CAAC;EACzEC,QAAQ,EAAEC,WAAW;EACrBC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;EACR,CAAC;EACDC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEH,OAAsC,KAE5EZ,oBAAoB,CAAC,IAAIgB,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,GAAG,CAAC;EAC3EK,aAAa,EAAEA,CAACC,IAAY,EAAEP,OAAsC,KAElEZ,oBAAoB,CAACmB,IAAI,EAAEP,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,GAAG;AAC3C,CAAC;AAED,SAASF,WAAWA,CAACQ,IAAY,EAAW;EAE1C,OAAOA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC;AACjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wms-error-loader.js","names":["parseWMSError","VERSION","WMSErrorLoader","id","name","module","version","worker","extensions","mimeTypes","testText","testXMLFile","options","wms","throwOnError","parse","arrayBuffer","parseTextSync","TextDecoder","decode","parseSync","text","startsWith","wmsOptions","error","message","minimalErrors","Error"],"sources":["../src/wms-error-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseWMSError} from './lib/parsers/wms/parse-wms-error';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type WMSLoaderOptions = LoaderOptions & {\n wms?: {\n /** By default the error loader will throw an error with the parsed error message */\n throwOnError?: boolean;\n /** Do not add any text to errors */\n minimalErrors?: boolean;\n };\n};\n\n/**\n * Loader for the response to the WMS GetCapability request\n */\nexport const WMSErrorLoader: LoaderWithParser<string, never, WMSLoaderOptions> = {\n id: 'wms-error',\n name: 'WMS Error',\n\n module: 'wms',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/vnd.ogc.se_xml', 'application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n wms: {\n throwOnError: false\n }\n },\n parse: async (arrayBuffer: ArrayBuffer, options?: WMSLoaderOptions): Promise<string> =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseSync: (arrayBuffer: ArrayBuffer, options?: WMSLoaderOptions): string =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: WMSLoaderOptions): string => parseTextSync(text, options)\n};\n\nfunction testXMLFile(text: string): boolean {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n\nfunction parseTextSync(text: string, options?: WMSLoaderOptions): string {\n const wmsOptions: WMSLoaderOptions['wms'] = {...WMSErrorLoader.options.wms, ...options?.wms};\n const error = parseWMSError(text, wmsOptions);\n const message = wmsOptions.minimalErrors ? error : `WMS Service error: ${error}`;\n if (wmsOptions.throwOnError) {\n throw new Error(message);\n }\n return message;\n}\n"],"mappings":"SAKQA,aAAa;AAIrB,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,OAAO,MAAMC,cAAiE,GAAG;EAC/EC,EAAE,EAAE,WAAW;EACfC,IAAI,EAAE,WAAW;EAEjBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,4BAA4B,EAAE,iBAAiB,EAAE,UAAU,CAAC;EACxEC,QAAQ,EAAEC,WAAW;EACrBC,OAAO,EAAE;IACPC,GAAG,EAAE;MACHC,YAAY,EAAE;IAChB;EACF,CAAC;EACDC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEJ,OAA0B,KAChEK,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,WAAW,CAAC,EAAEJ,OAAO,CAAC;EAC/DQ,SAAS,EAAEA,CAACJ,WAAwB,EAAEJ,OAA0B,KAC9DK,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CA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