@loaders.gl/wms 3.4.0-alpha.2 → 3.4.0-alpha.4
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/dist.min.js +412 -176
- package/dist/es5/csw-capabilities-loader.js +7 -11
- package/dist/es5/csw-capabilities-loader.js.map +1 -1
- package/dist/es5/csw-domain-loader.js +7 -10
- package/dist/es5/csw-domain-loader.js.map +1 -1
- package/dist/es5/csw-records-loader.js +7 -10
- package/dist/es5/csw-records-loader.js.map +1 -1
- package/dist/es5/gml-loader.js +7 -10
- package/dist/es5/gml-loader.js.map +1 -1
- package/dist/es5/index.js +0 -7
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +17 -22
- package/dist/es5/lerc-loader.js.map +1 -1
- package/dist/es5/lib/create-image-source.js +1 -2
- package/dist/es5/lib/create-image-source.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-domain.js +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-domain.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-records.js +1 -2
- package/dist/es5/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-exception-report.js +0 -2
- package/dist/es5/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/es5/lib/parsers/gml/deep-strict-equal.js +0 -8
- package/dist/es5/lib/parsers/gml/deep-strict-equal.js.map +1 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js +1 -13
- package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js +197 -54
- package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-error.js +0 -1
- package/dist/es5/lib/parsers/wms/parse-wms-error.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-features.js +0 -1
- package/dist/es5/lib/parsers/wms/parse-wms-features.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js +0 -1
- package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
- package/dist/es5/lib/parsers/xml/parse-xml-helpers.js +67 -0
- package/dist/es5/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js +36 -60
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/es5/lib/services/arcgis/arcgis-server.js +50 -54
- package/dist/es5/lib/services/arcgis/arcgis-server.js.map +1 -1
- package/dist/es5/lib/services/generic/image-service.js +28 -42
- package/dist/es5/lib/services/generic/image-service.js.map +1 -1
- package/dist/es5/lib/services/ogc/csw-service.js +161 -188
- package/dist/es5/lib/services/ogc/csw-service.js.map +1 -1
- package/dist/es5/lib/services/ogc/wms-service.js +325 -245
- package/dist/es5/lib/services/ogc/wms-service.js.map +1 -1
- package/dist/es5/lib/sources/data-source.js +36 -13
- package/dist/es5/lib/sources/data-source.js.map +1 -1
- package/dist/es5/lib/sources/image-source.js.map +1 -1
- package/dist/es5/lib/sources/tile-source.js.map +1 -1
- package/dist/es5/lib/sources/utils/utils.js +0 -4
- package/dist/es5/lib/sources/utils/utils.js.map +1 -1
- package/dist/es5/wip/arcgis-feature-service.js +2 -7
- package/dist/es5/wip/arcgis-feature-service.js.map +1 -1
- package/dist/es5/wip/data-source.js +0 -2
- package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
- package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
- package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js +7 -10
- package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js +7 -10
- package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -1
- package/dist/es5/wip/wms-feature-info-loader.js +6 -8
- package/dist/es5/wip/wms-feature-info-loader.js.map +1 -1
- package/dist/es5/wip/wms-layer-description-loader.js +6 -8
- package/dist/es5/wip/wms-layer-description-loader.js.map +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js +7 -16
- package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-capabilities-loader.js +8 -12
- package/dist/es5/wms-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-error-loader.js +7 -9
- package/dist/es5/wms-error-loader.js.map +1 -1
- package/dist/esm/bundle.js +0 -2
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/csw-capabilities-loader.js +1 -5
- package/dist/esm/csw-capabilities-loader.js.map +1 -1
- package/dist/esm/csw-domain-loader.js +1 -4
- package/dist/esm/csw-domain-loader.js.map +1 -1
- package/dist/esm/csw-records-loader.js +1 -4
- package/dist/esm/csw-records-loader.js.map +1 -1
- package/dist/esm/gml-loader.js +1 -4
- package/dist/esm/gml-loader.js.map +1 -1
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -4
- package/dist/esm/lerc-loader.js.map +1 -1
- package/dist/esm/lib/create-image-source.js +0 -3
- package/dist/esm/lib/create-image-source.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js +0 -3
- package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-domain.js +0 -3
- package/dist/esm/lib/parsers/csw/parse-csw-domain.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-records.js +0 -3
- package/dist/esm/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-exception-report.js +0 -3
- package/dist/esm/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/esm/lib/parsers/gml/deep-strict-equal.js +0 -9
- package/dist/esm/lib/parsers/gml/deep-strict-equal.js.map +1 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js +0 -14
- package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js +151 -42
- package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-error.js +0 -3
- package/dist/esm/lib/parsers/wms/parse-wms-error.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-features.js +0 -3
- package/dist/esm/lib/parsers/wms/parse-wms-features.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js +0 -3
- package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
- package/dist/esm/lib/parsers/xml/parse-xml-helpers.js +53 -0
- package/dist/esm/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js +0 -11
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/esm/lib/services/arcgis/arcgis-server.js +0 -2
- package/dist/esm/lib/services/arcgis/arcgis-server.js.map +1 -1
- package/dist/esm/lib/services/generic/image-service.js +0 -7
- package/dist/esm/lib/services/generic/image-service.js.map +1 -1
- package/dist/esm/lib/services/ogc/csw-service.js +0 -13
- package/dist/esm/lib/services/ogc/csw-service.js.map +1 -1
- package/dist/esm/lib/services/ogc/wms-service.js +135 -86
- package/dist/esm/lib/services/ogc/wms-service.js.map +1 -1
- package/dist/esm/lib/sources/data-source.js +20 -6
- package/dist/esm/lib/sources/data-source.js.map +1 -1
- package/dist/esm/lib/sources/image-source.js +0 -3
- package/dist/esm/lib/sources/image-source.js.map +1 -1
- package/dist/esm/lib/sources/tile-source.js +0 -3
- package/dist/esm/lib/sources/tile-source.js.map +1 -1
- package/dist/esm/lib/sources/utils/utils.js +0 -5
- package/dist/esm/lib/sources/utils/utils.js.map +1 -1
- package/dist/esm/wip/arcgis-feature-service.js +0 -3
- package/dist/esm/wip/arcgis-feature-service.js.map +1 -1
- package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js +0 -3
- package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
- package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js +0 -3
- package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
- package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js +0 -3
- package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js +1 -4
- package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js +1 -4
- package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -1
- package/dist/esm/wip/wms-feature-info-loader.js +0 -2
- package/dist/esm/wip/wms-feature-info-loader.js.map +1 -1
- package/dist/esm/wip/wms-layer-description-loader.js +0 -2
- package/dist/esm/wip/wms-layer-description-loader.js.map +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js +1 -6
- package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-capabilities-loader.js +3 -7
- package/dist/esm/wms-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-error-loader.js +1 -4
- package/dist/esm/wms-error-loader.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/lib/create-image-source.d.ts +1 -1
- package/dist/lib/create-image-source.d.ts.map +1 -1
- package/dist/lib/parsers/wms/parse-wms-capabilities.d.ts +78 -62
- package/dist/lib/parsers/wms/parse-wms-capabilities.d.ts.map +1 -1
- package/dist/lib/parsers/wms/parse-wms-capabilities.js +166 -1935
- package/dist/lib/parsers/xml/parse-xml-helpers.d.ts +11 -0
- package/dist/lib/parsers/xml/parse-xml-helpers.d.ts.map +1 -0
- package/dist/lib/parsers/xml/parse-xml-helpers.js +68 -0
- package/dist/lib/services/arcgis/arcgis-image-service.d.ts +1 -2
- package/dist/lib/services/arcgis/arcgis-image-service.d.ts.map +1 -1
- package/dist/lib/services/arcgis/arcgis-image-service.js +1 -2
- package/dist/lib/services/generic/image-service.d.ts +2 -3
- package/dist/lib/services/generic/image-service.d.ts.map +1 -1
- package/dist/lib/services/generic/image-service.js +1 -2
- package/dist/lib/services/ogc/csw-service.d.ts +2 -3
- package/dist/lib/services/ogc/csw-service.d.ts.map +1 -1
- package/dist/lib/services/ogc/csw-service.js +1 -2
- package/dist/lib/services/ogc/wms-service.d.ts +128 -72
- package/dist/lib/services/ogc/wms-service.d.ts.map +1 -1
- package/dist/lib/services/ogc/wms-service.js +154 -73
- package/dist/lib/sources/data-source.d.ts +12 -2
- package/dist/lib/sources/data-source.d.ts.map +1 -1
- package/dist/lib/sources/data-source.js +22 -0
- package/dist/lib/sources/image-source.d.ts +9 -15
- package/dist/lib/sources/image-source.d.ts.map +1 -1
- package/dist/lib/sources/tile-source.d.ts +4 -2
- package/dist/lib/sources/tile-source.d.ts.map +1 -1
- package/dist/wip/wmts-capabilities-loader.d.ts +3 -4
- package/dist/wip/wmts-capabilities-loader.d.ts.map +1 -1
- package/dist/wip/wmts-capabilities-loader.js +1 -0
- package/dist/wms-capabilities-loader.d.ts +6 -1
- package/dist/wms-capabilities-loader.d.ts.map +1 -1
- package/dist/wms-capabilities-loader.js +2 -2
- package/package.json +6 -6
- package/src/index.ts +3 -4
- package/src/lib/create-image-source.ts +1 -1
- package/src/lib/parsers/wms/parse-wms-capabilities.ts +294 -2004
- package/src/lib/parsers/xml/parse-xml-helpers.ts +65 -0
- package/src/lib/services/arcgis/arcgis-image-service.ts +1 -4
- package/src/lib/services/generic/image-service.ts +2 -5
- package/src/lib/services/ogc/csw-service.ts +2 -4
- package/src/lib/services/ogc/wms-service.ts +290 -125
- package/src/lib/sources/data-source.ts +29 -2
- package/src/lib/sources/image-source.ts +9 -15
- package/src/lib/sources/tile-source.ts +4 -2
- package/src/wip/wmts-capabilities-loader.ts +2 -2
- package/src/wms-capabilities-loader.ts +9 -3
- package/dist/es5/lib/services/generic/tile-service.js +0 -2
- package/dist/es5/lib/services/generic/tile-service.js.map +0 -1
- package/dist/esm/lib/services/generic/tile-service.js +0 -2
- package/dist/esm/lib/services/generic/tile-service.js.map +0 -1
- package/dist/lib/services/generic/tile-service.d.ts +0 -1
- package/dist/lib/services/generic/tile-service.d.ts.map +0 -1
- package/dist/lib/services/generic/tile-service.js +0 -1
- package/src/lib/services/generic/tile-service.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-csw-records.js","names":["convertXMLFieldToArrayInPlace","XMLLoader","parseExceptionReport","parseCSWRecords","text","options","parsedXML","parseTextSync","xml","removeNSPrefix","uncapitalizeKeys","arrayPaths","_fastXML","parseAttributeValue","xmlRecords","getRecordsResponse","elementSet","searchResults","recordsFieldName","records","record","boundingBoxes","boundingBox","value","upperCorner","lowerCorner","renameXMLTags","renameKeys","oldKey","newKey","Object","entries"],"sources":["../../../../../src/lib/parsers/csw/parse-csw-records.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoaderOptions, convertXMLFieldToArrayInPlace} from '@loaders.gl/xml';\nimport {XMLLoader} from '@loaders.gl/xml';\nimport {parseExceptionReport} from './parse-exception-report';\n\nexport type CSWRecords = {\n searchStatus: {\n timestamp?: string;\n };\n searchResults: {\n numberOfRecordsMatched: number;\n numberOfRecordsReturned: number;\n elementSet: string;\n nextRecord: number;\n };\n records: {\n type: string;\n title: string;\n abstract: string;\n subject: string[];\n boundingBoxes: {\n crs: string;\n value: [number, number, number, number];\n }[];\n references: {\n value: string;\n scheme: string;\n }[];\n }[];\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetRecords` response\n * @note Error handlings is fairly weak\n */\nexport function parseCSWRecords(text: string, options?: XMLLoaderOptions): CSWRecords {\n const parsedXML = XMLLoader.parseTextSync(text, {\n ...options,\n xml: {\n ...options?.xml,\n removeNSPrefix: true,\n uncapitalizeKeys: true,\n arrayPaths: []\n },\n _fastXML: {\n ...options?._fastXML,\n parseAttributeValue: true\n }\n });\n\n parseExceptionReport(parsedXML);\n\n const xmlRecords: any = parsedXML.getRecordsResponse;\n\n // Move results to top\n const elementSet = xmlRecords.searchResults.elementSet;\n const recordsFieldName = `${elementSet}Record`;\n xmlRecords.records = xmlRecords.searchResults[recordsFieldName];\n delete xmlRecords.searchResults[recordsFieldName];\n\n convertXMLFieldToArrayInPlace(xmlRecords, 'records');\n\n for (const record of xmlRecords.records) {\n record.boundingBoxes = record.boundingBox;\n delete record.boundingBox;\n\n convertXMLFieldToArrayInPlace(record, 'boundingBoxes');\n\n for (const boundingBox of record.boundingBoxes) {\n boundingBox.value = [\n boundingBox.upperCorner[0],\n boundingBox.upperCorner[1],\n boundingBox.lowerCorner[0],\n boundingBox.lowerCorner[1]\n ];\n delete boundingBox.upperCorner;\n delete boundingBox.lowerCorner;\n }\n }\n\n return xmlRecords as CSWRecords;\n}\n\nexport function renameXMLTags(xml: any, renameKeys: Record<string, string>): void {\n for (const [oldKey, newKey] of Object.entries(renameKeys)) {\n xml[newKey] = xml[oldKey];\n delete xml[oldKey];\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-csw-records.js","names":["convertXMLFieldToArrayInPlace","XMLLoader","parseExceptionReport","parseCSWRecords","text","options","parsedXML","parseTextSync","xml","removeNSPrefix","uncapitalizeKeys","arrayPaths","_fastXML","parseAttributeValue","xmlRecords","getRecordsResponse","elementSet","searchResults","recordsFieldName","concat","records","record","boundingBoxes","boundingBox","value","upperCorner","lowerCorner","renameXMLTags","renameKeys","oldKey","newKey","Object","entries"],"sources":["../../../../../src/lib/parsers/csw/parse-csw-records.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoaderOptions, convertXMLFieldToArrayInPlace} from '@loaders.gl/xml';\nimport {XMLLoader} from '@loaders.gl/xml';\nimport {parseExceptionReport} from './parse-exception-report';\n\nexport type CSWRecords = {\n searchStatus: {\n timestamp?: string;\n };\n searchResults: {\n numberOfRecordsMatched: number;\n numberOfRecordsReturned: number;\n elementSet: string;\n nextRecord: number;\n };\n records: {\n type: string;\n title: string;\n abstract: string;\n subject: string[];\n boundingBoxes: {\n crs: string;\n value: [number, number, number, number];\n }[];\n references: {\n value: string;\n scheme: string;\n }[];\n }[];\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetRecords` response\n * @note Error handlings is fairly weak\n */\nexport function parseCSWRecords(text: string, options?: XMLLoaderOptions): CSWRecords {\n const parsedXML = XMLLoader.parseTextSync(text, {\n ...options,\n xml: {\n ...options?.xml,\n removeNSPrefix: true,\n uncapitalizeKeys: true,\n arrayPaths: []\n },\n _fastXML: {\n ...options?._fastXML,\n parseAttributeValue: true\n }\n });\n\n parseExceptionReport(parsedXML);\n\n const xmlRecords: any = parsedXML.getRecordsResponse;\n\n // Move results to top\n const elementSet = xmlRecords.searchResults.elementSet;\n const recordsFieldName = `${elementSet}Record`;\n xmlRecords.records = xmlRecords.searchResults[recordsFieldName];\n delete xmlRecords.searchResults[recordsFieldName];\n\n convertXMLFieldToArrayInPlace(xmlRecords, 'records');\n\n for (const record of xmlRecords.records) {\n record.boundingBoxes = record.boundingBox;\n delete record.boundingBox;\n\n convertXMLFieldToArrayInPlace(record, 'boundingBoxes');\n\n for (const boundingBox of record.boundingBoxes) {\n boundingBox.value = [\n boundingBox.upperCorner[0],\n boundingBox.upperCorner[1],\n boundingBox.lowerCorner[0],\n boundingBox.lowerCorner[1]\n ];\n delete boundingBox.upperCorner;\n delete boundingBox.lowerCorner;\n }\n }\n\n return xmlRecords as CSWRecords;\n}\n\nexport function renameXMLTags(xml: any, renameKeys: Record<string, string>): void {\n for (const [oldKey, newKey] of Object.entries(renameKeys)) {\n xml[newKey] = xml[oldKey];\n delete xml[oldKey];\n }\n}\n"],"mappings":"AAEA,SAA0BA,6BAA6B,QAAO,iBAAiB;AAC/E,SAAQC,SAAS,QAAO,iBAAiB;AACzC,SAAQC,oBAAoB,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W,CAACG,WAAW,CAAC,CAAC,CAAC,CAC3B;MACD,OAAOH,WAAW,CAACE,WAAW;MAC9B,OAAOF,WAAW,CAACG,WAAW;IAChC;EACF;EAEA,OAAOZ,UAAU;AACnB;AAEA,OAAO,SAASa,aAAaA,CAACnB,GAAQ,EAAEoB,UAAkC,EAAQ;EAChF,KAAK,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACJ,UAAU,CAAC,EAAE;IACzDpB,GAAG,CAACsB,MAAM,CAAC,GAAGtB,GAAG,CAACqB,MAAM,CAAC;IACzB,OAAOrB,GAAG,CAACqB,MAAM,CAAC;EACpB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-exception-report.js","names":["parseExceptionReport","parsedXML","exceptionReport","errorMessage","exception","exceptionText","exceptionCode","locator","Error"],"sources":["../../../../../src/lib/parsers/csw/parse-exception-report.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// import type {XMLLoaderOptions} from '@loaders.gl/xml';\n// import {XMLLoader} from '@loaders.gl/xml';\n\n/**\n * Parses a typed data structure from raw XML for `GetDomain` response\n * @note Error handlings is fairly weak\n */\nexport function parseExceptionReport(parsedXML: any): void {\n // const parsedXML = XMLLoader.parseTextSync(text, {\n // ...options,\n // xml: {\n // ...options?.xml,\n // removeNSPrefix: true,\n // uncapitalizeKeys: true\n // }\n // });\n\n const exceptionReport: any = parsedXML.exceptionReport;\n if (!exceptionReport) {\n return;\n }\n const errorMessage =\n exceptionReport.exception?.exceptionText ||\n exceptionReport.exception?.exceptionCode ||\n exceptionReport.exception?.locator ||\n 'server error';\n\n throw new Error(`Catalog Server: ${errorMessage}`);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-exception-report.js","names":["parseExceptionReport","parsedXML","_exceptionReport$exce","_exceptionReport$exce2","_exceptionReport$exce3","exceptionReport","errorMessage","exception","exceptionText","exceptionCode","locator","Error","concat"],"sources":["../../../../../src/lib/parsers/csw/parse-exception-report.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// import type {XMLLoaderOptions} from '@loaders.gl/xml';\n// import {XMLLoader} from '@loaders.gl/xml';\n\n/**\n * Parses a typed data structure from raw XML for `GetDomain` response\n * @note Error handlings is fairly weak\n */\nexport function parseExceptionReport(parsedXML: any): void {\n // const parsedXML = XMLLoader.parseTextSync(text, {\n // ...options,\n // xml: {\n // ...options?.xml,\n // removeNSPrefix: true,\n // uncapitalizeKeys: true\n // }\n // });\n\n const exceptionReport: any = parsedXML.exceptionReport;\n if (!exceptionReport) {\n return;\n }\n const errorMessage =\n exceptionReport.exception?.exceptionText ||\n exceptionReport.exception?.exceptionCode ||\n exceptionReport.exception?.locator ||\n 'server error';\n\n throw new Error(`Catalog Server: ${errorMessage}`);\n}\n"],"mappings":"AASA,OAAO,SAASA,oBAAoBA,CAACC,SAAc,EAAQ;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EAUzD,MAAMC,eAAoB,GAAGJ,SAAS,CAACI,eAAe;EACtD,IAAI,CAACA,eAAe,EAAE;IACpB;EACF;EACA,MAAMC,YAAY,GAChB,EAAAJ,qBAAA,GAAAG,eAAe,CAACE,SAAS,cAAAL,qBAAA,uBAAzBA,qBAAA,CAA2BM,aAAa,OAAAL,sBAAA,GACxCE,eAAe,CAACE,SAAS,cAAAJ,sBAAA,uBAAzBA,sBAAA,CAA2BM,aAAa,OAAAL,sBAAA,GACxCC,eAAe,CAACE,SAAS,cAAAH,sBAAA,uBAAzBA,sBAAA,CAA2BM,OAAO,KAClC,cAAc;EAEhB,MAAM,IAAIC,KAAK,oBAAAC,MAAA,CAAoBN,YAAY,CAAE,CAAC;AACpD"}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
export function deepStrictEqual(actual, expected, strict) {
|
|
4
2
|
if (actual === expected) {
|
|
5
3
|
return true;
|
|
6
|
-
|
|
7
4
|
} else if (actual instanceof Date && expected instanceof Date) {
|
|
8
5
|
return actual.getTime() === expected.getTime();
|
|
9
|
-
|
|
10
6
|
} else if (actual instanceof RegExp && expected instanceof RegExp) {
|
|
11
7
|
return actual.source === expected.source && actual.global === expected.global && actual.multiline === expected.multiline && actual.lastIndex === expected.lastIndex && actual.ignoreCase === expected.ignoreCase;
|
|
12
|
-
|
|
13
8
|
} else if ((actual === null || typeof actual !== 'object') && (expected === null || typeof expected !== 'object')) {
|
|
14
9
|
return strict ? actual === expected : actual == expected;
|
|
15
|
-
|
|
16
10
|
}
|
|
17
|
-
|
|
18
11
|
return objEquiv(actual, expected, strict);
|
|
19
12
|
}
|
|
20
|
-
|
|
21
13
|
const pSlice = Array.prototype.slice;
|
|
22
14
|
function isPrimitive(arg) {
|
|
23
15
|
return arg === null || typeof arg !== 'object' && typeof arg !== 'function';
|
|
@@ -25,7 +17,6 @@ function isPrimitive(arg) {
|
|
|
25
17
|
function isArguments(object) {
|
|
26
18
|
return Object.prototype.toString.call(object) == '[object Arguments]';
|
|
27
19
|
}
|
|
28
|
-
|
|
29
20
|
function objEquiv(a, b, strict) {
|
|
30
21
|
if (a === null || a === undefined || b === null || b === undefined) return false;
|
|
31
22
|
if (isPrimitive(a) || isPrimitive(b)) return a === b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-strict-equal.js","names":["deepStrictEqual","actual","expected","strict","Date","getTime","RegExp","source","global","multiline","lastIndex","ignoreCase","objEquiv","pSlice","Array","prototype","slice","isPrimitive","arg","isArguments","object","Object","toString","call","a","b","undefined","getPrototypeOf","aIsArgs","bIsArgs","ka","keys","kb","key","i","length","sort"],"sources":["../../../../../src/lib/parsers/gml/deep-strict-equal.ts"],"sourcesContent":["// https://github.com/nodejs/node/commit/c1d82ac2ff15594840e2a1b9531b506ae067ed27;\n\n// http://wiki.commonjs.org/wiki/Unit_Testing/1.0\n//\n// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!\n//\n// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n/** @todo replace this ridiculous choice of deepStrictEqual */\n// eslint-disable-next-line complexity\nexport function deepStrictEqual(actual: unknown, expected: unknown, strict?: boolean) {\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n // } else if (actual instanceof Buffer && expected instanceof Buffer) {\n // return compare(actual, expected) === 0;\n\n // // 7.2. If the expected value is a Date object, the actual value is\n // // equivalent if it is also a Date object that refers to the same time.\n } else if (actual instanceof Date && expected instanceof Date) {\n return actual.getTime() === expected.getTime();\n\n // 7.3 If the expected value is a RegExp object, the actual value is\n // equivalent if it is also a RegExp object with the same source and\n // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).\n } else if (actual instanceof RegExp && expected instanceof RegExp) {\n return (\n actual.source === expected.source &&\n actual.global === expected.global &&\n actual.multiline === expected.multiline &&\n actual.lastIndex === expected.lastIndex &&\n actual.ignoreCase === expected.ignoreCase\n );\n\n // 7.4. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (\n (actual === null || typeof actual !== 'object') &&\n (expected === null || typeof expected !== 'object')\n ) {\n // eslint-disable-next-line eqeqeq\n return strict ? actual === expected : actual == expected;\n\n // 7.5 For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n }\n return objEquiv(actual, expected, strict);\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst pSlice = Array.prototype.slice;\n\nfunction isPrimitive(arg) {\n return arg === null || (typeof arg !== 'object' && typeof arg !== 'function');\n}\n\nfunction isArguments(object) {\n // eslint-disable-next-line eqeqeq\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\n// eslint-disable-next-line complexity\nfunction objEquiv(a: unknown, b: unknown, strict) {\n if (a === null || a === undefined || b === null || b === undefined) return false;\n // if one is a primitive, the other must be same\n if (isPrimitive(a) || isPrimitive(b)) return a === b;\n if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;\n const aIsArgs = isArguments(a);\n const bIsArgs = isArguments(b);\n if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) return false;\n if (aIsArgs) {\n a = pSlice.call(a);\n b = pSlice.call(b);\n return deepStrictEqual(a, b, strict);\n }\n const ka = Object.keys(a);\n const kb = Object.keys(b);\n let key;\n let i;\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length !== kb.length) return false;\n // the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n // ~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] !== kb[i]) return false;\n }\n // equivalent values for every corresponding key, and\n // ~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepStrictEqual(a[key], b[key], strict)) return false;\n }\n return true;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"deep-strict-equal.js","names":["deepStrictEqual","actual","expected","strict","Date","getTime","RegExp","source","global","multiline","lastIndex","ignoreCase","objEquiv","pSlice","Array","prototype","slice","isPrimitive","arg","isArguments","object","Object","toString","call","a","b","undefined","getPrototypeOf","aIsArgs","bIsArgs","ka","keys","kb","key","i","length","sort"],"sources":["../../../../../src/lib/parsers/gml/deep-strict-equal.ts"],"sourcesContent":["// https://github.com/nodejs/node/commit/c1d82ac2ff15594840e2a1b9531b506ae067ed27;\n\n// http://wiki.commonjs.org/wiki/Unit_Testing/1.0\n//\n// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!\n//\n// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n/** @todo replace this ridiculous choice of deepStrictEqual */\n// eslint-disable-next-line complexity\nexport function deepStrictEqual(actual: unknown, expected: unknown, strict?: boolean) {\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n // } else if (actual instanceof Buffer && expected instanceof Buffer) {\n // return compare(actual, expected) === 0;\n\n // // 7.2. If the expected value is a Date object, the actual value is\n // // equivalent if it is also a Date object that refers to the same time.\n } else if (actual instanceof Date && expected instanceof Date) {\n return actual.getTime() === expected.getTime();\n\n // 7.3 If the expected value is a RegExp object, the actual value is\n // equivalent if it is also a RegExp object with the same source and\n // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).\n } else if (actual instanceof RegExp && expected instanceof RegExp) {\n return (\n actual.source === expected.source &&\n actual.global === expected.global &&\n actual.multiline === expected.multiline &&\n actual.lastIndex === expected.lastIndex &&\n actual.ignoreCase === expected.ignoreCase\n );\n\n // 7.4. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (\n (actual === null || typeof actual !== 'object') &&\n (expected === null || typeof expected !== 'object')\n ) {\n // eslint-disable-next-line eqeqeq\n return strict ? actual === expected : actual == expected;\n\n // 7.5 For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n }\n return objEquiv(actual, expected, strict);\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst pSlice = Array.prototype.slice;\n\nfunction isPrimitive(arg) {\n return arg === null || (typeof arg !== 'object' && typeof arg !== 'function');\n}\n\nfunction isArguments(object) {\n // eslint-disable-next-line eqeqeq\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\n// eslint-disable-next-line complexity\nfunction objEquiv(a: unknown, b: unknown, strict) {\n if (a === null || a === undefined || b === null || b === undefined) return false;\n // if one is a primitive, the other must be same\n if (isPrimitive(a) || isPrimitive(b)) return a === b;\n if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;\n const aIsArgs = isArguments(a);\n const bIsArgs = isArguments(b);\n if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) return false;\n if (aIsArgs) {\n a = pSlice.call(a);\n b = pSlice.call(b);\n return deepStrictEqual(a, b, strict);\n }\n const ka = Object.keys(a);\n const kb = Object.keys(b);\n let key;\n let i;\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length !== kb.length) return false;\n // the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n // ~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] !== kb[i]) return false;\n }\n // equivalent values for every corresponding key, and\n // ~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepStrictEqual(a[key], b[key], strict)) return false;\n }\n return true;\n}\n"],"mappings":"AA4BA,OAAO,SAASA,eAAeA,CAACC,MAAe,EAAEC,QAAiB,EAAEC,MAAgB,EAAE;EAEpF,IAAIF,MAAM,KAAKC,QAAQ,EAAE;IACvB,OAAO,IAAI;EAMb,CAAC,MAAM,IAAID,MAAM,YAAYG,IAAI,IAAIF,QAAQ,YAAYE,IAAI,EAAE;IAC7D,OAAOH,MAAM,CAACI,OAAO,CAAC,CAAC,KAAKH,QAAQ,CAACG,OAAO,CAAC,CAAC;EAKhD,CAAC,MAAM,IAAIJ,MAAM,YAAYK,MAAM,IAAIJ,QAAQ,YAAYI,MAAM,EAAE;IACjE,OACEL,MAAM,CAACM,MAAM,KAAKL,QAAQ,CAACK,MAAM,IACjCN,MAAM,CAACO,MAAM,KAAKN,QAAQ,CAACM,MAAM,IACjCP,MAAM,CAACQ,SAAS,KAAKP,QAAQ,CAACO,SAAS,IACvCR,MAAM,CAACS,SAAS,KAAKR,QAAQ,CAACQ,SAAS,IACvCT,MAAM,CAACU,UAAU,KAAKT,QAAQ,CAACS,UAAU;EAK7C,CAAC,MAAM,IACL,CAACV,MAAM,KAAK,IAAI,IAAI,OAAOA,MAAM,KAAK,QAAQ,MAC7CC,QAAQ,K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AC;IAClBC,CAAC,GAAGZ,MAAM,CAACU,IAAI,CAACE,CAAC,CAAC;IAClB,OAAOzB,eAAe,CAACwB,CAAC,EAAEC,CAAC,EAAEtB,MAAM,CAAC;EACtC;EACA,MAAM2B,EAAE,GAAGT,MAAM,CAACU,IAAI,CAACP,CAAC,CAAC;EACzB,MAAMQ,EAAE,GAAGX,MAAM,CAACU,IAAI,CAACN,CAAC,CAAC;EACzB,IAAIQ,GAAG;EACP,IAAIC,CAAC;EAGL,IAAIJ,EAAE,CAACK,MAAM,KAAKH,EAAE,CAACG,MAAM,EAAE,OAAO,KAAK;EAEzCL,EAAE,CAACM,IAAI,CAAC,CAAC;EACTJ,EAAE,CAACI,IAAI,CAAC,CAAC;EAET,KAAKF,CAAC,GAAGJ,EAAE,CAACK,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IACnC,IAAIJ,EAAE,CAACI,CAAC,CAAC,KAAKF,EAAE,CAACE,CAAC,CAAC,EAAE,OAAO,KAAK;EACnC;EAGA,KAAKA,CAAC,GAAGJ,EAAE,CAACK,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IACnCD,GAAG,GAAGH,EAAE,CAACI,CAAC,CAAC;IACX,IAAI,CAAClC,eAAe,CAACwB,CAAC,CAACS,GAAG,CAAC,EAAER,CAAC,CAACQ,GAAG,CAAC,EAAE9B,MAAM,CAAC,EAAE,OAAO,KAAK;EAC5D;EACA,OAAO,IAAI;AACb"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
import { XMLLoader } from '@loaders.gl/xml';
|
|
4
2
|
import { deepStrictEqual } from './deep-strict-equal';
|
|
5
3
|
import rewind from '@turf/rewind';
|
|
@@ -19,20 +17,17 @@ export function parseGML(text, options) {
|
|
|
19
17
|
const context = createChildContext(parsedXML, options, {});
|
|
20
18
|
return parseGMLToGeometry(parsedXML, options, context);
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
export function parseGMLToGeometry(inputXML, options, context) {
|
|
24
21
|
const childContext = createChildContext(inputXML, options, context);
|
|
25
22
|
let geometry = null;
|
|
26
23
|
const [name, xml] = getFirstKeyValue(inputXML);
|
|
27
24
|
switch (name) {
|
|
28
|
-
|
|
29
25
|
case 'gml:LineString':
|
|
30
26
|
geometry = {
|
|
31
27
|
type: 'LineString',
|
|
32
28
|
coordinates: parseLinearRingOrLineString(xml, options, childContext)
|
|
33
29
|
};
|
|
34
30
|
break;
|
|
35
|
-
|
|
36
31
|
case 'gml:Polygon':
|
|
37
32
|
case 'gml:Rectangle':
|
|
38
33
|
geometry = {
|
|
@@ -55,15 +50,12 @@ export function parseGMLToGeometry(inputXML, options, context) {
|
|
|
55
50
|
default:
|
|
56
51
|
return null;
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
return rewind(geometry, {
|
|
60
54
|
mutate: true
|
|
61
55
|
});
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
function parseCoords(s, options, context) {
|
|
65
58
|
const stride = context.srsDimension || options.stride || 2;
|
|
66
|
-
|
|
67
59
|
const coords = s.replace(/\s+/g, ' ').trim().split(' ');
|
|
68
60
|
if (coords.length === 0 || coords.length % stride !== 0) {
|
|
69
61
|
throw new Error("invalid coordinates list (stride ".concat(stride, ")"));
|
|
@@ -98,7 +90,6 @@ export function parsePos(xml, options, context) {
|
|
|
98
90
|
}
|
|
99
91
|
export function parsePoint(xml, options, context) {
|
|
100
92
|
const childContext = createChildContext(xml, options, context);
|
|
101
|
-
|
|
102
93
|
const pos = findIn(xml, 'gml:pos');
|
|
103
94
|
if (!pos) {
|
|
104
95
|
throw new Error('invalid gml:Point element, expected a gml:pos subelement');
|
|
@@ -136,7 +127,6 @@ export function parseCurveSegments(xml, options, context) {
|
|
|
136
127
|
switch (childName) {
|
|
137
128
|
case 'gml:LineStringSegment':
|
|
138
129
|
const points2 = parseLinearRingOrLineString(childXML, options, context);
|
|
139
|
-
|
|
140
130
|
const end = points[points.length - 1];
|
|
141
131
|
const start = points2[0];
|
|
142
132
|
if (end && start && deepStrictEqual(end, start)) {
|
|
@@ -170,7 +160,6 @@ export function parseRing(xml, options, context) {
|
|
|
170
160
|
}
|
|
171
161
|
points2 = parseCurveSegments(segments, options, childContext);
|
|
172
162
|
}
|
|
173
|
-
|
|
174
163
|
const end = points[points.length - 1];
|
|
175
164
|
const start = points2[0];
|
|
176
165
|
if (end && start && deepStrictEqual(end, start)) {
|
|
@@ -301,7 +290,6 @@ function parseSurfaceMember(xml, options, context) {
|
|
|
301
290
|
}
|
|
302
291
|
throw new Error("".concat(childName, " must have polygons"));
|
|
303
292
|
}
|
|
304
|
-
|
|
305
293
|
function textOf(el) {
|
|
306
294
|
if (typeof el !== 'string') {
|
|
307
295
|
throw new Error('expected string');
|
|
@@ -322,7 +310,6 @@ function findIn(root) {
|
|
|
322
310
|
}
|
|
323
311
|
return el;
|
|
324
312
|
}
|
|
325
|
-
|
|
326
313
|
function getFirstKeyValue(object) {
|
|
327
314
|
if (object && typeof object === 'object') {
|
|
328
315
|
for (const [key, value] of Object.entries(object)) {
|
|
@@ -331,7 +318,6 @@ function getFirstKeyValue(object) {
|
|
|
331
318
|
}
|
|
332
319
|
return ['', null];
|
|
333
320
|
}
|
|
334
|
-
|
|
335
321
|
function createChildContext(xml, options, context) {
|
|
336
322
|
const srsDimensionAttribute = xml.attributes && xml.attributes.srsDimension;
|
|
337
323
|
if (srsDimensionAttribute) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-gml.js","names":["XMLLoader","deepStrictEqual","rewind","noTransform","coords","parseGML","text","options","parsedXML","parseTextSync","transformCoords","stride","context","createChildContext","parseGMLToGeometry","inputXML","childContext","geometry","name","xml","getFirstKeyValue","type","coordinates","parseLinearRingOrLineString","parsePolygonOrRectangle","parseSurface","parseMultiSurface","mutate","parseCoords","s","srsDimension","replace","trim","split","length","Error","points","i","point","slice","map","parseFloat","push","parsePosList","textOf","parsePos","parsePoint","pos","findIn","posList","childName","childXML","Object","entries","parseCurveSegments","points2","end","start","shift","parseRing","lineString","segments","parseExteriorOrInterior","linearRing","ring","exterior","pointLists","patches","polygons","parseCompositeSurface","c2Name","c2Xml","el","surfaceMembers","polygons2","polygons3","parseSurfaceMember","polygonXML","surfaceMemberXML","childXml","root","tags","tag","child","object","key","value","srsDimensionAttribute","attributes","parseInt","Number","isNaN","create"],"sources":["../../../../../src/lib/parsers/gml/parse-gml.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// Forked from https://github.com/derhuerst/parse-gml-polygon/blob/master/index.js\n// under ISC license\n\n/* eslint-disable no-continue, default-case */\n\nimport type {\n // GeoJSON,\n // Feature,\n // FeatureCollection,\n Geometry,\n Position\n // GeoJsonProperties,\n // Point,\n // MultiPoint,\n // LineString,\n // MultiLineString,\n // Polygon,\n // MultiPolygon,\n // GeometryCollection\n} from '@loaders.gl/schema';\n\nimport {XMLLoader} from '@loaders.gl/xml';\nimport {deepStrictEqual} from './deep-strict-equal';\nimport rewind from '@turf/rewind';\n\nfunction noTransform(...coords) {\n return coords;\n}\n\nexport type ParseGMLOptions = {\n transformCoords?: Function;\n stride?: 2 | 3 | 4;\n};\n\nexport type ParseGMLContext = {\n srsDimension?: number;\n [key: string]: any;\n};\n\n/**\n * Parses a typed data structure from raw XML for GML features\n * @note Error handlings is fairly weak\n */\nexport function parseGML(text: string, options) {\n // GeoJSON | null {\n const parsedXML = XMLLoader.parseTextSync(text, options);\n\n options = {transformCoords: noTransform, stride: 2, ...options};\n const context = createChildContext(parsedXML, options, {});\n\n return parseGMLToGeometry(parsedXML, options, context);\n}\n\n/** Parse a GeoJSON geometry from GML XML */\nexport function parseGMLToGeometry(\n inputXML: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Geometry | null {\n const childContext = createChildContext(inputXML, options, context);\n\n let geometry: Geometry | null = null;\n\n const [name, xml] = getFirstKeyValue(inputXML);\n\n switch (name) {\n // case 'gml:MultiPoint':\n // geometry = {\n // type: 'MultiPoint',\n // coordinates: parseMultiPoint(xml, options, childContext)\n // };\n // break;\n\n case 'gml:LineString':\n geometry = {\n type: 'LineString',\n coordinates: parseLinearRingOrLineString(xml, options, childContext)\n };\n break;\n\n // case 'gml:MultiLineString':\n // geometry = {\n // type: 'MultiLineString',\n // coordinates: parseMultiLineString(xml, options, childContext)\n // };\n // break;\n\n case 'gml:Polygon':\n case 'gml:Rectangle':\n geometry = {\n type: 'Polygon',\n coordinates: parsePolygonOrRectangle(xml, options, childContext)\n };\n break;\n case 'gml:Surface':\n geometry = {\n type: 'MultiPolygon',\n coordinates: parseSurface(xml, options, childContext)\n };\n break;\n case 'gml:MultiSurface':\n geometry = {\n type: 'MultiPolygon',\n coordinates: parseMultiSurface(xml, options, childContext)\n };\n break;\n\n default:\n return null;\n }\n\n // todo\n return rewind(geometry, {mutate: true});\n}\n\n/** Parse a list of coordinates from a string */\nfunction parseCoords(s: string, options: ParseGMLOptions, context: ParseGMLContext): Position[] {\n const stride = context.srsDimension || options.stride || 2;\n\n // Handle white space\n const coords = s.replace(/\\s+/g, ' ').trim().split(' ');\n\n if (coords.length === 0 || coords.length % stride !== 0) {\n throw new Error(`invalid coordinates list (stride ${stride})`);\n }\n\n const points: Position[] = [];\n for (let i = 0; i < coords.length - 1; i += stride) {\n const point = coords.slice(i, i + stride).map(parseFloat);\n points.push(options.transformCoords?.(...point) || point);\n }\n\n return points;\n}\n\nexport function parsePosList(xml: any, options: ParseGMLOptions, context: ParseGMLContext) {\n const childContext = createChildContext(xml, options, context);\n\n const coords = textOf(xml);\n if (!coords) {\n throw new Error('invalid gml:posList element');\n }\n\n return parseCoords(coords, options, childContext);\n}\n\nexport function parsePos(xml: any, options: ParseGMLOptions, context: ParseGMLContext): Position {\n const childContext = createChildContext(xml, options, context);\n\n const coords = textOf(xml);\n if (!coords) {\n throw new Error('invalid gml:pos element');\n }\n\n const points = parseCoords(coords, options, childContext);\n if (points.length !== 1) {\n throw new Error('gml:pos must have 1 point');\n }\n return points[0];\n}\n\nexport function parsePoint(xml: any, options: ParseGMLOptions, context: ParseGMLContext): number[] {\n const childContext = createChildContext(xml, options, context);\n\n // TODO AV: Parse other gml:Point options\n const pos = findIn(xml, 'gml:pos');\n if (!pos) {\n throw new Error('invalid gml:Point element, expected a gml:pos subelement');\n }\n return parsePos(pos, options, childContext);\n}\n\nexport function parseLinearRingOrLineString(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n // or a LineStringSegment\n const childContext = createChildContext(xml, options, context);\n\n let points: Position[] = [];\n\n const posList = findIn(xml, 'gml:posList');\n if (posList) {\n points = parsePosList(posList, options, childContext);\n } else {\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:Point':\n points.push(parsePoint(childXML, options, childContext));\n break;\n case 'gml:pos':\n points.push(parsePos(childXML, options, childContext));\n break;\n default:\n continue;\n }\n }\n }\n\n if (points.length === 0) {\n throw new Error(`${xml.name} must have > 0 points`);\n }\n return points;\n}\n\nexport function parseCurveSegments(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n const points: Position[] = [];\n\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:LineStringSegment':\n const points2 = parseLinearRingOrLineString(childXML, options, context);\n\n // remove overlapping\n const end = points[points.length - 1];\n const start = points2[0];\n if (end && start && deepStrictEqual(end, start)) {\n points2.shift();\n }\n\n points.push(...points2);\n break;\n default:\n continue;\n }\n }\n\n if (points.length === 0) {\n throw new Error('gml:Curve > gml:segments must have > 0 points');\n }\n return points;\n}\n\nexport function parseRing(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n const childContext = createChildContext(xml, options, context);\n\n const points: Position[] = [];\n\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:curveMember':\n let points2;\n\n const lineString = findIn(childXML, 'gml:LineString');\n if (lineString) {\n points2 = parseLinearRingOrLineString(lineString, options, childContext);\n } else {\n const segments = findIn(childXML, 'gml:Curve', 'gml:segments');\n if (!segments) {\n throw new Error(`invalid ${childName} element`);\n }\n\n points2 = parseCurveSegments(segments, options, childContext);\n }\n\n // remove overlapping\n const end = points[points.length - 1];\n const start = points2[0];\n if (end && start && deepStrictEqual(end, start)) {\n points2.shift();\n }\n\n points.push(...points2);\n\n break;\n }\n }\n\n if (points.length < 4) {\n throw new Error(`${xml.name} must have >= 4 points`);\n }\n return points;\n}\n\nexport function parseExteriorOrInterior(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n const linearRing = findIn(xml, 'gml:LinearRing');\n if (linearRing) {\n return parseLinearRingOrLineString(linearRing, options, context);\n }\n\n const ring = findIn(xml, 'gml:Ring');\n if (!ring) {\n throw new Error(`invalid ${xml.name} element`);\n }\n\n return parseRing(ring, options, context);\n}\n\nexport function parsePolygonOrRectangle(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][] {\n // or PolygonPatch\n const childContext = createChildContext(xml, options, context);\n\n const exterior = findIn(xml, 'gml:exterior');\n if (!exterior) {\n throw new Error(`invalid ${xml.name} element`);\n }\n\n const pointLists: Position[][] = [parseExteriorOrInterior(exterior, options, childContext)];\n\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:interior':\n pointLists.push(parseExteriorOrInterior(childXML, options, childContext));\n break;\n }\n }\n\n return pointLists;\n}\n\nexport function parseSurface(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n const childContext = createChildContext(xml, options, context);\n\n const patches = findIn(xml, 'gml:patches');\n if (!patches) {\n throw new Error(`invalid ${xml.name} element`);\n }\n\n const polygons: Position[][][] = [];\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:PolygonPatch':\n case 'gml:Rectangle':\n polygons.push(parsePolygonOrRectangle(childXML, options, childContext));\n break;\n\n default:\n continue;\n }\n }\n\n if (polygons.length === 0) {\n throw new Error(`${xml.name} must have > 0 polygons`);\n }\n\n return polygons;\n}\n\nexport function parseCompositeSurface(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n const childContext = createChildContext(xml, options, context);\n\n const polygons: Position[][][] = [];\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:surfaceMember':\n case 'gml:surfaceMembers':\n const [c2Name, c2Xml] = getFirstKeyValue(childXML);\n switch (c2Name) {\n case 'gml:Surface':\n polygons.push(...parseSurface(c2Xml, options, childContext));\n break;\n case 'gml:Polygon':\n polygons.push(parsePolygonOrRectangle(c2Xml, options, childContext));\n break;\n }\n break;\n }\n }\n\n if (polygons.length === 0) {\n throw new Error(`${xml.name} must have > 0 polygons`);\n }\n return polygons;\n}\n\nexport function parseMultiSurface(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n let el = xml;\n\n const surfaceMembers = findIn(xml, 'gml:LinearRing');\n if (surfaceMembers) {\n el = surfaceMembers;\n }\n\n const polygons: Position[][][] = [];\n for (const [childName, childXML] of Object.entries(el)) {\n switch (childName) {\n case 'gml:Surface':\n const polygons2 = parseSurface(childXML, options, context);\n polygons.push(...polygons2);\n break;\n case 'gml:surfaceMember':\n const polygons3 = parseSurfaceMember(childXML, options, context);\n polygons.push(...polygons3);\n break;\n\n case 'gml:surfaceMembers':\n const polygonXML = findIn(childXML, 'gml:Polygon');\n for (const surfaceMemberXML of polygonXML as []) {\n const polygons3 = parseSurfaceMember(surfaceMemberXML, options, context);\n polygons.push(...polygons3);\n }\n break;\n }\n }\n\n if (polygons.length === 0) {\n throw new Error(`${xml.name} must have > 0 polygons`);\n }\n\n return polygons;\n}\n\nfunction parseSurfaceMember(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n const [childName, childXml] = getFirstKeyValue(xml);\n switch (childName) {\n case 'gml:CompositeSurface':\n return parseCompositeSurface(childXml, options, context);\n case 'gml:Surface':\n return parseSurface(childXml, options, context);\n case 'gml:Polygon':\n return [parsePolygonOrRectangle(childXml, options, context)];\n }\n throw new Error(`${childName} must have polygons`);\n}\n\n// Helpers\n\nfunction textOf(el: any): string {\n if (typeof el !== 'string') {\n throw new Error('expected string');\n }\n return el;\n}\n\nfunction findIn(root: any, ...tags: string[]): any {\n let el = root;\n for (const tag of tags) {\n const child = el[tag];\n if (!child) {\n return null;\n }\n el = child;\n }\n return el;\n}\n\n/** @returns the first [key, value] pair in an object, or ['', null] if empty object */\nfunction getFirstKeyValue(object: any): [string, any] {\n if (object && typeof object === 'object') {\n for (const [key, value] of Object.entries(object)) {\n return [key, value];\n }\n }\n return ['', null];\n}\n\n/** A bit heavyweight for just tracking dimension? */\nfunction createChildContext(xml, options, context): ParseGMLContext {\n const srsDimensionAttribute = xml.attributes && xml.attributes.srsDimension;\n\n if (srsDimensionAttribute) {\n const srsDimension = parseInt(srsDimensionAttribute);\n if (Number.isNaN(srsDimension) || srsDimension <= 0) {\n throw new Error(\n `invalid srsDimension attribute value \"${srsDimensionAttribute}\", expected a positive integer`\n );\n }\n\n const childContext = Object.create(context);\n childContext.srsDimension = srsDimension;\n return childContext;\n }\n\n return context;\n}\n"],"mappings":";;AAuBA,SAAQA,SAAS,QAAO,iBAAiB;AACzC,SAAQC,eAAe,QAAO,qBAAqB;AACnD,OAAOC,MAAM,MAAM,cAAc;AAEjC,SAASC,WAAW,GAAY;EAAA,kCAARC,MAAM;IAANA,MAAM;EAAA;EAC5B,OAAOA,MAAM;AACf;AAgBA,OAAO,SAASC,QAAQ,CAACC,IAAY,EAAEC,OAAO,EAAE;EAE9C,MAAMC,SAAS,GAAGR,SAAS,CAACS,aAAa,CAACH,IAAI,EAAEC,OAAO,CAAC;EAExDA,OAAO,GAAG;IAACG,eAAe,EAAEP,WAAW;IAAEQ,MAAM,EAAE,CAAC;IAAE,GAAGJ;EAAO,CAAC;EAC/D,MAAMK,OAAO,G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I,EAAE;IACtB,MAAME,KAAK,GAAGX,EAAE,CAACU,GAAG,CAAC;IACrB,IAAI,CAACC,KAAK,EAAE;MACV,OAAO,IAAI;IACb;IACAX,EAAE,GAAGW,KAAK;EACZ;EACA,OAAOX,EAAE;AACX;;AAGA,SAASpD,gBAAgB,CAACgE,MAAW,EAAiB;EACpD,IAAIA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACxC,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIlC,MAAM,CAACC,OAAO,CAAC+B,MAAM,CAAC,EAAE;MACjD,OAAO,CAACC,GAAG,EAAEC,KAAK,CAAC;IACrB;EACF;EACA,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC;AACnB;;AAGA,SAASzE,kBAAkB,CAACM,GAAG,EAAEZ,OAAO,EAAEK,OAAO,EAAmB;EAClE,MAAM2E,qBAAqB,GAAGpE,GAAG,CAACqE,UAAU,IAAIrE,GAAG,CAACqE,UAAU,CAAC1D,YAAY;EAE3E,IAAIyD,qBAAqB,EAAE;IACzB,MAAMzD,YAAY,GAAG2D,QAAQ,CAACF,qBAAqB,CAAC;IACpD,IAAIG,MAAM,CAACC,KAAK,CAAC7D,YAAY,CAAC,IAAIA,YAAY,IAAI,CAAC,EAAE;MACnD,MAAM,IAAIK,KAAK,kDAC4BoD,qBAAqB,qCAC/D;IACH;IAEA,MAAMvE,YAAY,GAAGoC,MAAM,CAACwC,MAAM,CAAChF,OAAO,CAAC;IAC3CI,YAAY,CAACc,YAAY,GAAGA,YAAY;IACxC,OAAOd,YAAY;EACrB;EAEA,OAAOJ,OAAO;AAChB"}
|
|
1
|
+
{"version":3,"file":"parse-gml.js","names":["XMLLoader","deepStrictEqual","rewind","noTransform","_len","arguments","length","coords","Array","_key","parseGML","text","options","parsedXML","parseTextSync","transformCoords","stride","context","createChildContext","parseGMLToGeometry","inputXML","childContext","geometry","name","xml","getFirstKeyValue","type","coordinates","parseLinearRingOrLineString","parsePolygonOrRectangle","parseSurface","parseMultiSurface","mutate","parseCoords","s","srsDimension","replace","trim","split","Error","concat","points","i","_options$transformCoo","point","slice","map","parseFloat","push","call","parsePosList","textOf","parsePos","parsePoint","pos","findIn","posList","childName","childXML","Object","entries","parseCurveSegments","points2","end","start","shift","parseRing","lineString","segments","parseExteriorOrInterior","linearRing","ring","exterior","pointLists","patches","polygons","parseCompositeSurface","c2Name","c2Xml","el","surfaceMembers","polygons2","polygons3","parseSurfaceMember","polygonXML","surfaceMemberXML","childXml","root","_len2","tags","_key2","tag","child","object","key","value","srsDimensionAttribute","attributes","parseInt","Number","isNaN","create"],"sources":["../../../../../src/lib/parsers/gml/parse-gml.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// Forked from https://github.com/derhuerst/parse-gml-polygon/blob/master/index.js\n// under ISC license\n\n/* eslint-disable no-continue, default-case */\n\nimport type {\n // GeoJSON,\n // Feature,\n // FeatureCollection,\n Geometry,\n Position\n // GeoJsonProperties,\n // Point,\n // MultiPoint,\n // LineString,\n // MultiLineString,\n // Polygon,\n // MultiPolygon,\n // GeometryCollection\n} from '@loaders.gl/schema';\n\nimport {XMLLoader} from '@loaders.gl/xml';\nimport {deepStrictEqual} from './deep-strict-equal';\nimport rewind from '@turf/rewind';\n\nfunction noTransform(...coords) {\n return coords;\n}\n\nexport type ParseGMLOptions = {\n transformCoords?: Function;\n stride?: 2 | 3 | 4;\n};\n\nexport type ParseGMLContext = {\n srsDimension?: number;\n [key: string]: any;\n};\n\n/**\n * Parses a typed data structure from raw XML for GML features\n * @note Error handlings is fairly weak\n */\nexport function parseGML(text: string, options) {\n // GeoJSON | null {\n const parsedXML = XMLLoader.parseTextSync(text, options);\n\n options = {transformCoords: noTransform, stride: 2, ...options};\n const context = createChildContext(parsedXML, options, {});\n\n return parseGMLToGeometry(parsedXML, options, context);\n}\n\n/** Parse a GeoJSON geometry from GML XML */\nexport function parseGMLToGeometry(\n inputXML: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Geometry | null {\n const childContext = createChildContext(inputXML, options, context);\n\n let geometry: Geometry | null = null;\n\n const [name, xml] = getFirstKeyValue(inputXML);\n\n switch (name) {\n // case 'gml:MultiPoint':\n // geometry = {\n // type: 'MultiPoint',\n // coordinates: parseMultiPoint(xml, options, childContext)\n // };\n // break;\n\n case 'gml:LineString':\n geometry = {\n type: 'LineString',\n coordinates: parseLinearRingOrLineString(xml, options, childContext)\n };\n break;\n\n // case 'gml:MultiLineString':\n // geometry = {\n // type: 'MultiLineString',\n // coordinates: parseMultiLineString(xml, options, childContext)\n // };\n // break;\n\n case 'gml:Polygon':\n case 'gml:Rectangle':\n geometry = {\n type: 'Polygon',\n coordinates: parsePolygonOrRectangle(xml, options, childContext)\n };\n break;\n case 'gml:Surface':\n geometry = {\n type: 'MultiPolygon',\n coordinates: parseSurface(xml, options, childContext)\n };\n break;\n case 'gml:MultiSurface':\n geometry = {\n type: 'MultiPolygon',\n coordinates: parseMultiSurface(xml, options, childContext)\n };\n break;\n\n default:\n return null;\n }\n\n // todo\n return rewind(geometry, {mutate: true});\n}\n\n/** Parse a list of coordinates from a string */\nfunction parseCoords(s: string, options: ParseGMLOptions, context: ParseGMLContext): Position[] {\n const stride = context.srsDimension || options.stride || 2;\n\n // Handle white space\n const coords = s.replace(/\\s+/g, ' ').trim().split(' ');\n\n if (coords.length === 0 || coords.length % stride !== 0) {\n throw new Error(`invalid coordinates list (stride ${stride})`);\n }\n\n const points: Position[] = [];\n for (let i = 0; i < coords.length - 1; i += stride) {\n const point = coords.slice(i, i + stride).map(parseFloat);\n points.push(options.transformCoords?.(...point) || point);\n }\n\n return points;\n}\n\nexport function parsePosList(xml: any, options: ParseGMLOptions, context: ParseGMLContext) {\n const childContext = createChildContext(xml, options, context);\n\n const coords = textOf(xml);\n if (!coords) {\n throw new Error('invalid gml:posList element');\n }\n\n return parseCoords(coords, options, childContext);\n}\n\nexport function parsePos(xml: any, options: ParseGMLOptions, context: ParseGMLContext): Position {\n const childContext = createChildContext(xml, options, context);\n\n const coords = textOf(xml);\n if (!coords) {\n throw new Error('invalid gml:pos element');\n }\n\n const points = parseCoords(coords, options, childContext);\n if (points.length !== 1) {\n throw new Error('gml:pos must have 1 point');\n }\n return points[0];\n}\n\nexport function parsePoint(xml: any, options: ParseGMLOptions, context: ParseGMLContext): number[] {\n const childContext = createChildContext(xml, options, context);\n\n // TODO AV: Parse other gml:Point options\n const pos = findIn(xml, 'gml:pos');\n if (!pos) {\n throw new Error('invalid gml:Point element, expected a gml:pos subelement');\n }\n return parsePos(pos, options, childContext);\n}\n\nexport function parseLinearRingOrLineString(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n // or a LineStringSegment\n const childContext = createChildContext(xml, options, context);\n\n let points: Position[] = [];\n\n const posList = findIn(xml, 'gml:posList');\n if (posList) {\n points = parsePosList(posList, options, childContext);\n } else {\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:Point':\n points.push(parsePoint(childXML, options, childContext));\n break;\n case 'gml:pos':\n points.push(parsePos(childXML, options, childContext));\n break;\n default:\n continue;\n }\n }\n }\n\n if (points.length === 0) {\n throw new Error(`${xml.name} must have > 0 points`);\n }\n return points;\n}\n\nexport function parseCurveSegments(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n const points: Position[] = [];\n\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:LineStringSegment':\n const points2 = parseLinearRingOrLineString(childXML, options, context);\n\n // remove overlapping\n const end = points[points.length - 1];\n const start = points2[0];\n if (end && start && deepStrictEqual(end, start)) {\n points2.shift();\n }\n\n points.push(...points2);\n break;\n default:\n continue;\n }\n }\n\n if (points.length === 0) {\n throw new Error('gml:Curve > gml:segments must have > 0 points');\n }\n return points;\n}\n\nexport function parseRing(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n const childContext = createChildContext(xml, options, context);\n\n const points: Position[] = [];\n\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:curveMember':\n let points2;\n\n const lineString = findIn(childXML, 'gml:LineString');\n if (lineString) {\n points2 = parseLinearRingOrLineString(lineString, options, childContext);\n } else {\n const segments = findIn(childXML, 'gml:Curve', 'gml:segments');\n if (!segments) {\n throw new Error(`invalid ${childName} element`);\n }\n\n points2 = parseCurveSegments(segments, options, childContext);\n }\n\n // remove overlapping\n const end = points[points.length - 1];\n const start = points2[0];\n if (end && start && deepStrictEqual(end, start)) {\n points2.shift();\n }\n\n points.push(...points2);\n\n break;\n }\n }\n\n if (points.length < 4) {\n throw new Error(`${xml.name} must have >= 4 points`);\n }\n return points;\n}\n\nexport function parseExteriorOrInterior(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[] {\n const linearRing = findIn(xml, 'gml:LinearRing');\n if (linearRing) {\n return parseLinearRingOrLineString(linearRing, options, context);\n }\n\n const ring = findIn(xml, 'gml:Ring');\n if (!ring) {\n throw new Error(`invalid ${xml.name} element`);\n }\n\n return parseRing(ring, options, context);\n}\n\nexport function parsePolygonOrRectangle(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][] {\n // or PolygonPatch\n const childContext = createChildContext(xml, options, context);\n\n const exterior = findIn(xml, 'gml:exterior');\n if (!exterior) {\n throw new Error(`invalid ${xml.name} element`);\n }\n\n const pointLists: Position[][] = [parseExteriorOrInterior(exterior, options, childContext)];\n\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:interior':\n pointLists.push(parseExteriorOrInterior(childXML, options, childContext));\n break;\n }\n }\n\n return pointLists;\n}\n\nexport function parseSurface(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n const childContext = createChildContext(xml, options, context);\n\n const patches = findIn(xml, 'gml:patches');\n if (!patches) {\n throw new Error(`invalid ${xml.name} element`);\n }\n\n const polygons: Position[][][] = [];\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:PolygonPatch':\n case 'gml:Rectangle':\n polygons.push(parsePolygonOrRectangle(childXML, options, childContext));\n break;\n\n default:\n continue;\n }\n }\n\n if (polygons.length === 0) {\n throw new Error(`${xml.name} must have > 0 polygons`);\n }\n\n return polygons;\n}\n\nexport function parseCompositeSurface(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n const childContext = createChildContext(xml, options, context);\n\n const polygons: Position[][][] = [];\n for (const [childName, childXML] of Object.entries(xml)) {\n switch (childName) {\n case 'gml:surfaceMember':\n case 'gml:surfaceMembers':\n const [c2Name, c2Xml] = getFirstKeyValue(childXML);\n switch (c2Name) {\n case 'gml:Surface':\n polygons.push(...parseSurface(c2Xml, options, childContext));\n break;\n case 'gml:Polygon':\n polygons.push(parsePolygonOrRectangle(c2Xml, options, childContext));\n break;\n }\n break;\n }\n }\n\n if (polygons.length === 0) {\n throw new Error(`${xml.name} must have > 0 polygons`);\n }\n return polygons;\n}\n\nexport function parseMultiSurface(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n let el = xml;\n\n const surfaceMembers = findIn(xml, 'gml:LinearRing');\n if (surfaceMembers) {\n el = surfaceMembers;\n }\n\n const polygons: Position[][][] = [];\n for (const [childName, childXML] of Object.entries(el)) {\n switch (childName) {\n case 'gml:Surface':\n const polygons2 = parseSurface(childXML, options, context);\n polygons.push(...polygons2);\n break;\n case 'gml:surfaceMember':\n const polygons3 = parseSurfaceMember(childXML, options, context);\n polygons.push(...polygons3);\n break;\n\n case 'gml:surfaceMembers':\n const polygonXML = findIn(childXML, 'gml:Polygon');\n for (const surfaceMemberXML of polygonXML as []) {\n const polygons3 = parseSurfaceMember(surfaceMemberXML, options, context);\n polygons.push(...polygons3);\n }\n break;\n }\n }\n\n if (polygons.length === 0) {\n throw new Error(`${xml.name} must have > 0 polygons`);\n }\n\n return polygons;\n}\n\nfunction parseSurfaceMember(\n xml: any,\n options: ParseGMLOptions,\n context: ParseGMLContext\n): Position[][][] {\n const [childName, childXml] = getFirstKeyValue(xml);\n switch (childName) {\n case 'gml:CompositeSurface':\n return parseCompositeSurface(childXml, options, context);\n case 'gml:Surface':\n return parseSurface(childXml, options, context);\n case 'gml:Polygon':\n return [parsePolygonOrRectangle(childXml, options, context)];\n }\n throw new Error(`${childName} must have polygons`);\n}\n\n// Helpers\n\nfunction textOf(el: any): string {\n if (typeof el !== 'string') {\n throw new Error('expected string');\n }\n return el;\n}\n\nfunction findIn(root: any, ...tags: string[]): any {\n let el = root;\n for (const tag of tags) {\n const child = el[tag];\n if (!child) {\n return null;\n }\n el = child;\n }\n return el;\n}\n\n/** @returns the first [key, value] pair in an object, or ['', null] if empty object */\nfunction getFirstKeyValue(object: any): [string, any] {\n if (object && typeof object === 'object') {\n for (const [key, value] of Object.entries(object)) {\n return [key, value];\n }\n }\n return ['', null];\n}\n\n/** A bit heavyweight for just tracking dimension? */\nfunction createChildContext(xml, options, context): ParseGMLContext {\n const srsDimensionAttribute = xml.attributes && xml.attributes.srsDimension;\n\n if (srsDimensionAttribute) {\n const srsDimension = parseInt(srsDimensionAttribute);\n if (Number.isNaN(srsDimension) || srsDimension <= 0) {\n throw new Error(\n `invalid srsDimension attribute value \"${srsDimensionAttribute}\", expected a positive integer`\n );\n }\n\n const childContext = Object.create(context);\n childContext.srsDimension = srsDimension;\n return childContext;\n }\n\n return context;\n}\n"],"mappings":"AAuBA,SAAQA,SAAS,QAAO,iBAAiB;AACzC,SAAQC,eAAe,QAAO,qBAAqB;AACnD,OAAOC,MAAM,MAAM,cAAc;AAEjC,SAASC,WAAWA,CAAA,EAAY;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAARC,MAAM,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAANF,MAAM,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAC5B,OAAOF,M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GAAG,EAAEZ,OAAO,EAAEK,OAAO,EAAmB;EAClE,MAAM+E,qBAAqB,GAAGxE,GAAG,CAACyE,UAAU,IAAIzE,GAAG,CAACyE,UAAU,CAAC9D,YAAY;EAE3E,IAAI6D,qBAAqB,EAAE;IACzB,MAAM7D,YAAY,GAAG+D,QAAQ,CAACF,qBAAqB,CAAC;IACpD,IAAIG,MAAM,CAACC,KAAK,CAACjE,YAAY,CAAC,IAAIA,YAAY,IAAI,CAAC,EAAE;MACnD,MAAM,IAAII,KAAK,2CAAAC,MAAA,CAC4BwD,qBAAqB,oCAChE,CAAC;IACH;IAEA,MAAM3E,YAAY,GAAGsC,MAAM,CAAC0C,MAAM,CAACpF,OAAO,CAAC;IAC3CI,YAAY,CAACc,YAAY,GAAGA,YAAY;IACxC,OAAOd,YAAY;EACrB;EAEA,OAAOJ,OAAO;AAChB"}
|
|
@@ -1,65 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
import { XMLLoader } from '@loaders.gl/xml';
|
|
4
|
-
|
|
5
|
-
export function parseWMSCapabilities(
|
|
6
|
-
const parsedXML = XMLLoader.parseTextSync(
|
|
2
|
+
import { getXMLArray, getXMLStringArray, getXMLInteger, getXMLFloat, getXMLBoolean } from '../xml/parse-xml-helpers';
|
|
3
|
+
export function parseWMSCapabilities(xmlText, options) {
|
|
4
|
+
const parsedXML = XMLLoader.parseTextSync(xmlText, options);
|
|
7
5
|
const xmlCapabilities = parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;
|
|
8
|
-
|
|
6
|
+
const capabilities = extractCapabilities(xmlCapabilities);
|
|
7
|
+
if (options !== null && options !== void 0 && options.inheritedLayerProps) {
|
|
8
|
+
for (const layer of capabilities.layers) {
|
|
9
|
+
addInheritedLayerProps(layer, null);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (options !== null && options !== void 0 && options.includeRawData || options !== null && options !== void 0 && options.raw) {
|
|
13
|
+
capabilities.raw = xmlCapabilities;
|
|
14
|
+
}
|
|
15
|
+
if (options !== null && options !== void 0 && options.includeXMLText) {
|
|
16
|
+
capabilities.xml = xmlText;
|
|
17
|
+
}
|
|
18
|
+
return capabilities;
|
|
9
19
|
}
|
|
10
|
-
|
|
11
20
|
function extractCapabilities(xml) {
|
|
12
|
-
var _xml$Service, _xml$Service2, _xml$Capability;
|
|
21
|
+
var _xml$Service, _xml$Service2, _xml$Service3, _xml$Service4, _xml$Service5, _xml$Service6, _xml$Service6$Keyword, _xml$Service7, _xml$Service8, _xml$Service9, _xml$Service10, _xml$Service11, _xml$Service12, _xml$Service13, _xml$Capability, _xml$Capability2;
|
|
13
22
|
const capabilities = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
version: String(xml.version || ''),
|
|
24
|
+
name: String(((_xml$Service = xml.Service) === null || _xml$Service === void 0 ? void 0 : _xml$Service.Name) || 'unnamed'),
|
|
25
|
+
title: (_xml$Service2 = xml.Service) !== null && _xml$Service2 !== void 0 && _xml$Service2.Title ? String((_xml$Service3 = xml.Service) === null || _xml$Service3 === void 0 ? void 0 : _xml$Service3.Title) : undefined,
|
|
26
|
+
abstract: (_xml$Service4 = xml.Service) !== null && _xml$Service4 !== void 0 && _xml$Service4.Abstract ? String((_xml$Service5 = xml.Service) === null || _xml$Service5 === void 0 ? void 0 : _xml$Service5.Abstract) : undefined,
|
|
27
|
+
keywords: getXMLStringArray((_xml$Service6 = xml.Service) === null || _xml$Service6 === void 0 ? void 0 : (_xml$Service6$Keyword = _xml$Service6.KeywordList) === null || _xml$Service6$Keyword === void 0 ? void 0 : _xml$Service6$Keyword.Keyword),
|
|
28
|
+
fees: (_xml$Service7 = xml.Service) !== null && _xml$Service7 !== void 0 && _xml$Service7.Fees ? JSON.stringify((_xml$Service8 = xml.Service) === null || _xml$Service8 === void 0 ? void 0 : _xml$Service8.Fees) : undefined,
|
|
29
|
+
accessConstraints: (_xml$Service9 = xml.Service) !== null && _xml$Service9 !== void 0 && _xml$Service9.AccessConstraints ? JSON.stringify((_xml$Service10 = xml.Service) === null || _xml$Service10 === void 0 ? void 0 : _xml$Service10.AccessConstraints) : undefined,
|
|
30
|
+
layerLimit: getXMLInteger((_xml$Service11 = xml.Service) === null || _xml$Service11 === void 0 ? void 0 : _xml$Service11.LayerLimit),
|
|
31
|
+
maxWidth: getXMLInteger((_xml$Service12 = xml.Service) === null || _xml$Service12 === void 0 ? void 0 : _xml$Service12.maxWidth),
|
|
32
|
+
maxHeight: getXMLInteger((_xml$Service13 = xml.Service) === null || _xml$Service13 === void 0 ? void 0 : _xml$Service13.maxHeight),
|
|
33
|
+
layers: [],
|
|
34
|
+
requests: extractRequests((_xml$Capability = xml.Capability) === null || _xml$Capability === void 0 ? void 0 : _xml$Capability.Request),
|
|
35
|
+
exceptions: extractExceptions(xml.Exception)
|
|
20
36
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
capabilities.
|
|
37
|
+
const xmlLayers = getXMLArray((_xml$Capability2 = xml.Capability) === null || _xml$Capability2 === void 0 ? void 0 : _xml$Capability2.Layer);
|
|
38
|
+
for (const xmlSubLayer of xmlLayers) {
|
|
39
|
+
capabilities.layers.push(extractLayer(xmlSubLayer));
|
|
24
40
|
}
|
|
25
|
-
for (const [
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
for (const [key, value] of Object.entries(capabilities)) {
|
|
42
|
+
if (value === undefined) {
|
|
43
|
+
delete capabilities[key];
|
|
44
|
+
}
|
|
28
45
|
}
|
|
29
46
|
return capabilities;
|
|
30
47
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
48
|
+
function extractRequests(xmlRequests) {
|
|
49
|
+
const requests = {};
|
|
50
|
+
for (const [name, xmlRequest] of Object.entries(xmlRequests || {})) {
|
|
51
|
+
const mimeTypes = getXMLStringArray(xmlRequest === null || xmlRequest === void 0 ? void 0 : xmlRequest.Format);
|
|
52
|
+
requests[name] = {
|
|
53
|
+
mimeTypes
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return requests;
|
|
57
|
+
}
|
|
58
|
+
function extractExceptions(xmlException) {
|
|
59
|
+
const xmlExceptionFormats = getXMLArray(xmlException === null || xmlException === void 0 ? void 0 : xmlException.Format);
|
|
60
|
+
if (xmlExceptionFormats.length > 0) {
|
|
61
|
+
return {
|
|
62
|
+
mimeTypes: getXMLStringArray(xmlException)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
39
66
|
}
|
|
40
|
-
|
|
41
67
|
function extractLayer(xmlLayer) {
|
|
68
|
+
var _xmlLayer$KeywordList;
|
|
42
69
|
const layer = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
70
|
+
title: String((xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.Title) || ''),
|
|
71
|
+
name: String(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.Name),
|
|
72
|
+
abstract: String(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.Abstract),
|
|
73
|
+
keywords: getXMLStringArray((_xmlLayer$KeywordList = xmlLayer.KeywordList) === null || _xmlLayer$KeywordList === void 0 ? void 0 : _xmlLayer$KeywordList.Keyword)
|
|
47
74
|
};
|
|
48
|
-
|
|
75
|
+
const crs = (xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.CRS) || (xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.SRS);
|
|
76
|
+
if (crs && Array.isArray(crs) && crs.every(_ => typeof _ === 'string')) {
|
|
77
|
+
layer.crs = crs;
|
|
78
|
+
}
|
|
79
|
+
let geographicBoundingBox = (xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.EX_GeographicBoundingBox) && extractEXBoundingBox(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.EX_GeographicBoundingBox);
|
|
80
|
+
if (geographicBoundingBox) {
|
|
81
|
+
layer.geographicBoundingBox = geographicBoundingBox;
|
|
82
|
+
}
|
|
83
|
+
geographicBoundingBox = (xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.LatLonBoundingBox) && extractLatLonBoundingBox(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.LatLonBoundingBox);
|
|
84
|
+
if (geographicBoundingBox) {
|
|
85
|
+
layer.geographicBoundingBox = geographicBoundingBox;
|
|
86
|
+
}
|
|
87
|
+
const boundingBoxes = (xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.BoundingBox) && extractWMSBoundingBoxes(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.BoundingBox);
|
|
88
|
+
if (boundingBoxes && boundingBoxes.length > 0) {
|
|
89
|
+
layer.boundingBoxes = boundingBoxes;
|
|
90
|
+
}
|
|
91
|
+
if (xmlLayer !== null && xmlLayer !== void 0 && xmlLayer.opaque) {
|
|
92
|
+
layer.opaque = getXMLBoolean(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.opaque);
|
|
93
|
+
}
|
|
94
|
+
if (xmlLayer !== null && xmlLayer !== void 0 && xmlLayer.cascaded) {
|
|
95
|
+
layer.cascaded = getXMLBoolean(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.cascaded);
|
|
96
|
+
}
|
|
97
|
+
if (xmlLayer !== null && xmlLayer !== void 0 && xmlLayer.queryable) {
|
|
98
|
+
layer.queryable = getXMLBoolean(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.queryable);
|
|
99
|
+
}
|
|
49
100
|
const xmlLayers = getXMLArray(xmlLayer === null || xmlLayer === void 0 ? void 0 : xmlLayer.Layer);
|
|
101
|
+
const layers = [];
|
|
50
102
|
for (const xmlSubLayer of xmlLayers) {
|
|
51
|
-
|
|
52
|
-
|
|
103
|
+
layers.push(extractLayer(xmlSubLayer));
|
|
104
|
+
}
|
|
105
|
+
if (layers.length > 0) {
|
|
106
|
+
layer.layers = layers;
|
|
107
|
+
}
|
|
108
|
+
for (const [key, value] of Object.entries(layer)) {
|
|
109
|
+
if (value === undefined) {
|
|
110
|
+
delete layer[key];
|
|
111
|
+
}
|
|
53
112
|
}
|
|
54
113
|
return layer;
|
|
55
114
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
115
|
+
function extractEXBoundingBox(xmlBoundingBox) {
|
|
116
|
+
const {
|
|
117
|
+
westBoundLongitude: w,
|
|
118
|
+
northBoundLatitude: n,
|
|
119
|
+
eastBoundLongitude: e,
|
|
120
|
+
southBoundLatitude: s
|
|
121
|
+
} = xmlBoundingBox;
|
|
122
|
+
return [[w, s], [e, n]];
|
|
123
|
+
}
|
|
124
|
+
function extractLatLonBoundingBox(xmlBoundingBox) {
|
|
125
|
+
const {
|
|
126
|
+
minx,
|
|
127
|
+
miny,
|
|
128
|
+
maxx,
|
|
129
|
+
maxy
|
|
130
|
+
} = xmlBoundingBox;
|
|
131
|
+
return [[minx, miny], [maxx, maxy]];
|
|
132
|
+
}
|
|
133
|
+
function extractWMSBoundingBoxes(xmlBoundingBoxes) {
|
|
134
|
+
const xmlBoxes = getXMLArray(xmlBoundingBoxes);
|
|
135
|
+
return xmlBoxes.map(xmlBox => extractWMSBoundingBox(xmlBox));
|
|
136
|
+
}
|
|
137
|
+
function extractWMSBoundingBox(xmlBoundingBox) {
|
|
138
|
+
const {
|
|
139
|
+
CRS,
|
|
140
|
+
SRS,
|
|
141
|
+
minx,
|
|
142
|
+
miny,
|
|
143
|
+
maxx,
|
|
144
|
+
maxy,
|
|
145
|
+
resx,
|
|
146
|
+
resy
|
|
147
|
+
} = xmlBoundingBox;
|
|
148
|
+
const boundingBox = {
|
|
149
|
+
crs: CRS || SRS,
|
|
150
|
+
boundingBox: [[getXMLFloat(minx), getXMLFloat(miny)], [getXMLFloat(maxx), getXMLFloat(maxy)]]
|
|
151
|
+
};
|
|
152
|
+
if (resx) {
|
|
153
|
+
boundingBox.xResolution = resx;
|
|
154
|
+
}
|
|
155
|
+
if (resy) {
|
|
156
|
+
boundingBox.yResolution = resy;
|
|
157
|
+
}
|
|
158
|
+
return boundingBox;
|
|
159
|
+
}
|
|
160
|
+
function addInheritedLayerProps(layer, parent) {
|
|
161
|
+
if (parent && parent.geographicBoundingBox && !layer.geographicBoundingBox) {
|
|
162
|
+
layer.geographicBoundingBox = [...parent.geographicBoundingBox];
|
|
163
|
+
}
|
|
164
|
+
if (parent && parent.crs && !layer.crs) {
|
|
165
|
+
layer.crs = [...parent.crs];
|
|
166
|
+
}
|
|
167
|
+
if (parent && parent.boundingBoxes && !layer.boundingBoxes) {
|
|
168
|
+
layer.boundingBoxes = [...parent.boundingBoxes];
|
|
59
169
|
}
|
|
60
|
-
|
|
61
|
-
|
|
170
|
+
for (const subLayer of layer.layers || []) {
|
|
171
|
+
addInheritedLayerProps(subLayer, layer);
|
|
62
172
|
}
|
|
63
|
-
return [];
|
|
64
173
|
}
|
|
65
174
|
//# sourceMappingURL=parse-wms-capabilities.js.map
|