@loaders.gl/wms 3.4.0-alpha.3 → 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +133 -80
- package/dist/es5/csw-capabilities-loader.js +1 -1
- package/dist/es5/csw-capabilities-loader.js.map +1 -1
- package/dist/es5/csw-domain-loader.js +1 -1
- package/dist/es5/csw-domain-loader.js.map +1 -1
- package/dist/es5/csw-records-loader.js +1 -1
- package/dist/es5/csw-records-loader.js.map +1 -1
- package/dist/es5/gml-loader.js +1 -1
- package/dist/es5/gml-loader.js.map +1 -1
- package/dist/es5/lerc-loader.js +1 -1
- package/dist/es5/lerc-loader.js.map +1 -1
- package/dist/es5/lib/create-image-source.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js +2 -1
- package/dist/es5/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-domain.js +2 -1
- package/dist/es5/lib/parsers/csw/parse-csw-domain.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-csw-records.js +6 -5
- package/dist/es5/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/es5/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/es5/lib/parsers/gml/deep-strict-equal.js.map +1 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js +2 -1
- package/dist/es5/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js +2 -1
- package/dist/es5/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-features.js +2 -2
- package/dist/es5/lib/parsers/wms/parse-wms-features.js.map +1 -1
- package/dist/es5/lib/parsers/wms/parse-wms-layer-description.js +2 -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.map +1 -1
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js +1 -6
- package/dist/es5/lib/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/es5/lib/services/arcgis/arcgis-server.js.map +1 -1
- package/dist/es5/lib/services/generic/image-service.js +1 -6
- package/dist/es5/lib/services/generic/image-service.js.map +1 -1
- package/dist/es5/lib/services/ogc/csw-service.js +0 -2
- package/dist/es5/lib/services/ogc/csw-service.js.map +1 -1
- package/dist/es5/lib/services/ogc/wms-service.js +62 -20
- package/dist/es5/lib/services/ogc/wms-service.js.map +1 -1
- package/dist/es5/lib/sources/data-source.js +36 -8
- 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/wfs/parse-wfs.js +41 -0
- package/dist/es5/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/es5/lib/wmts/parse-wmts.js +41 -0
- package/dist/es5/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/es5/wip/arcgis-feature-service.js.map +1 -1
- package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js +2 -1
- package/dist/es5/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
- package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js +2 -1
- package/dist/es5/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
- package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js +2 -1
- package/dist/es5/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
- 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 +1 -1
- 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/wms-layer-description-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 +1 -1
- package/dist/es5/wms-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-error-loader.js +1 -1
- package/dist/es5/wms-error-loader.js.map +1 -1
- package/dist/esm/csw-capabilities-loader.js +1 -1
- package/dist/esm/csw-capabilities-loader.js.map +1 -1
- package/dist/esm/csw-domain-loader.js +1 -1
- package/dist/esm/csw-domain-loader.js.map +1 -1
- package/dist/esm/csw-records-loader.js +1 -1
- package/dist/esm/csw-records-loader.js.map +1 -1
- package/dist/esm/gml-loader.js +1 -1
- package/dist/esm/gml-loader.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -1
- package/dist/esm/lerc-loader.js.map +1 -1
- package/dist/esm/lib/create-image-source.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js +2 -1
- package/dist/esm/lib/parsers/csw/parse-csw-capabilities.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-domain.js +2 -1
- package/dist/esm/lib/parsers/csw/parse-csw-domain.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-csw-records.js +7 -6
- package/dist/esm/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/esm/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/esm/lib/parsers/gml/deep-strict-equal.js.map +1 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js +2 -1
- package/dist/esm/lib/parsers/gml/parse-gml.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js +2 -1
- package/dist/esm/lib/parsers/wms/parse-wms-capabilities.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-features.js +2 -2
- package/dist/esm/lib/parsers/wms/parse-wms-features.js.map +1 -1
- package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js +2 -1
- package/dist/esm/lib/parsers/wms/parse-wms-layer-description.js.map +1 -1
- package/dist/esm/lib/parsers/xml/parse-xml-helpers.js.map +1 -1
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js +0 -2
- package/dist/esm/lib/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/esm/lib/services/arcgis/arcgis-server.js.map +1 -1
- package/dist/esm/lib/services/generic/image-service.js +0 -2
- package/dist/esm/lib/services/generic/image-service.js.map +1 -1
- package/dist/esm/lib/services/ogc/csw-service.js +0 -2
- package/dist/esm/lib/services/ogc/csw-service.js.map +1 -1
- package/dist/esm/lib/services/ogc/wms-service.js +54 -14
- package/dist/esm/lib/services/ogc/wms-service.js.map +1 -1
- package/dist/esm/lib/sources/data-source.js +20 -0
- package/dist/esm/lib/sources/data-source.js.map +1 -1
- package/dist/esm/lib/sources/image-source.js.map +1 -1
- package/dist/esm/lib/sources/tile-source.js.map +1 -1
- package/dist/esm/lib/wfs/parse-wfs.js +28 -0
- package/dist/esm/lib/wfs/parse-wfs.js.map +1 -0
- package/dist/esm/lib/wmts/parse-wmts.js +28 -0
- package/dist/esm/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js +2 -1
- package/dist/esm/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -1
- package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js +2 -1
- package/dist/esm/wip/lib/wfs/parse-wfs-capabilities.js.map +1 -1
- package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js +2 -1
- package/dist/esm/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -1
- 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 +1 -1
- 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/wms-layer-description-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 -1
- package/dist/esm/wms-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-error-loader.js +1 -1
- package/dist/esm/wms-error-loader.js.map +1 -1
- 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/csw/parse-csw-capabilities.js +1 -1
- package/dist/lib/parsers/csw/parse-csw-domain.js +1 -1
- package/dist/lib/parsers/csw/parse-csw-records.js +6 -6
- package/dist/lib/parsers/csw/parse-exception-report.js +1 -1
- package/dist/lib/parsers/gml/parse-gml.js +1 -1
- package/dist/lib/parsers/wms/parse-wms-capabilities.js +2 -1
- package/dist/lib/parsers/wms/parse-wms-features.js +1 -1
- package/dist/lib/parsers/wms/parse-wms-layer-description.js +1 -1
- 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 +0 -1
- 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 +0 -1
- package/dist/lib/services/ogc/csw-service.d.ts +1 -2
- package/dist/lib/services/ogc/csw-service.d.ts.map +1 -1
- package/dist/lib/services/ogc/csw-service.js +0 -1
- package/dist/lib/services/ogc/wms-service.d.ts +84 -43
- package/dist/lib/services/ogc/wms-service.d.ts.map +1 -1
- package/dist/lib/services/ogc/wms-service.js +73 -27
- 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 +6 -6
- 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/lib/wfs/parse-wfs.d.ts +7 -0
- package/dist/lib/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/lib/wfs/parse-wfs.js +32 -0
- package/dist/lib/wmts/parse-wmts.d.ts +7 -0
- package/dist/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/lib/wmts/parse-wmts.js +35 -0
- package/dist/wip/lib/wcs/parse-wcs-capabilities.js +1 -1
- package/dist/wip/lib/wfs/parse-wfs-capabilities.js +1 -1
- package/dist/wip/lib/wmts/parse-wmts-capabilities.js +1 -1
- package/package.json +6 -6
- package/src/lib/create-image-source.ts +1 -1
- package/src/lib/parsers/csw/parse-csw-capabilities.ts +1 -1
- package/src/lib/parsers/csw/parse-csw-domain.ts +1 -1
- package/src/lib/parsers/csw/parse-csw-records.ts +6 -6
- package/src/lib/parsers/csw/parse-exception-report.ts +1 -1
- package/src/lib/parsers/gml/parse-gml.ts +1 -1
- package/src/lib/parsers/wms/parse-wms-capabilities.ts +2 -1
- package/src/lib/parsers/wms/parse-wms-features.ts +1 -1
- package/src/lib/parsers/wms/parse-wms-layer-description.ts +1 -1
- 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 +1 -3
- package/src/lib/services/ogc/wms-service.ts +165 -60
- package/src/lib/sources/data-source.ts +29 -2
- package/src/lib/sources/image-source.ts +6 -6
- package/src/lib/sources/tile-source.ts +4 -2
- package/src/lib/wfs/parse-wfs.ts +34 -0
- package/src/lib/wmts/parse-wmts.ts +37 -0
- package/src/wip/lib/wcs/parse-wcs-capabilities.ts +1 -1
- package/src/wip/lib/wfs/parse-wfs-capabilities.ts +1 -1
- package/src/wip/lib/wmts/parse-wmts-capabilities.ts +1 -1
- 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-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,Q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AAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIpC,MAAM,CAACC,OAAO,CAACiC,MAAM,CAAC,EAAE;MACjD,OAAO,CAACC,GAAG,EAAEC,KAAK,CAAC;IACrB;EACF;EACA,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC;AACnB;AAGA,SAAS7E,kBAAkBA,CAACM,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,qCAC/D;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
|
+
{"version":3,"file":"parse-gml.js","names":["XMLLoader","deepStrictEqual","rewind","noTransform","_len","arguments","length","coords","Array","_key","parseGML","text","options","_XMLLoader$parseTextS","parsedXML","parseTextSync","call","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","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,MAAM;AACf;AAgBA,OAAO,SAASG,QAAQA,CAACC,IAAY,EAAEC,OAAO,EAAE;EAAA,IAAAC,qBAAA;EAE9C,MAAMC,SAAS,IAAAD,qBAAA,GAAGb,SAAS,CAACe,aAAa,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAhB,SAAS,EAAiBW,IAAI,EAAEC,OAAO,CAAC;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B,EAAE;IACzB,MAAM5D,YAAY,GAAG8D,QAAQ,CAACF,qBAAqB,CAAC;IACpD,IAAIG,MAAM,CAACC,KAAK,CAAChE,YAAY,CAAC,IAAIA,YAAY,IAAI,CAAC,EAAE;MACnD,MAAM,IAAII,KAAK,2CAAAC,MAAA,CAC4BuD,qBAAqB,oCAChE,CAAC;IACH;IAEA,MAAM1E,YAAY,GAAGqC,MAAM,CAAC0C,MAAM,CAACnF,OAAO,CAAC;IAC3CI,YAAY,CAACc,YAAY,GAAGA,YAAY;IACxC,OAAOd,YAAY;EACrB;EAEA,OAAOJ,OAAO;AAChB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { XMLLoader } from '@loaders.gl/xml';
|
|
2
2
|
import { getXMLArray, getXMLStringArray, getXMLInteger, getXMLFloat, getXMLBoolean } from '../xml/parse-xml-helpers';
|
|
3
3
|
export function parseWMSCapabilities(xmlText, options) {
|
|
4
|
-
|
|
4
|
+
var _XMLLoader$parseTextS;
|
|
5
|
+
const parsedXML = (_XMLLoader$parseTextS = XMLLoader.parseTextSync) === null || _XMLLoader$parseTextS === void 0 ? void 0 : _XMLLoader$parseTextS.call(XMLLoader, xmlText, options);
|
|
5
6
|
const xmlCapabilities = parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;
|
|
6
7
|
const capabilities = extractCapabilities(xmlCapabilities);
|
|
7
8
|
if (options !== null && options !== void 0 && options.inheritedLayerProps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wms-capabilities.js","names":["XMLLoader","getXMLArray","getXMLStringArray","getXMLInteger","getXMLFloat","getXMLBoolean","parseWMSCapabilities","xmlText","options","parsedXML","parseTextSync","xmlCapabilities","WMT_MS_Capabilities","WMS_Capabilities","capabilities","extractCapabilities","inheritedLayerProps","layer","layers","addInheritedLayerProps","includeRawData","raw","includeXMLText","xml","_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","version","String","name","Service","Name","title","Title","undefined","abstract","Abstract","keywords","KeywordList","Keyword","fees","Fees","JSON","stringify","accessConstraints","AccessConstraints","layerLimit","LayerLimit","maxWidth","maxHeight","requests","extractRequests","Capability","Request","exceptions","extractExceptions","Exception","xmlLayers","Layer","xmlSubLayer","push","extractLayer","key","value","Object","entries","xmlRequests","xmlRequest","mimeTypes","Format","xmlException","xmlExceptionFormats","length","xmlLayer","_xmlLayer$KeywordList","crs","CRS","SRS","Array","isArray","every","_","geographicBoundingBox","EX_GeographicBoundingBox","extractEXBoundingBox","LatLonBoundingBox","extractLatLonBoundingBox","boundingBoxes","BoundingBox","extractWMSBoundingBoxes","opaque","cascaded","queryable","xmlBoundingBox","westBoundLongitude","w","northBoundLatitude","n","eastBoundLongitude","e","southBoundLatitude","s","minx","miny","maxx","maxy","xmlBoundingBoxes","xmlBoxes","map","xmlBox","extractWMSBoundingBox","resx","resy","boundingBox","xResolution","yResolution","parent","subLayer"],"sources":["../../../../../src/lib/parsers/wms/parse-wms-capabilities.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\nimport {\n getXMLArray,\n getXMLStringArray,\n getXMLInteger,\n getXMLFloat,\n getXMLBoolean\n} from '../xml/parse-xml-helpers';\n\n/** All capabilities of a WMS service - response to a WMS `GetCapabilities` data structure extracted from XML */\nexport type WMSCapabilities = {\n /** Version of the WMS service */\n version?: string; // '1.3.0' | '1.1.1' | '1.1.0' | '1.0.0'\n /** A short name for the service */\n name: string;\n /** A human readable name for the service */\n title?: string;\n /** A more extensive description of the service */\n abstract?: string;\n /** A set of keywords e.g. for searching services */\n keywords: string[];\n /** A field of unspecified format, if present describes any access constraints required to use the service. */\n accessConstraints?: string;\n /** A field of unspecified format, if present describes any fees associated with the use of the service */\n fees?: string;\n /** If present, the max number of layers that can be rendered by the service */\n layerLimit?: number;\n /** If present, the widest image that can be rendered by the service */\n maxWidth?: number;\n /** If present, the tallest image that can be rendered by the service */\n maxHeight?: number;\n /** Hierarchical list of layers. */\n layers: WMSLayer[];\n /** A map with information about supported WMS requests. If a record is present, the request is supported by the service */\n requests: Record<string, WMSRequest>;\n /** Information about any exceptions that the service will report (HTTP status != 2xx) */\n exceptions?: WMSExceptions;\n /** Only if `options.raw`: raw untyped JSON parsed from XML. Can include information not extracted in the typed response. */\n raw?: Record<string, unknown>;\n /** Only if `options.xml`, the unparsed XML string can be requested */\n xml?: string;\n};\n\n/**\n * Metadata about a layer\n * Layers inherit many properties from their parent layers, see description of individual props for details.\n * @see https://www.ogc.org/standard/wms/ 7.2.4.6\n */\nexport type WMSLayer = {\n /** The title is a human readable name. It is mandatory on each layer. Not inherited. */\n title: string;\n /** A layer is renderable if it has a name. A named parent layer will render all its sublayers. Not inherited. */\n name?: string;\n /** A narrative description of the map layer. */\n abstract?: string;\n /** A set of keywords e.g. for searching layers */\n keywords: string[];\n /** layer limits in unspecified CRS:84-like lng/lat, for quick access w/o CRS calculations. Defined or inherited. */\n geographicBoundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Supported CRS. Either defined or inherited. */\n crs?: string[];\n /** Bounding boxes in specific CRS:es */\n boundingBoxes?: WMSBoundingBox[];\n\n // minScale: number;\n // maxScale: number;\n // dimensions: ?? 7.2.4.6.10\n // MetadataURL\n // Attribution\n // Identifier and AuthorityURL\n // FeatureListURL\n // DataURL\n\n /** Whether queries can be performed on the layer */\n queryable?: boolean;\n /** `false` if layer has significant no-data areas that the client can display as transparent. */\n opaque?: boolean;\n /** WMS cascading allows server to expose layers coming from other WMS servers as if they were local layers */\n cascaded?: boolean;\n // noSubsets: boolean\n // fixedWith: number\n // fixedHeight: number\n\n /** A list of styles. @note not yet supported by WMSCapabilitiesLoader */\n styles?: unknown[];\n\n /** Sublayers - these inherit crs and boundingBox) if not overridden) */\n layers?: WMSLayer[];\n};\n\n/**\n * A bounding box specifies the coordinate range for data in the layer.\n * No data is available outside the bounding box.\n */\nexport type WMSBoundingBox = {\n /** CRS indicates the Layer CRS that applies to this bounding box. */\n crs: string;\n /** `[[w, s], [e, n]]`, indicates the limits of the bounding box using the axis units and order of the specified CRS. */\n boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Spatial horizontal resolution of data in same units as bounding box */\n xResolution?: number;\n /** Spatial vertical resolution of data in same units as bounding box */\n yResolution?: number;\n};\n\n/** Metadata about a supported WMS request */\nexport type WMSRequest = {\n /** MIMEtypes that can be returned by this request. */\n mimeTypes: string[];\n};\n\nexport type WMSExceptions = {\n /** MIME types for exception response payloads. */\n mimeTypes: string[];\n};\n\nexport type parseWMSCapabilitiesOptions = {\n /** Add inherited layer information to sub layers */\n inheritedLayerProps?: boolean;\n /** Include the \"raw\" JSON (parsed but untyped, unprocessed XML). May contain additional fields */\n includeRawData?: boolean;\n /** Include the original XML document text. May contain additional information. */\n includeXMLText?: boolean;\n /** @deprecated Use includeRawData` */\n raw?: boolean;\n\n // xml options are passed through to xml loader\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMSCapabilities(\n xmlText: string,\n options?: parseWMSCapabilitiesOptions\n): WMSCapabilities {\n const parsedXML = XMLLoader.parseTextSync(xmlText, options);\n const xmlCapabilities: any =\n parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;\n const capabilities = extractCapabilities(xmlCapabilities);\n // In case the processed, normalized capabilities do not contain everything,\n // the user can get the parsed XML structure.\n if (options?.inheritedLayerProps) {\n // Traverse layers and inject missing props from parents\n for (const layer of capabilities.layers) {\n addInheritedLayerProps(layer, null);\n }\n // Not yet implemented\n }\n\n if (options?.includeRawData || options?.raw) {\n capabilities.raw = xmlCapabilities;\n }\n\n if (options?.includeXMLText) {\n capabilities.xml = xmlText;\n }\n\n return capabilities;\n}\n\n/** Extract typed capability data from XML */\nfunction extractCapabilities(xml: any): WMSCapabilities {\n const capabilities: WMSCapabilities = {\n version: String(xml.version || ''),\n name: String(xml.Service?.Name || 'unnamed'),\n title: xml.Service?.Title ? String(xml.Service?.Title) : undefined,\n abstract: xml.Service?.Abstract ? String(xml.Service?.Abstract) : undefined,\n keywords: getXMLStringArray(xml.Service?.KeywordList?.Keyword),\n fees: xml.Service?.Fees ? JSON.stringify(xml.Service?.Fees) : undefined,\n accessConstraints: xml.Service?.AccessConstraints\n ? JSON.stringify(xml.Service?.AccessConstraints)\n : undefined,\n layerLimit: getXMLInteger(xml.Service?.LayerLimit),\n maxWidth: getXMLInteger(xml.Service?.maxWidth),\n maxHeight: getXMLInteger(xml.Service?.maxHeight),\n layers: [],\n requests: extractRequests(xml.Capability?.Request),\n exceptions: extractExceptions(xml.Exception)\n // contact field is a mess of largely irrelevant information, put it last\n // contact: xml.Service?.Contact ? JSON.stringify(xml.Service?.Contact) : undefined,\n };\n\n // LAYERS\n const xmlLayers = getXMLArray(xml.Capability?.Layer);\n for (const xmlSubLayer of xmlLayers) {\n capabilities.layers.push(extractLayer(xmlSubLayer));\n }\n\n // Clean up object\n for (const [key, value] of Object.entries(capabilities)) {\n if (value === undefined) {\n delete capabilities[key];\n }\n }\n\n return capabilities;\n}\n\n/** Extract typed request metadata from XML requests field */\nfunction extractRequests(xmlRequests: any): Record<string, WMSRequest> {\n const requests: Record<string, WMSRequest> = {};\n for (const [name, xmlRequest] of Object.entries(xmlRequests || {}) as any) {\n const mimeTypes = getXMLStringArray(xmlRequest?.Format);\n requests[name] = {mimeTypes};\n }\n return requests;\n}\n\nfunction extractExceptions(xmlException: any): WMSExceptions | undefined {\n const xmlExceptionFormats = getXMLArray(xmlException?.Format);\n if (xmlExceptionFormats.length > 0) {\n return {\n mimeTypes: getXMLStringArray(xmlException)\n };\n }\n return undefined;\n}\n\n/** Extract request data */\n// eslint-disable-next-line complexity, max-statements\nfunction extractLayer(xmlLayer: any): WMSLayer {\n const layer: WMSLayer = {\n // All layers must have a title\n title: String(xmlLayer?.Title || ''),\n // Name is required only if renderable\n name: String(xmlLayer?.Name),\n abstract: String(xmlLayer?.Abstract),\n keywords: getXMLStringArray(xmlLayer.KeywordList?.Keyword)\n };\n\n // WMS 1.3.0 changes SRS to CRS\n const crs = xmlLayer?.CRS || xmlLayer?.SRS;\n if (crs && Array.isArray(crs) && crs.every((_) => typeof _ === 'string')) {\n layer.crs = crs;\n }\n\n // v1.3.0 extract simple geographic bounding box\n let geographicBoundingBox =\n xmlLayer?.EX_GeographicBoundingBox && extractEXBoundingBox(xmlLayer?.EX_GeographicBoundingBox);\n if (geographicBoundingBox) {\n layer.geographicBoundingBox = geographicBoundingBox;\n }\n\n // v1.1.1 extract simple geographic bounding box\n geographicBoundingBox =\n xmlLayer?.LatLonBoundingBox && extractLatLonBoundingBox(xmlLayer?.LatLonBoundingBox);\n if (geographicBoundingBox) {\n layer.geographicBoundingBox = geographicBoundingBox;\n }\n\n // Extract per-CRS bounding boxes\n const boundingBoxes = xmlLayer?.BoundingBox && extractWMSBoundingBoxes(xmlLayer?.BoundingBox);\n if (boundingBoxes && boundingBoxes.length > 0) {\n layer.boundingBoxes = boundingBoxes;\n }\n\n if (xmlLayer?.opaque) {\n layer.opaque = getXMLBoolean(xmlLayer?.opaque);\n }\n if (xmlLayer?.cascaded) {\n layer.cascaded = getXMLBoolean(xmlLayer?.cascaded);\n }\n if (xmlLayer?.queryable) {\n layer.queryable = getXMLBoolean(xmlLayer?.queryable);\n }\n\n // Single layer is not represented as array in XML\n const xmlLayers = getXMLArray(xmlLayer?.Layer);\n const layers: WMSLayer[] = [];\n\n for (const xmlSubLayer of xmlLayers) {\n layers.push(extractLayer(xmlSubLayer));\n }\n\n if (layers.length > 0) {\n layer.layers = layers;\n }\n\n // Clean up object\n for (const [key, value] of Object.entries(layer)) {\n if (value === undefined) {\n delete layer[key];\n }\n }\n\n return layer;\n}\n\n/** WMS 1.3.0 Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractEXBoundingBox(xmlBoundingBox: any): [[number, number], [number, number]] {\n const {\n westBoundLongitude: w,\n northBoundLatitude: n,\n eastBoundLongitude: e,\n southBoundLatitude: s\n } = xmlBoundingBox;\n return [\n [w, s],\n [e, n]\n ];\n}\n\n/** WMS 1.1.1 Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractLatLonBoundingBox(xmlBoundingBox: any): [[number, number], [number, number]] {\n const {minx, miny, maxx, maxy} = xmlBoundingBox;\n return [\n [minx, miny],\n [maxx, maxy]\n ];\n}\n\n/** Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractWMSBoundingBoxes(xmlBoundingBoxes: any): WMSBoundingBox[] {\n const xmlBoxes = getXMLArray(xmlBoundingBoxes);\n return xmlBoxes.map((xmlBox) => extractWMSBoundingBox(xmlBox));\n}\n\n/** Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractWMSBoundingBox(xmlBoundingBox: any): WMSBoundingBox {\n const {CRS, SRS, minx, miny, maxx, maxy, resx, resy} = xmlBoundingBox;\n const boundingBox: WMSBoundingBox = {\n // CRS in 1.3.0, SRS in 1.1.1\n crs: CRS || SRS,\n boundingBox: [\n [getXMLFloat(minx) as number, getXMLFloat(miny) as number],\n [getXMLFloat(maxx) as number, getXMLFloat(maxy) as number]\n ]\n };\n if (resx) {\n boundingBox.xResolution = resx;\n }\n if (resy) {\n boundingBox.yResolution = resy;\n }\n return boundingBox;\n}\n\n/** Traverse layers and inject missing props from parents */\nfunction addInheritedLayerProps(layer: WMSLayer, parent: WMSLayer | null): void {\n if (parent && parent.geographicBoundingBox && !layer.geographicBoundingBox) {\n layer.geographicBoundingBox = [...parent.geographicBoundingBox];\n }\n\n if (parent && parent.crs && !layer.crs) {\n layer.crs = [...parent.crs];\n }\n\n if (parent && parent.boundingBoxes && !layer.boundingBoxes) {\n layer.boundingBoxes = [...parent.boundingBoxes];\n }\n\n // TODO inherit other elements\n\n for (const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AACzC,GAAG,CAAC;EAC7B;EAEA,IAAIyC,MAAM,IAAIA,MAAM,CAAC7B,aAAa,IAAI,CAACnF,KAAK,CAACmF,aAAa,EAAE;IAC1DnF,KAAK,CAACmF,aAAa,GAAG,CAAC,GAAG6B,MAAM,CAAC7B,aAAa,CAAC;EACjD;EAIA,KAAK,MAAM8B,QAAQ,IAAIjH,KAAK,CAACC,MAAM,IAAI,EAAE,EAAE;IACzCC,sBAAsB,CAAC+G,QAAQ,EAAEjH,KAAK,CAAC;EACzC;AACF"}
|
|
1
|
+
{"version":3,"file":"parse-wms-capabilities.js","names":["XMLLoader","getXMLArray","getXMLStringArray","getXMLInteger","getXMLFloat","getXMLBoolean","parseWMSCapabilities","xmlText","options","_XMLLoader$parseTextS","parsedXML","parseTextSync","call","xmlCapabilities","WMT_MS_Capabilities","WMS_Capabilities","capabilities","extractCapabilities","inheritedLayerProps","layer","layers","addInheritedLayerProps","includeRawData","raw","includeXMLText","xml","_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","version","String","name","Service","Name","title","Title","undefined","abstract","Abstract","keywords","KeywordList","Keyword","fees","Fees","JSON","stringify","accessConstraints","AccessConstraints","layerLimit","LayerLimit","maxWidth","maxHeight","requests","extractRequests","Capability","Request","exceptions","extractExceptions","Exception","xmlLayers","Layer","xmlSubLayer","push","extractLayer","key","value","Object","entries","xmlRequests","xmlRequest","mimeTypes","Format","xmlException","xmlExceptionFormats","length","xmlLayer","_xmlLayer$KeywordList","crs","CRS","SRS","Array","isArray","every","_","geographicBoundingBox","EX_GeographicBoundingBox","extractEXBoundingBox","LatLonBoundingBox","extractLatLonBoundingBox","boundingBoxes","BoundingBox","extractWMSBoundingBoxes","opaque","cascaded","queryable","xmlBoundingBox","westBoundLongitude","w","northBoundLatitude","n","eastBoundLongitude","e","southBoundLatitude","s","minx","miny","maxx","maxy","xmlBoundingBoxes","xmlBoxes","map","xmlBox","extractWMSBoundingBox","resx","resy","boundingBox","xResolution","yResolution","parent","subLayer"],"sources":["../../../../../src/lib/parsers/wms/parse-wms-capabilities.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\nimport {\n getXMLArray,\n getXMLStringArray,\n getXMLInteger,\n getXMLFloat,\n getXMLBoolean\n} from '../xml/parse-xml-helpers';\n\n/** All capabilities of a WMS service - response to a WMS `GetCapabilities` data structure extracted from XML */\nexport type WMSCapabilities = {\n /** Version of the WMS service */\n version?: string; // '1.3.0' | '1.1.1' | '1.1.0' | '1.0.0'\n /** A short name for the service */\n name: string;\n /** A human readable name for the service */\n title?: string;\n /** A more extensive description of the service */\n abstract?: string;\n /** A set of keywords e.g. for searching services */\n keywords: string[];\n /** A field of unspecified format, if present describes any access constraints required to use the service. */\n accessConstraints?: string;\n /** A field of unspecified format, if present describes any fees associated with the use of the service */\n fees?: string;\n /** If present, the max number of layers that can be rendered by the service */\n layerLimit?: number;\n /** If present, the widest image that can be rendered by the service */\n maxWidth?: number;\n /** If present, the tallest image that can be rendered by the service */\n maxHeight?: number;\n /** Hierarchical list of layers. */\n layers: WMSLayer[];\n /** A map with information about supported WMS requests. If a record is present, the request is supported by the service */\n requests: Record<string, WMSRequest>;\n /** Information about any exceptions that the service will report (HTTP status != 2xx) */\n exceptions?: WMSExceptions;\n /** Only if `options.raw`: raw untyped JSON parsed from XML. Can include information not extracted in the typed response. */\n raw?: Record<string, unknown>;\n /** Only if `options.xml`, the unparsed XML string can be requested */\n xml?: string;\n};\n\n/**\n * Metadata about a layer\n * Layers inherit many properties from their parent layers, see description of individual props for details.\n * @see https://www.ogc.org/standard/wms/ 7.2.4.6\n */\nexport type WMSLayer = {\n /** The title is a human readable name. It is mandatory on each layer. Not inherited. */\n title: string;\n /** A layer is renderable if it has a name. A named parent layer will render all its sublayers. Not inherited. */\n name?: string;\n /** A narrative description of the map layer. */\n abstract?: string;\n /** A set of keywords e.g. for searching layers */\n keywords: string[];\n /** layer limits in unspecified CRS:84-like lng/lat, for quick access w/o CRS calculations. Defined or inherited. */\n geographicBoundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Supported CRS. Either defined or inherited. */\n crs?: string[];\n /** Bounding boxes in specific CRS:es */\n boundingBoxes?: WMSBoundingBox[];\n\n // minScale: number;\n // maxScale: number;\n // dimensions: ?? 7.2.4.6.10\n // MetadataURL\n // Attribution\n // Identifier and AuthorityURL\n // FeatureListURL\n // DataURL\n\n /** Whether queries can be performed on the layer */\n queryable?: boolean;\n /** `false` if layer has significant no-data areas that the client can display as transparent. */\n opaque?: boolean;\n /** WMS cascading allows server to expose layers coming from other WMS servers as if they were local layers */\n cascaded?: boolean;\n // noSubsets: boolean\n // fixedWith: number\n // fixedHeight: number\n\n /** A list of styles. @note not yet supported by WMSCapabilitiesLoader */\n styles?: unknown[];\n\n /** Sublayers - these inherit crs and boundingBox) if not overridden) */\n layers?: WMSLayer[];\n};\n\n/**\n * A bounding box specifies the coordinate range for data in the layer.\n * No data is available outside the bounding box.\n */\nexport type WMSBoundingBox = {\n /** CRS indicates the Layer CRS that applies to this bounding box. */\n crs: string;\n /** `[[w, s], [e, n]]`, indicates the limits of the bounding box using the axis units and order of the specified CRS. */\n boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Spatial horizontal resolution of data in same units as bounding box */\n xResolution?: number;\n /** Spatial vertical resolution of data in same units as bounding box */\n yResolution?: number;\n};\n\n/** Metadata about a supported WMS request */\nexport type WMSRequest = {\n /** MIMEtypes that can be returned by this request. */\n mimeTypes: string[];\n};\n\nexport type WMSExceptions = {\n /** MIME types for exception response payloads. */\n mimeTypes: string[];\n};\n\nexport type parseWMSCapabilitiesOptions = {\n /** Add inherited layer information to sub layers */\n inheritedLayerProps?: boolean;\n /** Include the \"raw\" JSON (parsed but untyped, unprocessed XML). May contain additional fields */\n includeRawData?: boolean;\n /** Include the original XML document text. May contain additional information. */\n includeXMLText?: boolean;\n /** @deprecated Use includeRawData` */\n raw?: boolean;\n\n // xml options are passed through to xml loader\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetCapabilities` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMSCapabilities(\n xmlText: string,\n options?: parseWMSCapabilitiesOptions\n): WMSCapabilities {\n const parsedXML = XMLLoader.parseTextSync?.(xmlText, options);\n const xmlCapabilities: any =\n parsedXML.WMT_MS_Capabilities || parsedXML.WMS_Capabilities || parsedXML;\n const capabilities = extractCapabilities(xmlCapabilities);\n // In case the processed, normalized capabilities do not contain everything,\n // the user can get the parsed XML structure.\n if (options?.inheritedLayerProps) {\n // Traverse layers and inject missing props from parents\n for (const layer of capabilities.layers) {\n addInheritedLayerProps(layer, null);\n }\n // Not yet implemented\n }\n\n if (options?.includeRawData || options?.raw) {\n capabilities.raw = xmlCapabilities;\n }\n\n if (options?.includeXMLText) {\n capabilities.xml = xmlText;\n }\n\n return capabilities;\n}\n\n/** Extract typed capability data from XML */\nfunction extractCapabilities(xml: any): WMSCapabilities {\n const capabilities: WMSCapabilities = {\n version: String(xml.version || ''),\n name: String(xml.Service?.Name || 'unnamed'),\n title: xml.Service?.Title ? String(xml.Service?.Title) : undefined,\n abstract: xml.Service?.Abstract ? String(xml.Service?.Abstract) : undefined,\n keywords: getXMLStringArray(xml.Service?.KeywordList?.Keyword),\n fees: xml.Service?.Fees ? JSON.stringify(xml.Service?.Fees) : undefined,\n accessConstraints: xml.Service?.AccessConstraints\n ? JSON.stringify(xml.Service?.AccessConstraints)\n : undefined,\n layerLimit: getXMLInteger(xml.Service?.LayerLimit),\n maxWidth: getXMLInteger(xml.Service?.maxWidth),\n maxHeight: getXMLInteger(xml.Service?.maxHeight),\n layers: [],\n requests: extractRequests(xml.Capability?.Request),\n exceptions: extractExceptions(xml.Exception)\n // contact field is a mess of largely irrelevant information, put it last\n // contact: xml.Service?.Contact ? JSON.stringify(xml.Service?.Contact) : undefined,\n };\n\n // LAYERS\n const xmlLayers = getXMLArray(xml.Capability?.Layer);\n for (const xmlSubLayer of xmlLayers) {\n capabilities.layers.push(extractLayer(xmlSubLayer));\n }\n\n // Clean up object\n for (const [key, value] of Object.entries(capabilities)) {\n if (value === undefined) {\n delete capabilities[key];\n }\n }\n\n return capabilities;\n}\n\n/** Extract typed request metadata from XML requests field */\nfunction extractRequests(xmlRequests: any): Record<string, WMSRequest> {\n const requests: Record<string, WMSRequest> = {};\n for (const [name, xmlRequest] of Object.entries(xmlRequests || {}) as any) {\n const mimeTypes = getXMLStringArray(xmlRequest?.Format);\n requests[name] = {mimeTypes};\n }\n return requests;\n}\n\nfunction extractExceptions(xmlException: any): WMSExceptions | undefined {\n const xmlExceptionFormats = getXMLArray(xmlException?.Format);\n if (xmlExceptionFormats.length > 0) {\n return {\n mimeTypes: getXMLStringArray(xmlException)\n };\n }\n return undefined;\n}\n\n/** Extract request data */\n// eslint-disable-next-line complexity, max-statements\nfunction extractLayer(xmlLayer: any): WMSLayer {\n const layer: WMSLayer = {\n // All layers must have a title\n title: String(xmlLayer?.Title || ''),\n // Name is required only if renderable\n name: String(xmlLayer?.Name),\n abstract: String(xmlLayer?.Abstract),\n keywords: getXMLStringArray(xmlLayer.KeywordList?.Keyword)\n };\n\n // WMS 1.3.0 changes SRS to CRS\n const crs = xmlLayer?.CRS || xmlLayer?.SRS;\n if (crs && Array.isArray(crs) && crs.every((_) => typeof _ === 'string')) {\n layer.crs = crs;\n }\n\n // v1.3.0 extract simple geographic bounding box\n let geographicBoundingBox =\n xmlLayer?.EX_GeographicBoundingBox && extractEXBoundingBox(xmlLayer?.EX_GeographicBoundingBox);\n if (geographicBoundingBox) {\n layer.geographicBoundingBox = geographicBoundingBox;\n }\n\n // v1.1.1 extract simple geographic bounding box\n geographicBoundingBox =\n xmlLayer?.LatLonBoundingBox && extractLatLonBoundingBox(xmlLayer?.LatLonBoundingBox);\n if (geographicBoundingBox) {\n layer.geographicBoundingBox = geographicBoundingBox;\n }\n\n // Extract per-CRS bounding boxes\n const boundingBoxes = xmlLayer?.BoundingBox && extractWMSBoundingBoxes(xmlLayer?.BoundingBox);\n if (boundingBoxes && boundingBoxes.length > 0) {\n layer.boundingBoxes = boundingBoxes;\n }\n\n if (xmlLayer?.opaque) {\n layer.opaque = getXMLBoolean(xmlLayer?.opaque);\n }\n if (xmlLayer?.cascaded) {\n layer.cascaded = getXMLBoolean(xmlLayer?.cascaded);\n }\n if (xmlLayer?.queryable) {\n layer.queryable = getXMLBoolean(xmlLayer?.queryable);\n }\n\n // Single layer is not represented as array in XML\n const xmlLayers = getXMLArray(xmlLayer?.Layer);\n const layers: WMSLayer[] = [];\n\n for (const xmlSubLayer of xmlLayers) {\n layers.push(extractLayer(xmlSubLayer));\n }\n\n if (layers.length > 0) {\n layer.layers = layers;\n }\n\n // Clean up object\n for (const [key, value] of Object.entries(layer)) {\n if (value === undefined) {\n delete layer[key];\n }\n }\n\n return layer;\n}\n\n/** WMS 1.3.0 Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractEXBoundingBox(xmlBoundingBox: any): [[number, number], [number, number]] {\n const {\n westBoundLongitude: w,\n northBoundLatitude: n,\n eastBoundLongitude: e,\n southBoundLatitude: s\n } = xmlBoundingBox;\n return [\n [w, s],\n [e, n]\n ];\n}\n\n/** WMS 1.1.1 Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractLatLonBoundingBox(xmlBoundingBox: any): [[number, number], [number, number]] {\n const {minx, miny, maxx, maxy} = xmlBoundingBox;\n return [\n [minx, miny],\n [maxx, maxy]\n ];\n}\n\n/** Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractWMSBoundingBoxes(xmlBoundingBoxes: any): WMSBoundingBox[] {\n const xmlBoxes = getXMLArray(xmlBoundingBoxes);\n return xmlBoxes.map((xmlBox) => extractWMSBoundingBox(xmlBox));\n}\n\n/** Loosely defined geospatial bounding box in unspecified CRS for quick content searches */\nfunction extractWMSBoundingBox(xmlBoundingBox: any): WMSBoundingBox {\n const {CRS, SRS, minx, miny, maxx, maxy, resx, resy} = xmlBoundingBox;\n const boundingBox: WMSBoundingBox = {\n // CRS in 1.3.0, SRS in 1.1.1\n crs: CRS || SRS,\n boundingBox: [\n [getXMLFloat(minx) as number, getXMLFloat(miny) as number],\n [getXMLFloat(maxx) as number, getXMLFloat(maxy) as number]\n ]\n };\n if (resx) {\n boundingBox.xResolution = resx;\n }\n if (resy) {\n boundingBox.yResolution = resy;\n }\n return boundingBox;\n}\n\n/** Traverse layers and inject missing props from parents */\n// eslint-disable-next-line complexity\nfunction addInheritedLayerProps(layer: WMSLayer, parent: WMSLayer | null): void {\n if (parent && parent.geographicBoundingBox && !layer.geographicBoundingBox) {\n layer.geographicBoundingBox = [...parent.geographicBoundingBox];\n }\n\n if (parent && parent.crs && !layer.crs) {\n layer.crs = [...parent.crs];\n }\n\n if (parent && parent.boundingBoxes && !layer.boundingBoxes) {\n layer.boundingBoxes = [...parent.boundingBoxes];\n }\n\n // TODO inherit other elements\n\n for (const subLayer of layer.layers || []) {\n addInheritedLayerProps(subLayer, layer);\n }\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AACzC,SACEC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,WAAW,EACXC,aAAa,QACR,0BAA0B;AA8HjC,OAAO,SAASC,oBAAoBA,CAClCC,OAAe,EACfC,OAAqC,EACpB;EAAA,IAAAC,qBAAA;EACjB,MAAMC,SAAS,IAAAD,qBAAA,GAAGT,SAAS,CAACW,aAAa,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAZ,SAAS,EAAiBO,OAAO,EAAEC,OAAO,CAAC;EAC7D,MAAMK,eAAoB,GACxBH,SAAS,CAACI,mBAAmB,IAAIJ,SAAS,CAACK,gBAAgB,IAAIL,SAAS;EAC1E,MAAMM,YAAY,GAAGC,mBAAmB,CAACJ,eAAe,C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
|
|
4
|
-
const parsedXML = XMLLoader.parseTextSync(text, options);
|
|
3
|
+
var _XMLLoader$parseTextS, _parsedXML$FeatureInf;
|
|
4
|
+
const parsedXML = (_XMLLoader$parseTextS = XMLLoader.parseTextSync) === null || _XMLLoader$parseTextS === void 0 ? void 0 : _XMLLoader$parseTextS.call(XMLLoader, text, options);
|
|
5
5
|
const xmlFeatureInfo = ((_parsedXML$FeatureInf = parsedXML.FeatureInfoResponse) === null || _parsedXML$FeatureInf === void 0 ? void 0 : _parsedXML$FeatureInf.FIELDS) || [];
|
|
6
6
|
const xmlFeatures = Array.isArray(xmlFeatureInfo) ? xmlFeatureInfo : [xmlFeatureInfo];
|
|
7
7
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wms-features.js","names":["XMLLoader","parseWMSFeatureInfo","text","options","_parsedXML$FeatureInf","parsedXML","parseTextSync","xmlFeatureInfo","FeatureInfoResponse","FIELDS","xmlFeatures","Array","isArray","features","map","xmlFeature","extractFeature","xmlFields","attributes","type","bounds","bottom","top","left","right"],"sources":["../../../../../src/lib/parsers/wms/parse-wms-features.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n/** WMS Feature info - response to a WMS `GetFeatureInfo` request */\nexport type WMSFeatureInfo = {\n features: WMSFeature[];\n};\n\nexport type WMSFeature = {\n attributes: Record<string, number | string>;\n type: string;\n bounds: {top: number; bottom: number; left: number; right: number};\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetFeatureInfo` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMSFeatureInfo(text: string, options): WMSFeatureInfo {\n const parsedXML = XMLLoader.parseTextSync(text, options);\n const xmlFeatureInfo: any = parsedXML.FeatureInfoResponse?.FIELDS || [];\n\n const xmlFeatures = Array.isArray(xmlFeatureInfo) ? xmlFeatureInfo : [xmlFeatureInfo];\n\n return {\n features: xmlFeatures.map((xmlFeature) => extractFeature(xmlFeature))\n };\n}\n\nfunction extractFeature(xmlFeature: any) {\n const xmlFields = xmlFeature || {};\n // TODO - not correct\n return {\n attributes: xmlFields,\n type: '',\n bounds: {bottom: 0, top: 0, left: 0, right: 0}\n };\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAiBzC,OAAO,SAASC,mBAAmBA,CAACC,IAAY,EAAEC,OAAO,EAAkB;EAAA,IAAAC,qBAAA;EACzE,MAAMC,SAAS,
|
|
1
|
+
{"version":3,"file":"parse-wms-features.js","names":["XMLLoader","parseWMSFeatureInfo","text","options","_XMLLoader$parseTextS","_parsedXML$FeatureInf","parsedXML","parseTextSync","call","xmlFeatureInfo","FeatureInfoResponse","FIELDS","xmlFeatures","Array","isArray","features","map","xmlFeature","extractFeature","xmlFields","attributes","type","bounds","bottom","top","left","right"],"sources":["../../../../../src/lib/parsers/wms/parse-wms-features.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n/** WMS Feature info - response to a WMS `GetFeatureInfo` request */\nexport type WMSFeatureInfo = {\n features: WMSFeature[];\n};\n\nexport type WMSFeature = {\n attributes: Record<string, number | string>;\n type: string;\n bounds: {top: number; bottom: number; left: number; right: number};\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetFeatureInfo` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMSFeatureInfo(text: string, options): WMSFeatureInfo {\n const parsedXML = XMLLoader.parseTextSync?.(text, options);\n const xmlFeatureInfo: any = parsedXML.FeatureInfoResponse?.FIELDS || [];\n\n const xmlFeatures = Array.isArray(xmlFeatureInfo) ? xmlFeatureInfo : [xmlFeatureInfo];\n\n return {\n features: xmlFeatures.map((xmlFeature) => extractFeature(xmlFeature))\n };\n}\n\nfunction extractFeature(xmlFeature: any) {\n const xmlFields = xmlFeature || {};\n // TODO - not correct\n return {\n attributes: xmlFields,\n type: '',\n bounds: {bottom: 0, top: 0, left: 0, right: 0}\n };\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAiBzC,OAAO,SAASC,mBAAmBA,CAACC,IAAY,EAAEC,OAAO,EAAkB;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EACzE,MAAMC,SAAS,IAAAF,qBAAA,GAAGJ,SAAS,CAACO,aAAa,cAAAH,qBAAA,uBAAvBA,qBAAA,CAAAI,IAAA,CAAAR,SAAS,EAAiBE,IAAI,EAAEC,OAAO,CAAC;EAC1D,MAAMM,cAAmB,GAAG,EAAAJ,qBAAA,GAAAC,SAAS,CAACI,mBAAmB,cAAAL,qBAAA,uBAA7BA,qBAAA,CAA+BM,MAAM,KAAI,EAAE;EAEvE,MAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACL,cAAc,CAAC,GAAGA,cAAc,GAAG,CAACA,cAAc,CAAC;EAErF,OAAO;IACLM,QAAQ,EAAEH,WAAW,CAACI,GAAG,CAAEC,UAAU,IAAKC,cAAc,CAACD,UAAU,CAAC;EACtE,CAAC;AACH;AAEA,SAASC,cAAcA,CAACD,UAAe,EAAE;EACvC,MAAME,SAAS,GAAGF,UAAU,IAAI,CAAC,CAAC;EAElC,OAAO;IACLG,UAAU,EAAED,SAAS;IACrBE,IAAI,EAAE,EAAE;IACRC,MAAM,EAAE;MAACC,MAAM,EAAE,CAAC;MAAEC,GAAG,EAAE,CAAC;MAAEC,IAAI,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAC;EAC/C,CAAC;AACH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { XMLLoader } from '@loaders.gl/xml';
|
|
2
2
|
export function parseWMSLayerDescription(text, options) {
|
|
3
|
-
|
|
3
|
+
var _XMLLoader$parseTextS;
|
|
4
|
+
const parsedXML = (_XMLLoader$parseTextS = XMLLoader.parseTextSync) === null || _XMLLoader$parseTextS === void 0 ? void 0 : _XMLLoader$parseTextS.call(XMLLoader, text, options);
|
|
4
5
|
return parsedXML;
|
|
5
6
|
}
|
|
6
7
|
//# sourceMappingURL=parse-wms-layer-description.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wms-layer-description.js","names":["XMLLoader","parseWMSLayerDescription","text","options","parsedXML","parseTextSync"],"sources":["../../../../../src/lib/parsers/wms/parse-wms-layer-description.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n/** Layer description - response to a WMS `DescribeLayer` request */\nexport type WMSLayerDescription = {\n layers: {}[];\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetFeatureInfo` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMSLayerDescription(text: string, options): WMSLayerDescription {\n const parsedXML = XMLLoader.parseTextSync(text, options);\n // TODO - implement parser\n return parsedXML as unknown as WMSLayerDescription;\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAWzC,OAAO,SAASC,wBAAwBA,CAACC,IAAY,EAAEC,OAAO,EAAuB;EACnF,MAAMC,SAAS,GAAGJ,SAAS,
|
|
1
|
+
{"version":3,"file":"parse-wms-layer-description.js","names":["XMLLoader","parseWMSLayerDescription","text","options","_XMLLoader$parseTextS","parsedXML","parseTextSync","call"],"sources":["../../../../../src/lib/parsers/wms/parse-wms-layer-description.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {XMLLoader} from '@loaders.gl/xml';\n\n/** Layer description - response to a WMS `DescribeLayer` request */\nexport type WMSLayerDescription = {\n layers: {}[];\n};\n\n/**\n * Parses a typed data structure from raw XML for `GetFeatureInfo` response\n * @note Error handlings is fairly weak\n */\nexport function parseWMSLayerDescription(text: string, options): WMSLayerDescription {\n const parsedXML = XMLLoader.parseTextSync?.(text, options);\n // TODO - implement parser\n return parsedXML as unknown as WMSLayerDescription;\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,iBAAiB;AAWzC,OAAO,SAASC,wBAAwBA,CAACC,IAAY,EAAEC,OAAO,EAAuB;EAAA,IAAAC,qBAAA;EACnF,MAAMC,SAAS,IAAAD,qBAAA,GAAGJ,SAAS,CAACM,aAAa,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,SAAS,EAAiBE,IAAI,EAAEC,OAAO,CAAC;EAE1D,OAAOE,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-xml-helpers.js","names":["getXMLArray","xmlValue","Array","isArray","getXMLStringArray","xmlArray","length","every","_","getXMLFloat","defaultValue","arguments","undefined","parseFloat","getXMLInteger","parseInt","getXMLBoolean"],"sources":["../../../../../src/lib/parsers/xml/parse-xml-helpers.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/** A single element of an array is not represented as an array in XML */\nexport function getXMLArray(xmlValue: any): any[] {\n // Already an array, return as is\n if (Array.isArray(xmlValue)) {\n return xmlValue;\n }\n // Single value, wrap in array\n if (xmlValue) {\n return [xmlValue];\n }\n // nullish, return empty array\n return [];\n}\n\n/** Get a list of strings from XML */\nexport function getXMLStringArray(xmlValue: any): string[] {\n const xmlArray = getXMLArray(xmlValue);\n if (xmlArray.length > 0 && xmlArray.every((_) => typeof _ === 'string')) {\n return xmlArray as string[];\n }\n // TODO - error handling?\n return [];\n}\n\n/** Get XML float */\nexport function getXMLFloat(xmlValue: any, defaultValue = undefined): number | undefined {\n switch (typeof xmlValue) {\n case 'number':\n return xmlValue;\n case 'string':\n return parseFloat(xmlValue);\n default:\n return undefined;\n }\n}\n\n/** Get XML integer */\nexport function getXMLInteger(xmlValue: any, defaultValue = undefined): number | undefined {\n switch (typeof xmlValue) {\n case 'number':\n return xmlValue;\n case 'string':\n return parseInt(xmlValue, 10);\n default:\n return undefined;\n }\n}\n\n/** Somewhat arbitrary boolean parsing */\nexport function getXMLBoolean(xmlValue: any): boolean {\n switch (xmlValue) {\n case 'true':\n return true;\n case 'false':\n return false;\n case '1':\n return true;\n case '0':\n return false;\n default:\n return false;\n }\n}\n"],"mappings":"AAGA,OAAO,SAASA,WAAWA,CAACC,QAAa,EAAS;EAEhD,IAAIC,KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,EAAE;IAC3B,OAAOA,QAAQ;EACjB;EAEA,IAAIA,QAAQ,EAAE;IACZ,OAAO,CAACA,QAAQ,CAAC;EACnB;EAEA,OAAO,EAAE;AACX;AAGA,OAAO,SAASG,iBAAiBA,CAACH,QAAa,EAAY;EACzD,MAAMI,QAAQ,GAAGL,WAAW,CAACC,QAAQ,CAAC;EACtC,IAAII,QAAQ,CAACC,MAAM,GAAG,CAAC,IAAID,QAAQ,CAACE,KAAK,CAAEC,CAAC,IAAK,OAAOA,CAAC,KAAK,QAAQ,CAAC,EAAE;IACvE,OAAOH,QAAQ;EACjB;EAEA,OAAO,EAAE;AACX;AAGA,OAAO,SAASI,WAAWA,CAACR,QAAa,EAAgD;EAAA,IAA9CS,YAAY,GAAAC,SAAA,CAAAL,MAAA,QAAAK,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAGC,SAAS;EACjE,QAAQ,OAAOX,QAAQ;IACrB,KAAK,QAAQ;MACX,OAAOA,QAAQ;IACjB,KAAK,QAAQ;MACX,OAAOY,UAAU,CAACZ,QAAQ,CAAC;IAC7B;MACE,OAAOW,SAAS;
|
|
1
|
+
{"version":3,"file":"parse-xml-helpers.js","names":["getXMLArray","xmlValue","Array","isArray","getXMLStringArray","xmlArray","length","every","_","getXMLFloat","defaultValue","arguments","undefined","parseFloat","getXMLInteger","parseInt","getXMLBoolean"],"sources":["../../../../../src/lib/parsers/xml/parse-xml-helpers.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/** A single element of an array is not represented as an array in XML */\nexport function getXMLArray(xmlValue: any): any[] {\n // Already an array, return as is\n if (Array.isArray(xmlValue)) {\n return xmlValue;\n }\n // Single value, wrap in array\n if (xmlValue) {\n return [xmlValue];\n }\n // nullish, return empty array\n return [];\n}\n\n/** Get a list of strings from XML */\nexport function getXMLStringArray(xmlValue: any): string[] {\n const xmlArray = getXMLArray(xmlValue);\n if (xmlArray.length > 0 && xmlArray.every((_) => typeof _ === 'string')) {\n return xmlArray as string[];\n }\n // TODO - error handling?\n return [];\n}\n\n/** Get XML float */\nexport function getXMLFloat(xmlValue: any, defaultValue = undefined): number | undefined {\n switch (typeof xmlValue) {\n case 'number':\n return xmlValue;\n case 'string':\n return parseFloat(xmlValue);\n default:\n return undefined;\n }\n}\n\n/** Get XML integer */\nexport function getXMLInteger(xmlValue: any, defaultValue = undefined): number | undefined {\n switch (typeof xmlValue) {\n case 'number':\n return xmlValue;\n case 'string':\n return parseInt(xmlValue, 10);\n default:\n return undefined;\n }\n}\n\n/** Somewhat arbitrary boolean parsing */\nexport function getXMLBoolean(xmlValue: any): boolean {\n switch (xmlValue) {\n case 'true':\n return true;\n case 'false':\n return false;\n case '1':\n return true;\n case '0':\n return false;\n default:\n return false;\n }\n}\n"],"mappings":"AAGA,OAAO,SAASA,WAAWA,CAACC,QAAa,EAAS;EAEhD,IAAIC,KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,EAAE;IAC3B,OAAOA,QAAQ;EACjB;EAEA,IAAIA,QAAQ,EAAE;IACZ,OAAO,CAACA,QAAQ,CAAC;EACnB;EAEA,OAAO,EAAE;AACX;AAGA,OAAO,SAASG,iBAAiBA,CAACH,QAAa,EAAY;EACzD,MAAMI,QAAQ,GAAGL,WAAW,CAACC,QAAQ,CAAC;EACtC,IAAII,QAAQ,CAACC,MAAM,GAAG,CAAC,IAAID,QAAQ,CAACE,KAAK,CAAEC,CAAC,IAAK,OAAOA,CAAC,KAAK,QAAQ,CAAC,EAAE;IACvE,OAAOH,QAAQ;EACjB;EAEA,OAAO,EAAE;AACX;AAGA,OAAO,SAASI,WAAWA,CAACR,QAAa,EAAgD;EAAA,IAA9CS,YAAY,GAAAC,SAAA,CAAAL,MAAA,QAAAK,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAGC,SAAS;EACjE,QAAQ,OAAOX,QAAQ;IACrB,KAAK,QAAQ;MACX,OAAOA,QAAQ;IACjB,KAAK,QAAQ;MACX,OAAOY,UAAU,CAACZ,QAAQ,CAAC;IAC7B;MACE,OAAOW,SAAS;EACpB;AACF;AAGA,OAAO,SAASE,aAAaA,CAACb,QAAa,EAAgD;EAAA,IAA9CS,YAAY,GAAAC,SAAA,CAAAL,MAAA,QAAAK,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAGC,SAAS;EACnE,QAAQ,OAAOX,QAAQ;IACrB,KAAK,QAAQ;MACX,OAAOA,QAAQ;IACjB,KAAK,QAAQ;MACX,OAAOc,QAAQ,CAACd,QAAQ,EAAE,EAAE,CAAC;IAC/B;MACE,OAAOW,SAAS;EACpB;AACF;AAGA,OAAO,SAASI,aAAaA,CAACf,QAAa,EAAW;EACpD,QAAQA,QAAQ;IACd,KAAK,MAAM;MACT,OAAO,IAAI;IACb,KAAK,OAAO;MACV,OAAO,KAAK;IACd,KAAK,GAAG;MACN,OAAO,IAAI;IACb,KAAK,GAAG;MACN,OAAO,KAAK;IACd;MACE,OAAO,KAAK;EAChB;AACF"}
|
|
@@ -3,8 +3,6 @@ import { ImageSource } from '../../sources/image-source';
|
|
|
3
3
|
export class ArcGISImageServer extends ImageSource {
|
|
4
4
|
constructor(props) {
|
|
5
5
|
super(props);
|
|
6
|
-
_defineProperty(this, "props", void 0);
|
|
7
|
-
this.props = props;
|
|
8
6
|
}
|
|
9
7
|
async getMetadata() {
|
|
10
8
|
return await this.metadata();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-image-service.js","names":["ImageSource","ArcGISImageServer","constructor","props","
|
|
1
|
+
{"version":3,"file":"arcgis-image-service.js","names":["ImageSource","ArcGISImageServer","constructor","props","getMetadata","metadata","getImage","parameters","Error","exportImage","options","metadataURL","concat","url","exportImageURL","bbox","size","width","height","arcgisOptions","getUrl","path","extra","first","key","value","Object","entries","Array","isArray","toUpperCase","join","String","checkResponse","response","ok","_defineProperty","toLowerCase","includes"],"sources":["../../../../../src/lib/services/arcgis/arcgis-image-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {ImageType} from '@loaders.gl/images';\nimport type {ImageSourceMetadata, GetImageParameters} from '../../sources/image-source';\nimport type {ImageSourceProps} from '../../sources/image-source';\nimport {ImageSource} from '../../sources/image-source';\n\nexport type ArcGISImageServerProps = ImageSourceProps & {\n url: string;\n};\n\n/**\n * ArcGIS ImageServer\n * Note - exports a big API, that could be exposed here if there is a use case\n * @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm\n */\nexport class ArcGISImageServer extends ImageSource<ArcGISImageServerProps> {\n static type: 'arcgis-image-server' = 'arcgis-image-server';\n static testURL = (url: string): boolean => url.toLowerCase().includes('ImageServer');\n\n constructor(props: ArcGISImageServerProps) {\n super(props);\n }\n\n // ImageSource (normalized endpoints)\n\n async getMetadata(): Promise<ImageSourceMetadata> {\n return (await this.metadata()) as ImageSourceMetadata;\n // TODO - normalize metadata\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n throw new Error('not implemented');\n // TODO - Map generic parameters to ArcGIS specific parameters\n // return await this.exportImage(parameters);\n }\n\n // ImageServer endpoints\n\n async metadata(): Promise<unknown> {\n // We just need a JSON parsing...\n // return this.getUrl({path: '', ...options});\n throw new Error('not implemented');\n }\n\n /** \n * Form a URL to an ESRI ImageServer\n // https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&compressionQuality=&bandIds=&mosaicRule=&renderingRule=&f=image`,\n */\n exportImage(options: {\n boundingBox: [number, number, number, number];\n boundingBoxSR?: string;\n width: number;\n height: number;\n imageSR?: string;\n time?: never;\n format?: 'jpgpng';\n pixelType?: 'U8';\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 }): Promise<ImageType> {\n // See WMSService.getMap()\n throw new Error('not implemented');\n }\n\n // URL creators\n\n metadataURL(options: {parameters?: Record<string, unknown>}): string {\n return `${this.props.url}?f=pjson`;\n }\n\n /** \n * Form a URL to an ESRI ImageServer\n // https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?\n // bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&\n // size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&\n // noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&\n // compressionQuality=&bandIds=&mosaicRule=&renderingRule=&\n // f=image\n */\n exportImageURL(options: {\n bbox: [number, number, number, number];\n boxSR?: string;\n width: number;\n height: number;\n imageSR?: string;\n time?: never;\n format?: 'jpgpng';\n pixelType?: 'U8';\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 bbox = `bbox=${options.bbox[0]},${options.bbox[1]},${options.bbox[2]},${options.bbox[3]}`;\n const size = `size=${options.width},${options.height}`;\n const arcgisOptions = {...options, bbox, size};\n // @ts-expect-error\n delete arcgisOptions.width;\n // @ts-expect-error\n delete arcgisOptions.height;\n return this.getUrl('exportImage', arcgisOptions);\n }\n\n // INTERNAL METHODS\n\n /**\n * @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?\n * @note if override is common, maybe add a callback prop?\n * */\n protected getUrl(\n path: string,\n options: Record<string, unknown>,\n extra?: Record<string, unknown>\n ): string {\n let url = `${this.props.url}/${path}`;\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 url;\n }\n\n /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */\n protected async checkResponse(response: Response) {\n if (!response.ok) {\n // } || response.headers['content-type'] === WMSErrorLoader.mimeTypes[0]) {\n // const arrayBuffer = await response.arrayBuffer();\n // const error = await WMSErrorLoader.parse(arrayBuffer, this.loadOptions);\n throw new Error('error');\n }\n }\n}\n"],"mappings":";AAKA,SAAQA,WAAW,QAAO,4BAA4B;AAWtD,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAyB;EAIzEE,WAAWA,CAACC,KAA6B,EAAE;IACzC,KAAK,CAACA,KAAK,CAAC;EACd;EAIA,MAAMC,WAAWA,CAAA,EAAiC;IAChD,OAAQ,MAAM,IAAI,CAACC,QAAQ,CAAC,CAAC;EAE/B;EAEA,MAAMC,QAAQA,CAACC,UAA8B,EAAsB;IACjE,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EAGpC;EAIA,MAAMH,QAAQA,CAAA,EAAqB;IAGjC,MAAM,IAAIG,KAAK,CAAC,iBAAiB,CAAC;EACpC;EAMAC,WAAWA,CAACC,OAkBX,EAAsB;IAErB,MAAM,IAAIF,KAAK,CAAC,iBAAiB,CAAC;EACpC;EAIAG,WAAWA,CAACD,OAA+C,EAAU;IACnE,UAAAE,MAAA,CAAU,IAAI,CAACT,KAAK,CAACU,GAAG;EAC1B;EAWAC,cAAcA,CAACJ,OAkBd,EAAU;IACT,MAAMK,IAAI,WAAAH,MAAA,CAAWF,OAAO,CAACK,IAAI,CAAC,CAAC,CAAC,OAAAH,MAAA,CAAIF,OAAO,CAACK,IAAI,CAAC,CAAC,CAAC,OAAAH,MAAA,CAAIF,OAAO,CAACK,IAAI,CAAC,CAAC,CAAC,OAAAH,MAAA,CAAIF,OAAO,CAACK,IAAI,CAAC,CAAC,CAAC,CAAE;IAC/F,MAA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UACS,qBAAqB;AAAAmC,eAAA,CAD/CnC,iBAAiB,aAEVY,GAAW,IAAcA,GAAG,CAACwB,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-server.js","names":["getArcGISServices","url","fetchFile","arguments","length","undefined","fetch","includes","serverUrl","replace","loadServiceDirectory","path","serviceUrl","concat","join","response","directory","json","services","extractServices","folders","promises","map","folder","folderServices","Promise","all","push","arcgisServices","service","name","type","toLocaleLowerCase"],"sources":["../../../../../src/lib/services/arcgis/arcgis-server.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type Service = {name: string; type: string; url: string};\n\ntype FetchLike = typeof fetch;\n\n/**\n * (Recursively) load the service directory from an ArcGIS Server URL\n * @param url\n * @param fetchFile= Optional fetch function override\n * @returns\n */\nexport async function getArcGISServices(\n url: string,\n fetchFile: FetchLike = fetch\n): Promise<Service[] | null> {\n if (url.includes('rest/services')) {\n const serverUrl = url.replace(/rest\\/services.*$/i, 'rest/services');\n return loadServiceDirectory(serverUrl, fetchFile, []);\n }\n return null;\n}\n\nasync function loadServiceDirectory(\n serverUrl: string,\n fetch: FetchLike,\n path: string[]\n): Promise<Service[]> {\n const serviceUrl = `${serverUrl}/${path.join('/')}`;\n\n const response = await fetch(`${serviceUrl}?f=pjson`);\n const directory = await response.json();\n\n const services = extractServices(directory, serviceUrl);\n\n const folders = (directory.folders || []) as string[];\n const promises = folders.map((folder) =>\n loadServiceDirectory(`${serverUrl}`, fetch, [...path, folder])\n );\n\n for (const folderServices of await Promise.all(promises)) {\n services.push(...folderServices);\n }\n\n return services;\n}\n\nfunction extractServices(directory: unknown, url: string): Service[] {\n const arcgisServices = ((directory as any).services || []) as {name: string; type: string}[];\n const services: Service[] = [];\n for (const service of arcgisServices) {\n services.push({\n name: service.name,\n type: `arcgis-${service.type.toLocaleLowerCase().replace('server', '-server')}`,\n url: `${url}${service.name}/${service.type}`\n });\n }\n return services;\n}\n"],"mappings":"AAYA,OAAO,eAAeA,iBAAiBA,CACrCC,GAAW,EAEgB;EAAA,IAD3BC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAE5B,IAAIL,GAAG,CAACM,QAAQ,CAAC,eAAe,CAAC,EAAE;IACjC,MAAMC,SAAS,GAAGP,GAAG,CAACQ,OAAO,CAAC,oBAAoB,EAAE,eAAe,CAAC;IACpE,OAAOC,oBAAoB,CAACF,SAAS,EAAEN,SAAS,EAAE,EAAE,CAAC;EACvD;EACA,OAAO,IAAI;AACb;AAEA,eAAeQ,oBAAoBA,CACjCF,SAAiB,EACjBF,KAAgB,EAChBK,IAAc,EACM;EACpB,MAAMC,UAAU,MAAAC,MAAA,CAAML,SAAS,OAAAK,MAAA,CAAIF,IAAI,CAACG,IAAI,CAAC,GAAG,CAAC,CAAE;EAEnD,MAAMC,QAAQ,GAAG,MAAMT,KAAK,IAAAO,MAAA,CAAID,UAAU,
|
|
1
|
+
{"version":3,"file":"arcgis-server.js","names":["getArcGISServices","url","fetchFile","arguments","length","undefined","fetch","includes","serverUrl","replace","loadServiceDirectory","path","serviceUrl","concat","join","response","directory","json","services","extractServices","folders","promises","map","folder","folderServices","Promise","all","push","arcgisServices","service","name","type","toLocaleLowerCase"],"sources":["../../../../../src/lib/services/arcgis/arcgis-server.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type Service = {name: string; type: string; url: string};\n\ntype FetchLike = typeof fetch;\n\n/**\n * (Recursively) load the service directory from an ArcGIS Server URL\n * @param url\n * @param fetchFile= Optional fetch function override\n * @returns\n */\nexport async function getArcGISServices(\n url: string,\n fetchFile: FetchLike = fetch\n): Promise<Service[] | null> {\n if (url.includes('rest/services')) {\n const serverUrl = url.replace(/rest\\/services.*$/i, 'rest/services');\n return loadServiceDirectory(serverUrl, fetchFile, []);\n }\n return null;\n}\n\nasync function loadServiceDirectory(\n serverUrl: string,\n fetch: FetchLike,\n path: string[]\n): Promise<Service[]> {\n const serviceUrl = `${serverUrl}/${path.join('/')}`;\n\n const response = await fetch(`${serviceUrl}?f=pjson`);\n const directory = await response.json();\n\n const services = extractServices(directory, serviceUrl);\n\n const folders = (directory.folders || []) as string[];\n const promises = folders.map((folder) =>\n loadServiceDirectory(`${serverUrl}`, fetch, [...path, folder])\n );\n\n for (const folderServices of await Promise.all(promises)) {\n services.push(...folderServices);\n }\n\n return services;\n}\n\nfunction extractServices(directory: unknown, url: string): Service[] {\n const arcgisServices = ((directory as any).services || []) as {name: string; type: string}[];\n const services: Service[] = [];\n for (const service of arcgisServices) {\n services.push({\n name: service.name,\n type: `arcgis-${service.type.toLocaleLowerCase().replace('server', '-server')}`,\n url: `${url}${service.name}/${service.type}`\n });\n }\n return services;\n}\n"],"mappings":"AAYA,OAAO,eAAeA,iBAAiBA,CACrCC,GAAW,EAEgB;EAAA,IAD3BC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAE5B,IAAIL,GAAG,CAACM,QAAQ,CAAC,eAAe,CAAC,EAAE;IACjC,MAAMC,SAAS,GAAGP,GAAG,CAACQ,OAAO,CAAC,oBAAoB,EAAE,eAAe,CAAC;IACpE,OAAOC,oBAAoB,CAACF,SAAS,EAAEN,SAAS,EAAE,EAAE,CAAC;EACvD;EACA,OAAO,IAAI;AACb;AAEA,eAAeQ,oBAAoBA,CACjCF,SAAiB,EACjBF,KAAgB,EAChBK,IAAc,EACM;EACpB,MAAMC,UAAU,MAAAC,MAAA,CAAML,SAAS,OAAAK,MAAA,CAAIF,IAAI,CAACG,IAAI,CAAC,GAAG,CAAC,CAAE;EAEnD,MAAMC,QAAQ,GAAG,MAAMT,KAAK,IAAAO,MAAA,CAAID,UAAU,aAAU,CAAC;EACrD,MAAMI,SAAS,GAAG,MAAMD,QAAQ,CAACE,IAAI,CAAC,CAAC;EAEvC,MAAMC,QAAQ,GAAGC,eAAe,CAACH,SAAS,EAAEJ,UAAU,CAAC;EAEvD,MAAMQ,OAAO,GAAIJ,SAAS,CAACI,OAAO,IAAI,EAAe;EACrD,MAAMC,QAAQ,GAAGD,OAAO,CAACE,GAAG,CAAEC,MAAM,IAClCb,oBAAoB,IAAAG,MAAA,CAAIL,SAAS,GAAIF,KAAK,EAAE,CAAC,GAAGK,IAAI,EAAEY,MAAM,CAAC,CAC/D,CAAC;EAED,KAAK,MAAMC,cAAc,IAAI,MAAMC,OAAO,CAACC,GAAG,CAACL,QAAQ,CAAC,EAAE;IACxDH,QAAQ,CAACS,IAAI,CAAC,GAAGH,cAAc,CAAC;EAClC;EAEA,OAAON,QAAQ;AACjB;AAEA,SAASC,eAAeA,CAACH,SAAkB,EAAEf,GAAW,EAAa;EACnE,MAAM2B,cAAc,GAAKZ,SAAS,CAASE,QAAQ,IAAI,EAAqC;EAC5F,MAAMA,QAAmB,GAAG,EAAE;EAC9B,KAAK,MAAMW,OAAO,IAAID,cAAc,EAAE;IACpCV,QAAQ,CAACS,IAAI,CAAC;MACZG,IAAI,EAAED,OAAO,CAACC,IAAI;MAClBC,IAAI,YAAAlB,MAAA,CAAYgB,OAAO,CAACE,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACvB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAE;MAC/ER,GAAG,KAAAY,MAAA,CAAKZ,GAAG,EAAAY,MAAA,CAAGgB,OAAO,CAACC,IAAI,OAAAjB,MAAA,CAAIgB,OAAO,CAACE,IAAI;IAC5C,CAAC,CAAC;EACJ;EACA,OAAOb,QAAQ;AACjB"}
|
|
@@ -4,8 +4,6 @@ import { ImageSource } from '../../sources/image-source';
|
|
|
4
4
|
export class ImageService extends ImageSource {
|
|
5
5
|
constructor(props) {
|
|
6
6
|
super(props);
|
|
7
|
-
_defineProperty(this, "props", void 0);
|
|
8
|
-
this.props = props;
|
|
9
7
|
}
|
|
10
8
|
async getMetadata() {
|
|
11
9
|
throw new Error('ImageSource.getMetadata not implemented');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-service.js","names":["ImageLoader","ImageSource","ImageService","constructor","props","
|
|
1
|
+
{"version":3,"file":"image-service.js","names":["ImageLoader","ImageSource","ImageService","constructor","props","getMetadata","Error","getImage","parameters","granularParameters","getGranularParameters","url","getURLFromTemplate","response","fetch","arrayBuffer","parse","east","north","west","south","bbox","key","value","Object","entries","replace","concat","String","_defineProperty","toLowerCase","includes"],"sources":["../../../../../src/lib/services/generic/image-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ImageType} from '@loaders.gl/images';\nimport {ImageLoader} from '@loaders.gl/images';\n\nimport type {ImageSourceMetadata, GetImageParameters} from '../../sources/image-source';\nimport {ImageSource} from '../../sources/image-source';\n\n/** Template URL string should contain `${width}` etc which will be substituted. */\nexport type ImageServiceProps = {\n /** Base URL to the service */\n url: string;\n /** Any load options to the loaders.gl Loaders used by the WMSService methods */\n loadOptions?: LoaderOptions;\n};\n\n/**\n * Quickly connect to \"ad hoc\" image sources without subclassing ImageSource.\n * ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources\n * Accepts a template url string and builds requests URLs\n */\nexport class ImageService<PropsT extends ImageServiceProps> extends ImageSource<PropsT> {\n static type: 'template' = 'template';\n static testURL = (url: string): boolean => url.toLowerCase().includes('{');\n\n constructor(props: PropsT) {\n super(props);\n }\n\n // IMAGE SOURCE API\n\n async getMetadata(): Promise<ImageSourceMetadata> {\n throw new Error('ImageSource.getMetadata not implemented');\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n const granularParameters = this.getGranularParameters(parameters);\n const url = this.getURLFromTemplate(granularParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n return await ImageLoader.parse(arrayBuffer);\n }\n\n // HELPERS\n\n /** Break up bounding box in east, north, south, west */\n protected getGranularParameters(parameters: GetImageParameters): Record<string, unknown> {\n const [east, north, west, south] = parameters.bbox;\n return {...parameters, east, north, south, west};\n }\n\n /** Supports both ${} and {} notations */\n protected getURLFromTemplate(parameters: Record<string, unknown>): string {\n let url = this.props.url;\n for (const [key, value] of Object.entries(parameters)) {\n // TODO - parameter could be repeated\n // const regex = new RegExp(`\\${${key}}`, 'g');\n url = url.replace(`\\${${key}}`, String(value));\n url = url.replace(`{${key}}`, String(value));\n }\n return url;\n }\n}\n"],"mappings":";AAIA,SAAQA,WAAW,QAAO,oBAAoB;AAG9C,SAAQC,WAAW,QAAO,4BAA4B;AAetD,OAAO,MAAMC,YAAY,SAA2CD,WAAW,CAAS;EAItFE,WAAWA,CAACC,KAAa,EAAE;IACzB,KAAK,CAACA,KAAK,CAAC;EACd;EAIA,MAAMC,WAAWA,CAAA,EAAiC;IAChD,MAAM,IAAIC,KAAK,CAAC,yCAAyC,CAAC;EAC5D;EAEA,MAAMC,QAAQA,CAACC,UAA8B,EAAsB;IACjE,MAAMC,kBAAkB,GAAG,IAAI,CAACC,qBAAqB,CAACF,UAAU,CAAC;IACjE,MAAMG,GAAG,GAAG,IAAI,CAACC,kBAAkB,CAACH,kBAAkB,CAAC;IACvD,MAAMI,QAAQ,GAAG,MAAM,IAAI,CAACC,KAAK,CAACH,GAAG,CAAC;IACtC,MAAMI,WAAW,GAAG,MAAMF,QAAQ,CAACE,WAAW,CAAC,CAAC;IAChD,OAAO,MAAMf,WAAW,CAACgB,KAAK,CAACD,WAAW,CAAC;EAC7C;EAKUL,qBAAqBA,CAACF,UAA8B,EAA2B;IACvF,MAAM,CAACS,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,CAAC,GAAGZ,UAAU,CAACa,IAAI;IAClD,OAAO;MAAC,GAAGb,UAAU;MAAES,IAAI;MAAEC,KAAK;MAAEE,KAAK;MAAED;IAAI,CAAC;EAClD;EAGUP,kBAAkBA,CAACJ,UAAmC,EAAU;IACxE,IAAIG,GAAG,GAAG,IAAI,CAACP,KAAK,CAACO,GAAG;IACxB,KAAK,MAAM,CAACW,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACjB,UAAU,CAAC,EAAE;MAGrDG,GAAG,GAAGA,GAAG,CAACe,OAAO,MAAAC,MAAA,CAAOL,GAAG,QAAKM,MAAM,CAACL,KAAK,CAAC,CAAC;MAC9CZ,GAAG,GAAGA,GAAG,CAACe,OAAO,KAAAC,MAAA,CAAKL,GAAG,QAAKM,MAAM,CAACL,KAAK,CAAC,CAAC;IAC9C;IACA,OAAOZ,GAAG;EACZ;AACF;AAACkB,eAAA,CAzCY3B,YAAY,UACG,UAAU;AAAA2B,eAAA,CADzB3B,YAAY,aAELS,GAAW,IAAcA,GAAG,CAACmB,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,GAAG,CAAC"}
|
|
@@ -7,10 +7,8 @@ import { WMSErrorLoader as CSWErrorLoader } from '../../../wms-error-loader';
|
|
|
7
7
|
export class CSWService extends DataSource {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
|
-
_defineProperty(this, "props", void 0);
|
|
11
10
|
_defineProperty(this, "capabilities", null);
|
|
12
11
|
_defineProperty(this, "loaders", [CSWErrorLoader, CSWCapabilitiesLoader]);
|
|
13
|
-
this.props = props;
|
|
14
12
|
}
|
|
15
13
|
async getMetadata() {
|
|
16
14
|
const capabilities = await this.getCapabilities();
|
|
@@ -1 +1 @@
|
|
|
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' | '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\nexport type Service = {name: string; type: string; url: string; params?: string; scheme?: string};\n\nexport type CSWServiceProps = DataSourceProps & {\n url: string;\n};\n\n/**\n * The CSWService class provides\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 * - implements the ImageService interface\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class CSWService extends DataSource {\n static type: 'csw' = 'csw';\n static testURL = (url: string): boolean => url.toLowerCase().includes('csw');\n\n props: CSWServiceProps;\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 this.props = 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;AAwC1E,OAAO,MAAMC,UAAU,SAASN,UAAU,CAAC;EAWzCO,WAAWA,CAACC,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,uBAPwB,IAAI;IAAAA,eAAA,kBAGxB,CAACJ,cAAc,EAAEJ,qBAAqB,CAAC;IAKxD,IAAI,CAACO,KAAK,GAAGA,KAAK;EACpB;EAEA,MAAME,WAAWA,CAAA,EAA6B;IAC5C,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACC,eAAe,EAAE;IACjD,OAAO,IAAI,CAACC,iBAAiB,CAACF,YAAY,CAAC;EAC7C;EAEAE,iBAAiBA,CAACF,YAA6B,EAAmB;IAChE,OAAOA,YAAY;EACrB;EAEA,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,KAAK;AAAAG,eAAA,CADfH,UAAU,aAEHiB,GAAW,IAAcA,GAAG,CAACiD,WAAW,EAAE,CAACL,QAAQ,CAAC,KAAK,CAAC"}
|
|
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' | '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\nexport type Service = {name: string; type: string; url: string; params?: string; scheme?: string};\n\nexport type CSWServiceProps = DataSourceProps & {\n url: string;\n};\n\n/**\n * The CSWService class provides\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 * - implements the ImageService interface\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;AAwC1E,OAAO,MAAMC,UAAU,SAASN,UAAU,CAA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