@loaders.gl/wms 4.0.0-alpha.9 → 4.0.0-beta.2
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.
- package/dist/csw-capabilities-loader.d.ts +1 -17
- package/dist/csw-capabilities-loader.d.ts.map +1 -1
- package/dist/csw-domain-loader.d.ts +1 -17
- package/dist/csw-domain-loader.d.ts.map +1 -1
- package/dist/csw-records-loader.d.ts +1 -1
- package/dist/csw-records-loader.d.ts.map +1 -1
- package/dist/dist.min.js +187 -161
- package/dist/es5/csw-capabilities-loader.js +2 -4
- package/dist/es5/csw-capabilities-loader.js.map +1 -1
- package/dist/es5/csw-domain-loader.js +2 -4
- package/dist/es5/csw-domain-loader.js.map +1 -1
- package/dist/es5/csw-records-loader.js +2 -2
- package/dist/es5/csw-records-loader.js.map +1 -1
- package/dist/es5/gml-loader.js +2 -4
- package/dist/es5/gml-loader.js.map +1 -1
- package/dist/es5/index.js +23 -10
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +2 -4
- package/dist/es5/lerc-loader.js.map +1 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/es5/lib/{create-image-source.js → services/create-image-service.js} +30 -21
- package/dist/es5/lib/services/create-image-service.js.map +1 -0
- package/dist/es5/lib/services/{generic/image-service.js → image-service.js} +2 -2
- package/dist/es5/lib/services/image-service.js.map +1 -0
- package/dist/es5/{lib/services → services}/arcgis/arcgis-image-service.js +22 -16
- package/dist/es5/services/arcgis/arcgis-image-service.js.map +1 -0
- package/dist/es5/services/arcgis/arcgis-server.js.map +1 -0
- package/dist/es5/services/create-image-source.js +14 -0
- package/dist/es5/services/create-image-source.js.map +1 -0
- package/dist/es5/{lib/services → services}/ogc/csw-service.js +10 -8
- package/dist/es5/services/ogc/csw-service.js.map +1 -0
- package/dist/es5/{lib/services → services}/ogc/wms-service.js +28 -22
- package/dist/es5/services/ogc/wms-service.js.map +1 -0
- package/dist/es5/wip/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/es5/wip/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/es5/wip/services/arcgis-feature-service.js.map +1 -0
- package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js +2 -2
- package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -1
- package/dist/es5/wip/wms-feature-info-loader.js.map +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-capabilities-loader.js +2 -4
- package/dist/es5/wms-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-error-loader.js +2 -4
- package/dist/es5/wms-error-loader.js.map +1 -1
- package/dist/esm/csw-capabilities-loader.js +1 -2
- package/dist/esm/csw-capabilities-loader.js.map +1 -1
- package/dist/esm/csw-domain-loader.js +1 -2
- package/dist/esm/csw-domain-loader.js.map +1 -1
- package/dist/esm/csw-records-loader.js +2 -2
- package/dist/esm/csw-records-loader.js.map +1 -1
- package/dist/esm/gml-loader.js +1 -2
- package/dist/esm/gml-loader.js.map +1 -1
- package/dist/esm/index.js +8 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -2
- package/dist/esm/lerc-loader.js.map +1 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/esm/lib/services/create-image-service.js +27 -0
- package/dist/esm/lib/services/create-image-service.js.map +1 -0
- package/dist/esm/lib/services/{generic/image-service.js → image-service.js} +1 -1
- package/dist/esm/lib/services/image-service.js.map +1 -0
- package/dist/esm/{lib/services → services}/arcgis/arcgis-image-service.js +7 -5
- package/dist/esm/services/arcgis/arcgis-image-service.js.map +1 -0
- package/dist/esm/services/arcgis/arcgis-server.js.map +1 -0
- package/dist/esm/services/create-image-source.js +8 -0
- package/dist/esm/services/create-image-source.js.map +1 -0
- package/dist/esm/{lib/services → services}/ogc/csw-service.js +9 -7
- package/dist/esm/services/ogc/csw-service.js.map +1 -0
- package/dist/esm/{lib/services → services}/ogc/wms-service.js +15 -11
- package/dist/esm/services/ogc/wms-service.js.map +1 -0
- package/dist/esm/wip/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/esm/wip/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/esm/wip/services/arcgis-feature-service.js.map +1 -0
- package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js +2 -2
- package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -1
- package/dist/esm/wip/wms-feature-info-loader.js.map +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-capabilities-loader.js +1 -2
- package/dist/esm/wms-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-error-loader.js +1 -2
- package/dist/esm/wms-error-loader.js.map +1 -1
- package/dist/gml-loader.d.ts +2 -18
- package/dist/gml-loader.d.ts.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/lerc-loader.d.ts +1 -14
- package/dist/lerc-loader.d.ts.map +1 -1
- package/dist/lib/parsers/gml/parse-gml.d.ts +1 -0
- package/dist/lib/parsers/gml/parse-gml.d.ts.map +1 -1
- package/dist/lib/services/create-image-service.d.ts +14 -0
- package/dist/lib/services/create-image-service.d.ts.map +1 -0
- package/dist/lib/services/{generic/image-service.d.ts → image-service.d.ts} +4 -4
- package/dist/lib/services/image-service.d.ts.map +1 -0
- package/dist/{lib/services → services}/arcgis/arcgis-image-service.d.ts +6 -7
- package/dist/services/arcgis/arcgis-image-service.d.ts.map +1 -0
- package/dist/services/arcgis/arcgis-server.d.ts.map +1 -0
- package/dist/services/create-image-source.d.ts +18 -0
- package/dist/services/create-image-source.d.ts.map +1 -0
- package/dist/{lib/services → services}/ogc/csw-service.d.ts +6 -38
- package/dist/services/ogc/csw-service.d.ts.map +1 -0
- package/dist/{lib/services → services}/ogc/wms-service.d.ts +14 -80
- package/dist/services/ogc/wms-service.d.ts.map +1 -0
- package/dist/wip/lib/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/wip/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/wip/services/arcgis-feature-service.d.ts.map +1 -0
- package/dist/wip/wfs-capabilities-loader.d.ts +1 -16
- package/dist/wip/wfs-capabilities-loader.d.ts.map +1 -1
- package/dist/wip/wms-feature-info-loader.d.ts +1 -15
- package/dist/wip/wms-feature-info-loader.d.ts.map +1 -1
- package/dist/wip/wms-layer-description-loader.d.ts +20 -6
- package/dist/wip/wms-layer-description-loader.d.ts.map +1 -1
- package/dist/wms-capabilities-loader.d.ts +2 -17
- package/dist/wms-capabilities-loader.d.ts.map +1 -1
- package/dist/wms-error-loader.d.ts +1 -21
- package/dist/wms-error-loader.d.ts.map +1 -1
- package/package.json +6 -9
- package/src/csw-capabilities-loader.ts +1 -4
- package/src/csw-domain-loader.ts +1 -3
- package/src/csw-records-loader.ts +2 -3
- package/src/gml-loader.ts +2 -3
- package/src/index.ts +14 -10
- package/src/lerc-loader.ts +1 -3
- package/src/lib/parsers/gml/parse-gml.ts +2 -0
- package/src/lib/services/create-image-service.ts +55 -0
- package/src/lib/services/{generic/image-service.ts → image-service.ts} +6 -4
- package/src/{lib/services → services}/arcgis/arcgis-image-service.ts +15 -8
- package/src/services/create-image-source.ts +31 -0
- package/src/{lib/services → services}/ogc/csw-service.ts +11 -11
- package/src/{lib/services → services}/ogc/wms-service.ts +27 -34
- package/src/wip/wfs-capabilities-loader.ts +2 -2
- package/src/wip/wms-feature-info-loader.ts +2 -1
- package/src/wms-capabilities-loader.ts +6 -4
- package/src/wms-error-loader.ts +1 -3
- package/dist/bundle.js +0 -6
- package/dist/csw-capabilities-loader.js +0 -31
- package/dist/csw-domain-loader.js +0 -31
- package/dist/csw-records-loader.js +0 -30
- package/dist/es5/lib/create-image-source.js.map +0 -1
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +0 -1
- package/dist/es5/lib/services/arcgis/arcgis-server.js.map +0 -1
- package/dist/es5/lib/services/generic/image-service.js.map +0 -1
- package/dist/es5/lib/services/ogc/csw-service.js.map +0 -1
- package/dist/es5/lib/services/ogc/wms-service.js.map +0 -1
- package/dist/es5/lib/sources/data-source.js +0 -67
- package/dist/es5/lib/sources/data-source.js.map +0 -1
- package/dist/es5/lib/sources/image-source.js +0 -26
- package/dist/es5/lib/sources/image-source.js.map +0 -1
- package/dist/es5/lib/sources/tile-source.js +0 -26
- package/dist/es5/lib/sources/tile-source.js.map +0 -1
- package/dist/es5/lib/sources/utils/utils.js +0 -36
- package/dist/es5/lib/sources/utils/utils.js.map +0 -1
- package/dist/es5/lib/wfs/parse-wfs.js.map +0 -1
- package/dist/es5/lib/wmts/parse-wmts.js.map +0 -1
- package/dist/es5/wip/arcgis-feature-service.js.map +0 -1
- package/dist/esm/lib/create-image-source.js +0 -27
- package/dist/esm/lib/create-image-source.js.map +0 -1
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +0 -1
- package/dist/esm/lib/services/arcgis/arcgis-server.js.map +0 -1
- package/dist/esm/lib/services/generic/image-service.js.map +0 -1
- package/dist/esm/lib/services/ogc/csw-service.js.map +0 -1
- package/dist/esm/lib/services/ogc/wms-service.js.map +0 -1
- package/dist/esm/lib/sources/data-source.js +0 -43
- package/dist/esm/lib/sources/data-source.js.map +0 -1
- package/dist/esm/lib/sources/image-source.js +0 -3
- package/dist/esm/lib/sources/image-source.js.map +0 -1
- package/dist/esm/lib/sources/tile-source.js +0 -3
- package/dist/esm/lib/sources/tile-source.js.map +0 -1
- package/dist/esm/lib/sources/utils/utils.js +0 -21
- package/dist/esm/lib/sources/utils/utils.js.map +0 -1
- package/dist/esm/lib/wfs/parse-wfs.js.map +0 -1
- package/dist/esm/lib/wmts/parse-wmts.js.map +0 -1
- package/dist/esm/wip/arcgis-feature-service.js.map +0 -1
- package/dist/gml-loader.js +0 -31
- package/dist/index.js +0 -39
- package/dist/lerc-loader.js +0 -56
- package/dist/lib/create-image-source.d.ts +0 -17
- package/dist/lib/create-image-source.d.ts.map +0 -1
- package/dist/lib/create-image-source.js +0 -39
- package/dist/lib/parsers/csw/parse-csw-capabilities.js +0 -24
- package/dist/lib/parsers/csw/parse-csw-domain.js +0 -33
- package/dist/lib/parsers/csw/parse-csw-records.js +0 -58
- package/dist/lib/parsers/csw/parse-exception-report.js +0 -30
- package/dist/lib/parsers/gml/deep-strict-equal.js +0 -119
- package/dist/lib/parsers/gml/parse-gml.js +0 -371
- package/dist/lib/parsers/lerc/lerc-types.js +0 -3
- package/dist/lib/parsers/wms/parse-wms-capabilities.js +0 -233
- package/dist/lib/parsers/wms/parse-wms-error.js +0 -22
- package/dist/lib/parsers/wms/parse-wms-features.js +0 -27
- package/dist/lib/parsers/wms/parse-wms-layer-description.js +0 -15
- package/dist/lib/parsers/xml/parse-xml-helpers.js +0 -68
- package/dist/lib/services/arcgis/arcgis-image-service.d.ts.map +0 -1
- package/dist/lib/services/arcgis/arcgis-image-service.js +0 -94
- package/dist/lib/services/arcgis/arcgis-server.d.ts.map +0 -1
- package/dist/lib/services/arcgis/arcgis-server.js +0 -42
- package/dist/lib/services/generic/image-service.d.ts.map +0 -1
- package/dist/lib/services/generic/image-service.js +0 -47
- package/dist/lib/services/ogc/csw-service.d.ts.map +0 -1
- package/dist/lib/services/ogc/csw-service.js +0 -168
- package/dist/lib/services/ogc/wms-service.d.ts.map +0 -1
- package/dist/lib/services/ogc/wms-service.js +0 -317
- package/dist/lib/sources/data-source.d.ts +0 -32
- package/dist/lib/sources/data-source.d.ts.map +0 -1
- package/dist/lib/sources/data-source.js +0 -56
- package/dist/lib/sources/image-source.d.ts +0 -79
- package/dist/lib/sources/image-source.d.ts.map +0 -1
- package/dist/lib/sources/image-source.js +0 -13
- package/dist/lib/sources/tile-source.d.ts +0 -56
- package/dist/lib/sources/tile-source.d.ts.map +0 -1
- package/dist/lib/sources/tile-source.js +0 -13
- package/dist/lib/sources/utils/utils.d.ts +0 -13
- package/dist/lib/sources/utils/utils.d.ts.map +0 -1
- package/dist/lib/sources/utils/utils.js +0 -38
- package/dist/lib/wfs/parse-wfs.d.ts.map +0 -1
- package/dist/lib/wfs/parse-wfs.js +0 -32
- package/dist/lib/wmts/parse-wmts.d.ts.map +0 -1
- package/dist/lib/wmts/parse-wmts.js +0 -35
- package/dist/wip/arcgis-feature-service.d.ts.map +0 -1
- package/dist/wip/arcgis-feature-service.js +0 -28
- package/dist/wip/data-source.js +0 -59
- package/dist/wip/lib/wcs/parse-wcs-capabilities.js +0 -15
- package/dist/wip/lib/wfs/parse-wfs-capabilities.js +0 -19
- package/dist/wip/lib/wmts/parse-wmts-capabilities.js +0 -77
- package/dist/wip/wcs-capabilities-loader.js +0 -31
- package/dist/wip/wfs-capabilities-loader.js +0 -31
- package/dist/wip/wms-feature-info-loader.js +0 -17
- package/dist/wip/wms-layer-description-loader.js +0 -17
- package/dist/wip/wmts-capabilities-loader.js +0 -32
- package/dist/wms-capabilities-loader.js +0 -35
- package/dist/wms-error-loader.js +0 -43
- package/src/lib/create-image-source.ts +0 -48
- package/src/lib/sources/data-source.ts +0 -73
- package/src/lib/sources/image-source.ts +0 -92
- package/src/lib/sources/tile-source.ts +0 -61
- package/src/lib/sources/utils/utils.ts +0 -42
- /package/dist/es5/{lib/services → services}/arcgis/arcgis-server.js +0 -0
- /package/dist/es5/{lib → wip/lib}/wfs/parse-wfs.js +0 -0
- /package/dist/es5/{lib → wip/lib}/wmts/parse-wmts.js +0 -0
- /package/dist/es5/wip/{arcgis-feature-service.js → services/arcgis-feature-service.js} +0 -0
- /package/dist/es5/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
- /package/dist/esm/{lib/services → services}/arcgis/arcgis-server.js +0 -0
- /package/dist/esm/{lib → wip/lib}/wfs/parse-wfs.js +0 -0
- /package/dist/esm/{lib → wip/lib}/wmts/parse-wmts.js +0 -0
- /package/dist/esm/wip/{arcgis-feature-service.js → services/arcgis-feature-service.js} +0 -0
- /package/dist/esm/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
- /package/dist/{lib/services → services}/arcgis/arcgis-server.d.ts +0 -0
- /package/dist/{lib → wip/lib}/wfs/parse-wfs.d.ts +0 -0
- /package/dist/{lib → wip/lib}/wmts/parse-wmts.d.ts +0 -0
- /package/dist/wip/{arcgis-feature-service.d.ts → services/arcgis-feature-service.d.ts} +0 -0
- /package/src/{lib/services → services}/arcgis/arcgis-server.ts +0 -0
- /package/src/{lib → wip/lib}/wfs/parse-wfs.ts +0 -0
- /package/src/{lib → wip/lib}/wmts/parse-wmts.ts +0 -0
- /package/src/wip/{arcgis-feature-service.ts → services/arcgis-feature-service.ts} +0 -0
- /package/src/{lib/services/ogc → wip/services}/wmts-service.ts.disabled +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csw-service.js","names":["DataSource","CSWCapabilitiesLoader","CSWRecordsLoader","CSWDomainLoader","WMSErrorLoader","CSWErrorLoader","CSWService","constructor","props","_defineProperty","getMetadata","capabilities","getCapabilities","normalizeMetadata","getServiceDirectory","options","services","unknownServices","records","getRecords","record","reference","references","url","value","scheme","push","name","title","type","_parseOGCUrl","includeUnknown","concat","parts","split","params","wmsParameters","vendorParameters","getCapabilitiesURL","response","fetch","arrayBuffer","_checkResponse","parse","loadOptions","getRecordsURL","getDomain","getDomainURL","version","service","request","_getCSWUrl","typenames","first","key","Object","entries","Array","isArray","toUpperCase","join","String","encodeURI","contentType","headers","ok","mimeTypes","includes","error","parseSync","Error","_parseError","toLowerCase"],"sources":["../../../../../src/lib/services/ogc/csw-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/* eslint-disable camelcase */\n\nimport type {DataSourceProps} from '../../sources/data-source';\nimport {DataSource} from '../../sources/data-source';\n\nimport type {CSWCapabilities} from '../../../csw-capabilities-loader';\nimport {CSWCapabilitiesLoader} from '../../../csw-capabilities-loader';\n\nimport type {CSWRecords} from '../../../csw-records-loader';\nimport {CSWRecordsLoader} from '../../../csw-records-loader';\n\nimport type {CSWDomain} from '../../../csw-domain-loader';\nimport {CSWDomainLoader} from '../../../csw-domain-loader';\n\nimport {WMSErrorLoader as CSWErrorLoader} from '../../../wms-error-loader';\n\ntype CSWCommonParameters = {\n /** In case the endpoint supports multiple services */\n service?: 'CSW';\n /** In case the endpoint supports multiple CSW versions */\n version?: '1.1.1' | '2.0.0' | '2.0.1' | '3.0.0';\n};\n\nexport type CSWGetCapabilitiesParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetCapabilities';\n};\n\nexport type CSWGetRecordsParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetRecords';\n /** type of records */\n typenames: 'csw:Record';\n};\n\nexport type CSWGetDomainParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetDomain';\n // TBA\n};\n\n/** Describes a service or resource exposed by the catalog */\nexport type Service = {\n /** name of service or resource */\n name: string;\n /** type of service or resource */\n type: string;\n url: string;\n params?: string;\n scheme?: string;\n};\n\nexport type CSWServiceProps = DataSourceProps & {\n url: string;\n};\n\n/**\n * The CSWService class\n * - provides type safe methods to form URLs to a CSW service\n * - provides type safe methods to query and parse results (and errors) from a CSW service\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class CSWService extends DataSource<CSWServiceProps> {\n static type: 'csw' = 'csw';\n static testURL = (url: string): boolean => url.toLowerCase().includes('csw');\n\n capabilities: CSWCapabilities | null = null;\n\n /** A list of loaders used by the CSWService methods */\n readonly loaders = [CSWErrorLoader, CSWCapabilitiesLoader];\n\n /** Create a CSWService */\n constructor(props: CSWServiceProps) {\n super(props);\n }\n\n async getMetadata(): Promise<CSWCapabilities> {\n const capabilities = await this.getCapabilities();\n return this.normalizeMetadata(capabilities);\n }\n\n normalizeMetadata(capabilities: CSWCapabilities): CSWCapabilities {\n return capabilities;\n }\n\n async getServiceDirectory(options?: {includeUnknown?: boolean}): Promise<Service[]> {\n const services: Service[] = [];\n const unknownServices: Service[] = [];\n\n const records = await this.getRecords();\n for (const record of records.records) {\n for (const reference of record.references) {\n const url = reference.value;\n switch (reference.scheme) {\n case 'OGC:WMS':\n services.push({name: record.title, type: 'ogc-wms-service', ...this._parseOGCUrl(url)});\n break;\n case 'OGC:WMTS':\n services.push({\n name: record.title,\n type: 'ogc-wmts-service',\n ...this._parseOGCUrl(url)\n });\n break;\n case 'OGC:WFS':\n services.push({name: record.title, type: 'ogc-wfs-service', ...this._parseOGCUrl(url)});\n break;\n default:\n unknownServices.push({\n name: record.title,\n type: 'unknown',\n url: reference.value,\n scheme: reference.scheme\n });\n }\n }\n }\n\n return options?.includeUnknown ? services.concat(unknownServices) : services;\n }\n\n _parseOGCUrl(url: string): {url: string; params: string} {\n const parts = url.split('?');\n return {\n url: parts[0],\n params: parts[1] || ''\n };\n }\n\n // CSW Service API Stubs\n\n /** Get Capabilities */\n async getCapabilities(\n wmsParameters?: CSWGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWCapabilities> {\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 CSWCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);\n return capabilities;\n }\n\n /** Get Records */\n async getRecords(\n wmsParameters?: CSWGetRecordsParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWRecords> {\n const url = this.getRecordsURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await CSWRecordsLoader.parse(arrayBuffer, this.props.loadOptions);\n }\n\n /** Get Domain */\n async getDomain(\n wmsParameters?: CSWGetDomainParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWDomain> {\n const url = this.getDomainURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await CSWDomainLoader.parse(arrayBuffer, this.props.loadOptions);\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?: CSWGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetCapabilitiesParameters> = {\n version: '3.0.0',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetCapabilities'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n /** Generate a URL for the GetCapabilities request */\n getRecordsURL(\n wmsParameters?: CSWGetRecordsParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetRecordsParameters> = {\n version: '3.0.0',\n typenames: 'csw:Record',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetRecords'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n /** Generate a URL for the GetCapabilities request */\n getDomainURL(\n wmsParameters?: CSWGetDomainParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetDomainParameters> = {\n version: '3.0.0',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetDomain'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n /**\n * @note case _getCSWUrl may need to be overridden to handle certain backends?\n * */\n protected _getCSWUrl(\n options: Record<string, unknown>,\n vendorParameters?: Record<string, unknown>\n ): string {\n let url = this.props.url;\n let first = true;\n for (const [key, value] of Object.entries(options)) {\n url += first ? '?' : '&';\n first = false;\n if (Array.isArray(value)) {\n url += `${key.toUpperCase()}=${value.join(',')}`;\n } else {\n url += `${key.toUpperCase()}=${value ? String(value) : ''}`;\n }\n }\n return encodeURI(url);\n }\n\n /** Checks for and parses a CSW 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 || CSWErrorLoader.mimeTypes.includes(contentType)) {\n const error = CSWErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);\n throw new Error(error);\n }\n }\n\n /** Error situation detected */\n protected _parseError(arrayBuffer: ArrayBuffer): Error {\n const error = CSWErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":";AAKA,SAAQA,UAAU,QAAO,2BAA2B;AAGpD,SAAQC,qBAAqB,QAAO,kCAAkC;AAGtE,SAAQC,gBAAgB,QAAO,6BAA6B;AAG5D,SAAQC,eAAe,QAAO,4BAA4B;AAE1D,SAAQC,cAAc,IAAIC,cAAc,QAAO,2BAA2B;AAgD1E,OAAO,MAAMC,UAAU,SAASN,UAAU,CAAkB;EAU1DO,WAAWA,CAACC,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,uBAPwB,IAAI;IAAAA,eAAA,kBAGxB,CAACJ,cAAc,EAAEJ,qBAAqB,CAAC;EAK1D;EAEA,MAAMS,WAAWA,CAAA,EAA6B;IAC5C,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACC,eAAe,CAAC,CAAC;IACjD,OAAO,IAAI,CAACC,iBAAiB,CAACF,YAAY,CAAC;EAC7C;EAEAE,iBAAiBA,CAACF,YAA6B,EAAmB;IAChE,OAAOA,YAAY;EACrB;EAEA,MAAMG,mBAAmBA,CAACC,OAAoC,EAAsB;IAClF,MAAMC,QAAmB,GAAG,EAAE;IAC9B,MAAMC,eAA0B,GAAG,EAAE;IAErC,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACC,UAAU,CAAC,CAAC;IACvC,KAAK,MAAMC,MAAM,IAAIF,OAAO,CAACA,OAAO,EAAE;MACpC,KAAK,MAAMG,SAAS,IAAID,MAAM,CAACE,UAAU,EAAE;QACzC,MAAMC,GAA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E;QACxBD,GAAG,OAAAS,MAAA,CAAOsB,GAAG,CAACK,WAAW,CAAC,CAAC,OAAA3B,MAAA,CAAIR,KAAK,CAACoC,IAAI,CAAC,GAAG,CAAC,CAAE;MAClD,CAAC,MAAM;QACLrC,GAAG,OAAAS,MAAA,CAAOsB,GAAG,CAACK,WAAW,CAAC,CAAC,OAAA3B,MAAA,CAAIR,KAAK,GAAGqC,MAAM,CAACrC,KAAK,CAAC,GAAG,EAAE,CAAE;MAC7D;IACF;IACA,OAAOsC,SAAS,CAACvC,GAAG,CAAC;EACvB;EAGUmB,cAAcA,CAACH,QAAkB,EAAEE,WAAwB,EAAQ;IAC3E,MAAMsB,WAAW,GAAGxB,QAAQ,CAACyB,OAAO,CAAC,cAAc,CAAC;IACpD,IAAI,CAACzB,QAAQ,CAAC0B,EAAE,IAAI5D,cAAc,CAAC6D,SAAS,CAACC,QAAQ,CAACJ,WAAW,CAAC,EAAE;MAClE,MAAMK,KAAK,GAAG/D,cAAc,CAACgE,SAAS,CAAC5B,WAAW,EAAE,IAAI,CAACjC,KAAK,CAACoC,WAAW,CAAC;MAC3E,MAAM,IAAI0B,KAAK,CAACF,KAAK,CAAC;IACxB;EACF;EAGUG,WAAWA,CAAC9B,WAAwB,EAAS;IACrD,MAAM2B,KAAK,GAAG/D,cAAc,CAACgE,SAAS,CAAC5B,WAAW,EAAE,IAAI,CAACjC,KAAK,CAACoC,WAAW,CAAC;IAC3E,OAAO,IAAI0B,KAAK,CAACF,KAAK,CAAC;EACzB;AACF;AAAC3D,eAAA,CAhMYH,UAAU,UACA,KAAK;AAAAG,eAAA,CADfH,UAAU,aAEHiB,GAAW,IAAcA,GAAG,CAACiD,WAAW,CAAC,CAAC,CAACL,QAAQ,CAAC,KAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wms-service.js","names":["ImageLoader","mergeLoaderOptions","ImageSource","WMSCapabilitiesLoader","WMSFeatureInfoLoader","WMSLayerDescriptionLoader","WMSErrorLoader","WMSService","constructor","props","_props$substituteCRS","_defineProperty","url","substituteCRS84","flipCRS","wmsParameters","layers","undefined","query_layers","styles","version","crs","format","info_format","transparent","time","elevation","vendorParameters","getMetadata","capabilities","getCapabilities","normalizeMetadata","getImage","parameters","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","includes","_getURLParameter","encodeURI","newParameters","srs","bbox","_flipBoundingBox","toUpperCase","Array","isArray","concat","join","String","bboxValue","length","flipCoordinates","_fetchArrayBuffer","contentType","headers","ok","mimeTypes","wms","throwOnError","error","parseSync","Error","toLowerCase"],"sources":["../../../../../src/lib/services/ogc/wms-service.ts"],"sourcesContent":["// loaders.gl, MIT license\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 {ImageSourceMetadata, GetImageParameters} from '../../sources/image-source';\nimport type {ImageSourceProps} from '../../sources/image-source';\nimport {ImageSource} from '../../sources/image-source';\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\n/**\n * \"Static\" WMS parameters (not viewport or selected pixel dependent)\n * These can be provided as defaults in the WMSService 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 WMSService (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 */\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 */\nexport 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 WMSServiceProps = ImageSourceProps & {\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\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 WMSService 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 WMSService extends ImageSource<WMSServiceProps> {\n static type: 'wms' = 'wms';\n static testURL = (url: string): boolean => url.toLowerCase().includes('wms');\n\n /** Base URL to the service */\n readonly url: 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 /** A list of loaders used by the WMSService methods */\n readonly loaders = [\n ImageLoader,\n WMSErrorLoader,\n WMSCapabilitiesLoader,\n WMSFeatureInfoLoader,\n WMSLayerDescriptionLoader\n ];\n\n /** Create a WMSService */\n constructor(props: WMSServiceProps) {\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\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 // ImageSource 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 return await this.getMap(parameters);\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 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-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":";AAIA,SAAQA,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,kBAAkB,QAAO,0BAA0B;AAI3D,SAAQC,WAAW,QAAO,4BAA4B;AAMtD,SAAQC,qBAAqB,QAAO,kCAAkC;AACtE,SAAQC,oBAAoB,QAAO,sCAAsC;AACzE,SAAQC,yBAAyB,QAAO,2CAA2C;AAGnF,SAAQC,cAAc,QAAO,2BAA2B;AAyJxD,OAAO,MAAMC,UAAU,SAASL,WAAW,CAAkB;EA6B3DM,WAAWA,CAACC,KAAsB,EAAE;IAAA,IAAAC,oBAAA;IAClC,KAAK,CAACD,KAAK,CAAC;IAACE,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,u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time/helpers/esm/defineProperty";
|
|
2
|
-
export class DataSource {
|
|
3
|
-
constructor(props) {
|
|
4
|
-
_defineProperty(this, "fetch", void 0);
|
|
5
|
-
_defineProperty(this, "loadOptions", void 0);
|
|
6
|
-
_defineProperty(this, "_needsRefresh", true);
|
|
7
|
-
_defineProperty(this, "props", void 0);
|
|
8
|
-
this.props = {
|
|
9
|
-
...props
|
|
10
|
-
};
|
|
11
|
-
this.loadOptions = {
|
|
12
|
-
...props.loadOptions
|
|
13
|
-
};
|
|
14
|
-
this.fetch = getFetchFunction(this.loadOptions);
|
|
15
|
-
}
|
|
16
|
-
setProps(props) {
|
|
17
|
-
this.props = Object.assign(this.props, props);
|
|
18
|
-
this.setNeedsRefresh();
|
|
19
|
-
}
|
|
20
|
-
setNeedsRefresh() {
|
|
21
|
-
this._needsRefresh = true;
|
|
22
|
-
}
|
|
23
|
-
getNeedsRefresh() {
|
|
24
|
-
let clear = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
25
|
-
const needsRefresh = this._needsRefresh;
|
|
26
|
-
if (clear) {
|
|
27
|
-
this._needsRefresh = false;
|
|
28
|
-
}
|
|
29
|
-
return needsRefresh;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function getFetchFunction(options) {
|
|
33
|
-
const fetchFunction = options === null || options === void 0 ? void 0 : options.fetch;
|
|
34
|
-
if (fetchFunction && typeof fetchFunction === 'function') {
|
|
35
|
-
return (url, fetchOptions) => fetchFunction(url, fetchOptions);
|
|
36
|
-
}
|
|
37
|
-
const fetchOptions = options === null || options === void 0 ? void 0 : options.fetch;
|
|
38
|
-
if (fetchOptions && typeof fetchOptions !== 'function') {
|
|
39
|
-
return url => fetch(url, fetchOptions);
|
|
40
|
-
}
|
|
41
|
-
return url => fetch(url);
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=data-source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-source.js","names":["DataSource","constructor","props","_defineProperty","loadOptions","fetch","getFetchFunction","setProps","Object","assign","setNeedsRefresh","_needsRefresh","getNeedsRefresh","clear","arguments","length","undefined","needsRefresh","options","fetchFunction","url","fetchOptions"],"sources":["../../../../src/lib/sources/data-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\n\nexport type DataSourceProps = {\n /** LoaderOptions provide an option to override `fetch`. Will also be passed to any sub loaders */\n loadOptions?: LoaderOptions;\n};\n\n/** base class of all data sources */\nexport abstract class DataSource<PropsT extends DataSourceProps> {\n /** A resolved fetch function extracted from loadOptions prop */\n fetch: (url: string, options?: RequestInit) => Promise<Response>;\n /** The actual load options, if calling a loaders.gl loader */\n loadOptions: LoaderOptions;\n _needsRefresh: boolean = true;\n\n props: PropsT;\n\n constructor(props: PropsT) {\n this.props = {...props};\n this.loadOptions = {...props.loadOptions};\n this.fetch = getFetchFunction(this.loadOptions);\n }\n\n setProps(props: PropsT) {\n this.props = Object.assign(this.props, props);\n // TODO - add a shallow compare to avoid setting refresh if no change?\n this.setNeedsRefresh();\n }\n\n /** Mark this data source as needing a refresh (redraw) */\n setNeedsRefresh(): void {\n this._needsRefresh = true;\n }\n\n /**\n * Does this data source need refreshing?\n * @note The specifics of the refresh mechanism depends on type of data source\n */\n getNeedsRefresh(clear: boolean = true) {\n const needsRefresh = this._needsRefresh;\n if (clear) {\n this._needsRefresh = false;\n }\n return needsRefresh;\n }\n}\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetch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EACnC,IAAIgB,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,EAAE;IACtD,OAAQD,GAAG,IAAKf,KAAK,CAACe,GAAG,EAAEC,YAAY,CAAC;EAC1C;EAGA,OAAQD,GAAG,IAAKf,KAAK,CAACe,GAAG,CAAC;AAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-source.js","names":["DataSource","ImageSource"],"sources":["../../../../src/lib/sources/image-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {ImageType} from '@loaders.gl/images';\nimport type {DataSourceProps} from './data-source';\nimport {DataSource} from './data-source';\n\n/**\n * Normalized capabilities of an Image service\n * @example\n * The WMSService will normalize the response to the WMS `GetCapabilities`\n * data structure extracted from WMS XML response into an ImageSourceMetadata.\n */\nexport type ImageSourceMetadata = {\n name: string;\n title?: string;\n abstract?: string;\n keywords: string[];\n layers: ImageSourceLayer[];\n};\n\n/** Description of one data layer in the image source */\nexport type ImageSourceLayer = {\n /** Name of this layer */\n name?: string;\n /** Human readable title of this layer */\n title?: string;\n /** Coordinate systems supported by this layer */\n crs?: string[];\n /** layer limits in unspecified CRS:84-like lng/lat, for quick access w/o CRS calculations. */\n geographicBoundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Sub layers of this layer */\n layers?: ImageSourceLayer[];\n\n /** @deprecated from v3.4: non-vis.gl style bounding box. Use `.geographicBoundingBox` instead */\n boundingBox?: [number, number, number, number];\n};\n\n/** Generic parameters for requesting an image from an image source */\nexport type GetImageParameters = {\n /** Layers to render */\n layers: string | 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 /** crs for the image (not the bounding box) */\n crs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\n// Attempt to break down GetImageParameters\nexport type ImageFilters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n};\n\nexport type ImageRegion = {\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n};\n\nexport type ImageFormat = {\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** crs for the image (not the bounding box) */\n crs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\nexport type ImageSourceProps = DataSourceProps;\n\n/**\n * MapImageSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport abstract class ImageSource<\n PropsT extends ImageSourceProps = ImageSourceProps\n> extends DataSource<PropsT> {\n abstract getMetadata(): Promise<ImageSourceMetadata>;\n abstract getImage(parameters: GetImageParameters): Promise<ImageType>;\n}\n"],"mappings":"AAIA,SAAQA,UAAU,QAAO,eAAe;AAkFxC,OAAO,MAAeC,WAAW,SAEvBD,UAAU,CAAS"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.js","names":["DataSource","TileSource"],"sources":["../../../../src/lib/sources/tile-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {ImageType} from '@loaders.gl/images';\nimport {DataSource, DataSourceProps} from './data-source';\n\n/**\n * Normalized capabilities of an Image service\n * @example\n * The WMSService will normalize the response to the WMS `GetCapabilities` data structure extracted from WMS XML response\n * into an TileSourceMetadata.\n */\nexport type TileSourceMetadata = {\n name: string;\n title?: string;\n abstract?: string;\n keywords: string[];\n layer: {\n name: string;\n title?: string;\n srs?: string[];\n boundingBox?: [number, number, number, number];\n layers: TileSourceLayer[];\n };\n};\n\nexport type TileSourceLayer = {\n name: string;\n title?: string;\n srs?: string[];\n boundingBox?: [number, number, number, number];\n layers: TileSourceLayer[];\n};\n\nexport type GetTileParameters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n zoom: number;\n /** tile x coordinate */\n x: number;\n /** tile y coordinate */\n y: number;\n /** srs for the image (not the bounding box) */\n srs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\ntype TileSourceProps = DataSourceProps;\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport abstract class TileSource<PropsT extends TileSourceProps> extends DataSource<PropsT> {\n abstract getMetadata(): Promise<TileSourceMetadata>;\n abstract getTile(parameters: GetTileParameters): Promise<ImageType>;\n}\n"],"mappings":"AAGA,SAAQA,UAAU,QAAwB,eAAe;AAsDzD,OAAO,MAAeC,UAAU,SAAyCD,UAAU,CAAS"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function getFetchFunction(options) {
|
|
2
|
-
const fetchFunction = options === null || options === void 0 ? void 0 : options.fetch;
|
|
3
|
-
if (fetchFunction && typeof fetchFunction === 'function') {
|
|
4
|
-
return (url, fetchOptions) => fetchFunction(url, fetchOptions);
|
|
5
|
-
}
|
|
6
|
-
const fetchOptions = options === null || options === void 0 ? void 0 : options.fetch;
|
|
7
|
-
if (fetchOptions && typeof fetchOptions !== 'function') {
|
|
8
|
-
return url => fetch(url, fetchOptions);
|
|
9
|
-
}
|
|
10
|
-
return url => fetch(url);
|
|
11
|
-
}
|
|
12
|
-
export function mergeImageServiceProps(props) {
|
|
13
|
-
return {
|
|
14
|
-
...props,
|
|
15
|
-
loadOptions: {
|
|
16
|
-
...props.loadOptions,
|
|
17
|
-
fetch: getFetchFunction(props.loadOptions)
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getFetchFunction","options","fetchFunction","fetch","url","fetchOptions","mergeImageServiceProps","props","loadOptions"],"sources":["../../../../../src/lib/sources/utils/utils.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetchOptions);\n }\n\n // else return the global fetch function\n return (url) => fetch(url);\n}\n\nexport function mergeImageServiceProps<Props extends {loadOptions?: any}>(\n props: Props\n): Required<Props> {\n // @ts-expect-error\n return {\n // Default fetch\n ...props,\n loadOptions: {\n ...props.loadOptions,\n fetch: getFetchFunction(props.loadOptions)\n }\n };\n}\n"],"mappings":"AAWA,OAAO,SAASA,gBAAgBA,CAACC,OAAuB,EAAE;EACxD,MAAMC,aAAa,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK;EAGpC,IAAID,aAAa,IAAI,OAAOA,aAAa,KAAK,UAAU,EAAE;IACxD,OAAO,CAACE,GAAW,EAAEC,YAA0B,KAAKH,aAAa,CAACE,GAAG,EAAEC,YAAY,CAAC;EACtF;EAGA,MAAMA,YAAY,GAAGJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK;EACnC,IAAIE,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,EAAE;IACtD,OAAQD,GAAG,IAAKD,KAAK,CAACC,GAAG,EAAEC,YAAY,CAAC;EAC1C;EAGA,OAAQD,GAAG,IAAKD,KAAK,CAACC,GAAG,CAAC;AAC5B;AAEA,OAAO,SAASE,sBAAsBA,CACpCC,KAAY,EACK;EAEjB,OAAO;IAEL,GAAGA,KAAK;IACRC,WAAW,EAAE;MACX,GAAGD,KAAK,CAACC,WAAW;MACpBL,KAAK,EAAEH,gBAAgB,CAACO,KAAK,CAACC,WAAW;IAC3C;EACF,CAAC;AACH"}
|
|
@@ -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/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.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/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","_defineProperty","url","loadOptions","fetch","metadataURL","options","getUrl","exportImageURL","boundingBox","path"],"sources":["../../../src/wip/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;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAC5C,IAAI,CAACC,GAAG,GAAGF,KAAK,CAACE,GAAG;IACpB,IAAI,CAACC,WAAW,GAAGH,KAAK,CAACG,WAAW,IAAI,CAAC,CAAC;IAC1C,IAAI,CAACC,KAAK,GAAGJ,KAAK,CAACI,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"}
|
package/dist/gml-loader.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports._typecheckGMLLoader = exports.GMLLoader = void 0;
|
|
5
|
-
const parse_gml_1 = require("./lib/parsers/gml/parse-gml");
|
|
6
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
9
|
-
/**
|
|
10
|
-
* Loader for the response to the GML GetCapability request
|
|
11
|
-
*/
|
|
12
|
-
exports.GMLLoader = {
|
|
13
|
-
name: 'GML',
|
|
14
|
-
id: 'gml',
|
|
15
|
-
module: 'wms',
|
|
16
|
-
version: VERSION,
|
|
17
|
-
worker: false,
|
|
18
|
-
extensions: ['xml'],
|
|
19
|
-
mimeTypes: ['application/vnd.ogc.gml', 'application/xml', 'text/xml'],
|
|
20
|
-
testText: testXMLFile,
|
|
21
|
-
options: {
|
|
22
|
-
gml: {}
|
|
23
|
-
},
|
|
24
|
-
parse: async (arrayBuffer, options) => (0, parse_gml_1.parseGML)(new TextDecoder().decode(arrayBuffer), options),
|
|
25
|
-
parseTextSync: (text, options) => (0, parse_gml_1.parseGML)(text, options)
|
|
26
|
-
};
|
|
27
|
-
function testXMLFile(text) {
|
|
28
|
-
// TODO - There could be space first.
|
|
29
|
-
return text.startsWith('<?xml');
|
|
30
|
-
}
|
|
31
|
-
exports._typecheckGMLLoader = exports.GMLLoader;
|
package/dist/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports._ArcGISImageServer = exports._getArcGISServices = exports.WMSService = exports.CSWService = exports.ImageService = exports.createImageSource = exports.ImageSource = exports._GMLLoader = exports._WFSCapabilitiesLoader = exports._WMSLayerDescriptionLoader = exports._WMSFeatureInfoLoader = exports.WMSCapabilitiesLoader = exports.WMSErrorLoader = exports.CSWRecordsLoader = exports.CSWDomainLoader = exports.CSWCapabilitiesLoader = void 0;
|
|
5
|
-
var csw_capabilities_loader_1 = require("./csw-capabilities-loader");
|
|
6
|
-
Object.defineProperty(exports, "CSWCapabilitiesLoader", { enumerable: true, get: function () { return csw_capabilities_loader_1.CSWCapabilitiesLoader; } });
|
|
7
|
-
var csw_domain_loader_1 = require("./csw-domain-loader");
|
|
8
|
-
Object.defineProperty(exports, "CSWDomainLoader", { enumerable: true, get: function () { return csw_domain_loader_1.CSWDomainLoader; } });
|
|
9
|
-
var csw_records_loader_1 = require("./csw-records-loader");
|
|
10
|
-
Object.defineProperty(exports, "CSWRecordsLoader", { enumerable: true, get: function () { return csw_records_loader_1.CSWRecordsLoader; } });
|
|
11
|
-
// WMS - Web Map Service
|
|
12
|
-
var wms_error_loader_1 = require("./wms-error-loader");
|
|
13
|
-
Object.defineProperty(exports, "WMSErrorLoader", { enumerable: true, get: function () { return wms_error_loader_1.WMSErrorLoader; } });
|
|
14
|
-
var wms_capabilities_loader_1 = require("./wms-capabilities-loader");
|
|
15
|
-
Object.defineProperty(exports, "WMSCapabilitiesLoader", { enumerable: true, get: function () { return wms_capabilities_loader_1.WMSCapabilitiesLoader; } });
|
|
16
|
-
var wms_feature_info_loader_1 = require("./wip/wms-feature-info-loader");
|
|
17
|
-
Object.defineProperty(exports, "_WMSFeatureInfoLoader", { enumerable: true, get: function () { return wms_feature_info_loader_1.WMSFeatureInfoLoader; } });
|
|
18
|
-
var wms_layer_description_loader_1 = require("./wip/wms-layer-description-loader");
|
|
19
|
-
Object.defineProperty(exports, "_WMSLayerDescriptionLoader", { enumerable: true, get: function () { return wms_layer_description_loader_1.WMSLayerDescriptionLoader; } });
|
|
20
|
-
var wfs_capabilities_loader_1 = require("./wip/wfs-capabilities-loader");
|
|
21
|
-
Object.defineProperty(exports, "_WFSCapabilitiesLoader", { enumerable: true, get: function () { return wfs_capabilities_loader_1.WFSCapabilitiesLoader; } });
|
|
22
|
-
var gml_loader_1 = require("./gml-loader");
|
|
23
|
-
Object.defineProperty(exports, "_GMLLoader", { enumerable: true, get: function () { return gml_loader_1.GMLLoader; } });
|
|
24
|
-
var image_source_1 = require("./lib/sources/image-source");
|
|
25
|
-
Object.defineProperty(exports, "ImageSource", { enumerable: true, get: function () { return image_source_1.ImageSource; } });
|
|
26
|
-
var create_image_source_1 = require("./lib/create-image-source");
|
|
27
|
-
Object.defineProperty(exports, "createImageSource", { enumerable: true, get: function () { return create_image_source_1.createImageSource; } });
|
|
28
|
-
var image_service_1 = require("./lib/services/generic/image-service");
|
|
29
|
-
Object.defineProperty(exports, "ImageService", { enumerable: true, get: function () { return image_service_1.ImageService; } });
|
|
30
|
-
// OGC Services
|
|
31
|
-
var csw_service_1 = require("./lib/services/ogc/csw-service");
|
|
32
|
-
Object.defineProperty(exports, "CSWService", { enumerable: true, get: function () { return csw_service_1.CSWService; } });
|
|
33
|
-
var wms_service_1 = require("./lib/services/ogc/wms-service");
|
|
34
|
-
Object.defineProperty(exports, "WMSService", { enumerable: true, get: function () { return wms_service_1.WMSService; } });
|
|
35
|
-
// ArcGIS Services
|
|
36
|
-
var arcgis_server_1 = require("./lib/services/arcgis/arcgis-server");
|
|
37
|
-
Object.defineProperty(exports, "_getArcGISServices", { enumerable: true, get: function () { return arcgis_server_1.getArcGISServices; } });
|
|
38
|
-
var arcgis_image_service_1 = require("./lib/services/arcgis/arcgis-image-service");
|
|
39
|
-
Object.defineProperty(exports, "_ArcGISImageServer", { enumerable: true, get: function () { return arcgis_image_service_1.ArcGISImageServer; } });
|
package/dist/lerc-loader.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports._typecheckLERCLoader = exports.LERCLoader = void 0;
|
|
28
|
-
const Lerc = __importStar(require("lerc"));
|
|
29
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
30
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
31
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
32
|
-
/**
|
|
33
|
-
* Loader for the LERC raster format
|
|
34
|
-
*/
|
|
35
|
-
exports.LERCLoader = {
|
|
36
|
-
id: 'lerc',
|
|
37
|
-
name: 'LERC',
|
|
38
|
-
module: 'wms',
|
|
39
|
-
version: VERSION,
|
|
40
|
-
worker: false,
|
|
41
|
-
extensions: ['lrc', 'lerc', 'lerc2', 'lerc1'],
|
|
42
|
-
mimeTypes: ['application/octet-stream'],
|
|
43
|
-
// test: ?,
|
|
44
|
-
options: {
|
|
45
|
-
wms: {}
|
|
46
|
-
},
|
|
47
|
-
parse: async (arrayBuffer, options) => parseLERC(arrayBuffer, options)
|
|
48
|
-
};
|
|
49
|
-
async function parseLERC(arrayBuffer, options) {
|
|
50
|
-
// Load the WASM library
|
|
51
|
-
await Lerc.load();
|
|
52
|
-
// Perform the decode
|
|
53
|
-
const pixelBlock = Lerc.decode(arrayBuffer, options?.lerc);
|
|
54
|
-
return pixelBlock;
|
|
55
|
-
}
|
|
56
|
-
exports._typecheckLERCLoader = exports.LERCLoader;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ImageSource } from './sources/image-source';
|
|
2
|
-
import { ImageServiceProps } from './services/generic/image-service';
|
|
3
|
-
import type { WMSServiceProps } from './services/ogc/wms-service';
|
|
4
|
-
export type ImageServiceType = 'wms' | 'arcgis-image-server' | 'template';
|
|
5
|
-
type ImageSourceProps = ImageServiceProps & WMSServiceProps & {
|
|
6
|
-
type?: ImageServiceType | 'auto';
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Creates an image source
|
|
10
|
-
* If type is not supplied, will try to automatically detect the the
|
|
11
|
-
* @param url URL to the image source
|
|
12
|
-
* @param type type of source. if not known, set to 'auto'
|
|
13
|
-
* @returns an ImageSource instance
|
|
14
|
-
*/
|
|
15
|
-
export declare function createImageSource(props: ImageSourceProps): ImageSource<ImageSourceProps>;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=create-image-source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-image-source.d.ts","sourceRoot":"","sources":["../../src/lib/create-image-source.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAe,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAIhE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,qBAAqB,GAAG,UAAU,CAAC;AAI1E,KAAK,gBAAgB,GAAG,iBAAiB,GACvC,eAAe,GAAG;IAChB,IAAI,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;CAClC,CAAC;AAEJ;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAYxF"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.createImageSource = void 0;
|
|
5
|
-
const image_service_1 = require("./services/generic/image-service");
|
|
6
|
-
const wms_service_1 = require("./services/ogc/wms-service");
|
|
7
|
-
const arcgis_image_service_1 = require("./services/arcgis/arcgis-image-service");
|
|
8
|
-
const SERVICES = [wms_service_1.WMSService, arcgis_image_service_1.ArcGISImageServer, image_service_1.ImageService];
|
|
9
|
-
/**
|
|
10
|
-
* Creates an image source
|
|
11
|
-
* If type is not supplied, will try to automatically detect the the
|
|
12
|
-
* @param url URL to the image source
|
|
13
|
-
* @param type type of source. if not known, set to 'auto'
|
|
14
|
-
* @returns an ImageSource instance
|
|
15
|
-
*/
|
|
16
|
-
function createImageSource(props) {
|
|
17
|
-
const { type = 'auto' } = props;
|
|
18
|
-
const serviceType = type === 'auto' ? guessServiceType(props.url) : type;
|
|
19
|
-
switch (serviceType) {
|
|
20
|
-
case 'template':
|
|
21
|
-
return new image_service_1.ImageService(props);
|
|
22
|
-
case 'wms':
|
|
23
|
-
return new wms_service_1.WMSService(props);
|
|
24
|
-
default:
|
|
25
|
-
// currently only wms service supported
|
|
26
|
-
throw new Error('Not a valid image source type');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.createImageSource = createImageSource;
|
|
30
|
-
/** Guess service type from URL */
|
|
31
|
-
function guessServiceType(url) {
|
|
32
|
-
for (const Service of SERVICES) {
|
|
33
|
-
if (Service.testURL && Service.testURL(url)) {
|
|
34
|
-
return Service.type;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// If all else fails, guess that this is MS service
|
|
38
|
-
return 'wms';
|
|
39
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.parseCSWCapabilities = void 0;
|
|
5
|
-
const xml_1 = require("@loaders.gl/xml");
|
|
6
|
-
const parse_exception_report_1 = require("./parse-exception-report");
|
|
7
|
-
/**
|
|
8
|
-
* Parses a typed data structure from raw XML for `GetCapabilities` response
|
|
9
|
-
* @note Error handlings is fairly weak
|
|
10
|
-
*/
|
|
11
|
-
function parseCSWCapabilities(text, options) {
|
|
12
|
-
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, {
|
|
13
|
-
...options,
|
|
14
|
-
xml: {
|
|
15
|
-
...options?.xml,
|
|
16
|
-
removeNSPrefix: true,
|
|
17
|
-
uncapitalizeKeys: true
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
(0, parse_exception_report_1.parseExceptionReport)(parsedXML);
|
|
21
|
-
const xmlCapabilities = parsedXML.capabilities || parsedXML;
|
|
22
|
-
return xmlCapabilities;
|
|
23
|
-
}
|
|
24
|
-
exports.parseCSWCapabilities = parseCSWCapabilities;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.parseCSWDomain = void 0;
|
|
5
|
-
const xml_1 = require("@loaders.gl/xml");
|
|
6
|
-
const parse_exception_report_1 = require("./parse-exception-report");
|
|
7
|
-
/**
|
|
8
|
-
* Parses a typed data structure from raw XML for `GetDomain` response
|
|
9
|
-
* @note Error handlings is fairly weak
|
|
10
|
-
*/
|
|
11
|
-
function parseCSWDomain(text, options) {
|
|
12
|
-
const parsedXML = xml_1.XMLLoader.parseTextSync?.(text, {
|
|
13
|
-
...options,
|
|
14
|
-
xml: {
|
|
15
|
-
...options?.xml,
|
|
16
|
-
removeNSPrefix: true,
|
|
17
|
-
uncapitalizeKeys: true,
|
|
18
|
-
arrayPaths: [
|
|
19
|
-
'GetDomainResponse.DomainValues',
|
|
20
|
-
'GetDomainResponse.DomainValues.ListOfValues.value'
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
(0, parse_exception_report_1.parseExceptionReport)(parsedXML);
|
|
25
|
-
const xmlDomain = parsedXML.getDomainResponse;
|
|
26
|
-
for (const domainValue of xmlDomain.domainValues) {
|
|
27
|
-
// Drop the nested <listOfValues><value><value><listOfValues> => values[]
|
|
28
|
-
domainValue.values = domainValue.listOfValues?.value;
|
|
29
|
-
delete domainValue.listOfValues;
|
|
30
|
-
}
|
|
31
|
-
return xmlDomain;
|
|
32
|
-
}
|
|
33
|
-
exports.parseCSWDomain = parseCSWDomain;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.renameXMLTags = exports.parseCSWRecords = void 0;
|
|
5
|
-
const xml_1 = require("@loaders.gl/xml");
|
|
6
|
-
const xml_2 = require("@loaders.gl/xml");
|
|
7
|
-
const parse_exception_report_1 = require("./parse-exception-report");
|
|
8
|
-
/**
|
|
9
|
-
* Parses a typed data structure from raw XML for `GetRecords` response
|
|
10
|
-
* @note Error handlings is fairly weak
|
|
11
|
-
*/
|
|
12
|
-
function parseCSWRecords(text, options) {
|
|
13
|
-
const parsedXML = xml_2.XMLLoader.parseTextSync?.(text, {
|
|
14
|
-
...options,
|
|
15
|
-
xml: {
|
|
16
|
-
...options?.xml,
|
|
17
|
-
removeNSPrefix: true,
|
|
18
|
-
uncapitalizeKeys: true,
|
|
19
|
-
arrayPaths: [],
|
|
20
|
-
_fastXML: {
|
|
21
|
-
...options?.xml?._fastXML,
|
|
22
|
-
parseAttributeValue: true
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
(0, parse_exception_report_1.parseExceptionReport)(parsedXML);
|
|
27
|
-
const xmlRecords = parsedXML.getRecordsResponse;
|
|
28
|
-
// Move results to top
|
|
29
|
-
const elementSet = xmlRecords.searchResults.elementSet;
|
|
30
|
-
const recordsFieldName = `${elementSet}Record`;
|
|
31
|
-
xmlRecords.records = xmlRecords.searchResults[recordsFieldName];
|
|
32
|
-
delete xmlRecords.searchResults[recordsFieldName];
|
|
33
|
-
(0, xml_1.convertXMLFieldToArrayInPlace)(xmlRecords, 'records');
|
|
34
|
-
for (const record of xmlRecords.records) {
|
|
35
|
-
record.boundingBoxes = record.boundingBox;
|
|
36
|
-
delete record.boundingBox;
|
|
37
|
-
(0, xml_1.convertXMLFieldToArrayInPlace)(record, 'boundingBoxes');
|
|
38
|
-
for (const boundingBox of record.boundingBoxes) {
|
|
39
|
-
boundingBox.value = [
|
|
40
|
-
boundingBox.upperCorner[0],
|
|
41
|
-
boundingBox.upperCorner[1],
|
|
42
|
-
boundingBox.lowerCorner[0],
|
|
43
|
-
boundingBox.lowerCorner[1]
|
|
44
|
-
];
|
|
45
|
-
delete boundingBox.upperCorner;
|
|
46
|
-
delete boundingBox.lowerCorner;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return xmlRecords;
|
|
50
|
-
}
|
|
51
|
-
exports.parseCSWRecords = parseCSWRecords;
|
|
52
|
-
function renameXMLTags(xml, renameKeys) {
|
|
53
|
-
for (const [oldKey, newKey] of Object.entries(renameKeys)) {
|
|
54
|
-
xml[newKey] = xml[oldKey];
|
|
55
|
-
delete xml[oldKey];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.renameXMLTags = renameXMLTags;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.parseExceptionReport = void 0;
|
|
5
|
-
// import type {XMLLoaderOptions} from '@loaders.gl/xml';
|
|
6
|
-
// import {XMLLoader} from '@loaders.gl/xml';
|
|
7
|
-
/**
|
|
8
|
-
* Parses a typed data structure from raw XML for `GetDomain` response
|
|
9
|
-
* @note Error handlings is fairly weak
|
|
10
|
-
*/
|
|
11
|
-
function parseExceptionReport(parsedXML) {
|
|
12
|
-
// const parsedXML = XMLLoader.parseTextSync?.(text, {
|
|
13
|
-
// ...options,
|
|
14
|
-
// xml: {
|
|
15
|
-
// ...options?.xml,
|
|
16
|
-
// removeNSPrefix: true,
|
|
17
|
-
// uncapitalizeKeys: true
|
|
18
|
-
// }
|
|
19
|
-
// });
|
|
20
|
-
const exceptionReport = parsedXML.exceptionReport;
|
|
21
|
-
if (!exceptionReport) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const errorMessage = exceptionReport.exception?.exceptionText ||
|
|
25
|
-
exceptionReport.exception?.exceptionCode ||
|
|
26
|
-
exceptionReport.exception?.locator ||
|
|
27
|
-
'server error';
|
|
28
|
-
throw new Error(`Catalog Server: ${errorMessage}`);
|
|
29
|
-
}
|
|
30
|
-
exports.parseExceptionReport = parseExceptionReport;
|