@loaders.gl/ogc 0.0.0-stage → 5.0.0-alpha.13
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/README.md +10 -2
- package/dist/index.cjs +7052 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/stac/index.cjs +1095 -0
- package/dist/stac/index.cjs.map +6 -0
- package/dist/stac/index.d.ts +4 -0
- package/dist/stac/index.d.ts.map +1 -0
- package/dist/stac/index.js +5 -0
- package/dist/stac/index.js.map +1 -0
- package/dist/stac/stac-source-loader-types.d.ts +44 -0
- package/dist/stac/stac-source-loader-types.d.ts.map +1 -0
- package/dist/stac/stac-source-loader-types.js +43 -0
- package/dist/stac/stac-source-loader-types.js.map +1 -0
- package/dist/stac/stac-source.cjs +1544 -0
- package/dist/stac/stac-source.cjs.map +6 -0
- package/dist/stac/stac-source.d.ts +92 -0
- package/dist/stac/stac-source.d.ts.map +1 -0
- package/dist/stac/stac-source.js +500 -0
- package/dist/stac/stac-source.js.map +1 -0
- package/dist/stac/stac-types.d.ts +213 -0
- package/dist/stac/stac-types.d.ts.map +1 -0
- package/dist/stac/stac-types.js +5 -0
- package/dist/stac/stac-types.js.map +1 -0
- package/dist/wms/bundled.cjs +7295 -0
- package/dist/wms/bundled.cjs.map +6 -0
- package/dist/wms/bundled.d.ts +24 -0
- package/dist/wms/bundled.d.ts.map +1 -0
- package/dist/wms/bundled.js +18 -0
- package/dist/wms/bundled.js.map +1 -0
- package/dist/wms/capability-graph.d.ts +42 -0
- package/dist/wms/capability-graph.d.ts.map +1 -0
- package/dist/wms/capability-graph.js +118 -0
- package/dist/wms/capability-graph.js.map +1 -0
- package/dist/wms/crs-utils.d.ts +24 -0
- package/dist/wms/crs-utils.d.ts.map +1 -0
- package/dist/wms/crs-utils.js +57 -0
- package/dist/wms/crs-utils.js.map +1 -0
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts +34 -0
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/csw-capabilities-loader-with-parser.js +15 -0
- package/dist/wms/csw-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/csw-capabilities-loader.d.ts +56 -0
- package/dist/wms/csw-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/csw-capabilities-loader.js +38 -0
- package/dist/wms/csw-capabilities-loader.js.map +1 -0
- package/dist/wms/csw-domain-loader-with-parser.d.ts +33 -0
- package/dist/wms/csw-domain-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/csw-domain-loader-with-parser.js +15 -0
- package/dist/wms/csw-domain-loader-with-parser.js.map +1 -0
- package/dist/wms/csw-domain-loader.d.ts +55 -0
- package/dist/wms/csw-domain-loader.d.ts.map +1 -0
- package/dist/wms/csw-domain-loader.js +38 -0
- package/dist/wms/csw-domain-loader.js.map +1 -0
- package/dist/wms/csw-records-loader-with-parser.d.ts +33 -0
- package/dist/wms/csw-records-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/csw-records-loader-with-parser.js +15 -0
- package/dist/wms/csw-records-loader-with-parser.js.map +1 -0
- package/dist/wms/csw-records-loader.d.ts +55 -0
- package/dist/wms/csw-records-loader.d.ts.map +1 -0
- package/dist/wms/csw-records-loader.js +38 -0
- package/dist/wms/csw-records-loader.js.map +1 -0
- package/dist/wms/csw-source-loader.d.ts +165 -0
- package/dist/wms/csw-source-loader.d.ts.map +1 -0
- package/dist/wms/csw-source-loader.js +203 -0
- package/dist/wms/csw-source-loader.js.map +1 -0
- package/dist/wms/feature-pagination.d.ts +34 -0
- package/dist/wms/feature-pagination.d.ts.map +1 -0
- package/dist/wms/feature-pagination.js +159 -0
- package/dist/wms/feature-pagination.js.map +1 -0
- package/dist/wms/gml-loader-types.d.ts +68 -0
- package/dist/wms/gml-loader-types.d.ts.map +1 -0
- package/dist/wms/gml-loader-types.js +38 -0
- package/dist/wms/gml-loader-types.js.map +1 -0
- package/dist/wms/gml-loader.cjs +5779 -0
- package/dist/wms/gml-loader.cjs.map +6 -0
- package/dist/wms/gml-loader.d.ts +38 -0
- package/dist/wms/gml-loader.d.ts.map +1 -0
- package/dist/wms/gml-loader.js +195 -0
- package/dist/wms/gml-loader.js.map +1 -0
- package/dist/wms/index.cjs +12416 -0
- package/dist/wms/index.cjs.map +6 -0
- package/dist/wms/index.d.ts +61 -0
- package/dist/wms/index.d.ts.map +1 -0
- package/dist/wms/index.js +36 -0
- package/dist/wms/index.js.map +1 -0
- package/dist/wms/lib/deprecated/create-image-source.d.ts +27 -0
- package/dist/wms/lib/deprecated/create-image-source.d.ts.map +1 -0
- package/dist/wms/lib/deprecated/create-image-source.js +44 -0
- package/dist/wms/lib/deprecated/create-image-source.js.map +1 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.d.ts +14 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.d.ts.map +1 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.js +21 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts +79 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.js +23 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts +17 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.js +32 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts +34 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.js +56 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.d.ts +6 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.js +29 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.js.map +1 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.d.ts +3 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.d.ts.map +1 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.js +118 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.js.map +1 -0
- package/dist/wms/lib/parsers/gml/parse-gml.d.ts +66 -0
- package/dist/wms/lib/parsers/gml/parse-gml.d.ts.map +1 -0
- package/dist/wms/lib/parsers/gml/parse-gml.js +641 -0
- package/dist/wms/lib/parsers/gml/parse-gml.js.map +1 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.d.ts +4 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.d.ts.map +1 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.js +45 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.js.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.d.ts +19 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.d.ts.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.js +74 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.js.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.d.ts +63 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.d.ts.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.js +82 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.js.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.d.ts +97 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.js +60 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.d.ts +7 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.js +31 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.d.ts +126 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.js +232 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts +8 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.js +21 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.d.ts +20 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.js +26 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts +11 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.js +14 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.js.map +1 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.d.ts +101 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js +175 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.d.ts +11 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.d.ts.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.js +63 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts +4 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.js +9 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.js.map +1 -0
- package/dist/wms/lib/tile-grid.d.ts +14 -0
- package/dist/wms/lib/tile-grid.d.ts.map +1 -0
- package/dist/wms/lib/tile-grid.js +28 -0
- package/dist/wms/lib/tile-grid.js.map +1 -0
- package/dist/wms/managed-vector-source.d.ts +66 -0
- package/dist/wms/managed-vector-source.d.ts.map +1 -0
- package/dist/wms/managed-vector-source.js +307 -0
- package/dist/wms/managed-vector-source.js.map +1 -0
- package/dist/wms/ogc-api-coverages-source-loader.d.ts +64 -0
- package/dist/wms/ogc-api-coverages-source-loader.d.ts.map +1 -0
- package/dist/wms/ogc-api-coverages-source-loader.js +78 -0
- package/dist/wms/ogc-api-coverages-source-loader.js.map +1 -0
- package/dist/wms/ogc-api-edr-source-loader.d.ts +72 -0
- package/dist/wms/ogc-api-edr-source-loader.d.ts.map +1 -0
- package/dist/wms/ogc-api-edr-source-loader.js +82 -0
- package/dist/wms/ogc-api-edr-source-loader.js.map +1 -0
- package/dist/wms/ogc-api-source-loader.d.ts +223 -0
- package/dist/wms/ogc-api-source-loader.d.ts.map +1 -0
- package/dist/wms/ogc-api-source-loader.js +517 -0
- package/dist/wms/ogc-api-source-loader.js.map +1 -0
- package/dist/wms/service-capabilities.d.ts +17 -0
- package/dist/wms/service-capabilities.d.ts.map +1 -0
- package/dist/wms/service-capabilities.js +110 -0
- package/dist/wms/service-capabilities.js.map +1 -0
- package/dist/wms/service-runtime.d.ts +67 -0
- package/dist/wms/service-runtime.d.ts.map +1 -0
- package/dist/wms/service-runtime.js +165 -0
- package/dist/wms/service-runtime.js.map +1 -0
- package/dist/wms/unbundled.cjs +5995 -0
- package/dist/wms/unbundled.cjs.map +6 -0
- package/dist/wms/unbundled.d.ts +18 -0
- package/dist/wms/unbundled.d.ts.map +1 -0
- package/dist/wms/unbundled.js +12 -0
- package/dist/wms/unbundled.js.map +1 -0
- package/dist/wms/wcs-source-loader.d.ts +99 -0
- package/dist/wms/wcs-source-loader.d.ts.map +1 -0
- package/dist/wms/wcs-source-loader.js +178 -0
- package/dist/wms/wcs-source-loader.js.map +1 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.d.ts +35 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.js +17 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wfs-capabilities-loader.d.ts +59 -0
- package/dist/wms/wfs-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wfs-capabilities-loader.js +42 -0
- package/dist/wms/wfs-capabilities-loader.js.map +1 -0
- package/dist/wms/wfs-source-loader.d.ts +353 -0
- package/dist/wms/wfs-source-loader.d.ts.map +1 -0
- package/dist/wms/wfs-source-loader.js +606 -0
- package/dist/wms/wfs-source-loader.js.map +1 -0
- package/dist/wms/wip/data-source.d.ts +54 -0
- package/dist/wms/wip/data-source.d.ts.map +1 -0
- package/dist/wms/wip/data-source.js +62 -0
- package/dist/wms/wip/data-source.js.map +1 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.d.ts +78 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.d.ts.map +1 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.js +14 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.d.ts +87 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.d.ts.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.js +76 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.d.ts +7 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.js +34 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.d.ts +12 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.js +16 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader.d.ts +12 -0
- package/dist/wms/wip/wcs-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader.js +36 -0
- package/dist/wms/wip/wcs-capabilities-loader.js.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.d.ts +7 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.js +15 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader.d.ts +7 -0
- package/dist/wms/wip/wms-feature-info-loader.d.ts.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader.js +19 -0
- package/dist/wms/wip/wms-feature-info-loader.js.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.d.ts +7 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.js +15 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader.d.ts +7 -0
- package/dist/wms/wip/wms-layer-description-loader.d.ts.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader.js +19 -0
- package/dist/wms/wip/wms-layer-description-loader.js.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts +11 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.js +17 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader.d.ts +11 -0
- package/dist/wms/wip/wmts-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader.js +36 -0
- package/dist/wms/wip/wmts-capabilities-loader.js.map +1 -0
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts +40 -0
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wms-capabilities-loader-with-parser.js +19 -0
- package/dist/wms/wms-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wms-capabilities-loader.d.ts +62 -0
- package/dist/wms/wms-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wms-capabilities-loader.js +38 -0
- package/dist/wms/wms-capabilities-loader.js.map +1 -0
- package/dist/wms/wms-error-loader-with-parser.d.ts +39 -0
- package/dist/wms/wms-error-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wms-error-loader-with-parser.js +28 -0
- package/dist/wms/wms-error-loader-with-parser.js.map +1 -0
- package/dist/wms/wms-error-loader.d.ts +64 -0
- package/dist/wms/wms-error-loader.d.ts.map +1 -0
- package/dist/wms/wms-error-loader.js +40 -0
- package/dist/wms/wms-error-loader.js.map +1 -0
- package/dist/wms/wms-format.d.ts +13 -0
- package/dist/wms/wms-format.d.ts.map +1 -0
- package/dist/wms/wms-format.js +25 -0
- package/dist/wms/wms-format.js.map +1 -0
- package/dist/wms/wms-source-loader.d.ts +226 -0
- package/dist/wms/wms-source-loader.d.ts.map +1 -0
- package/dist/wms/wms-source-loader.js +397 -0
- package/dist/wms/wms-source-loader.js.map +1 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.cjs +2189 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.cjs.map +6 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.d.ts +3 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.js +13 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wmts-capabilities-loader.d.ts +7 -0
- package/dist/wms/wmts-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wmts-capabilities-loader.js +24 -0
- package/dist/wms/wmts-capabilities-loader.js.map +1 -0
- package/dist/wms/wmts-source-loader.d.ts +120 -0
- package/dist/wms/wmts-source-loader.d.ts.map +1 -0
- package/dist/wms/wmts-source-loader.js +472 -0
- package/dist/wms/wmts-source-loader.js.map +1 -0
- package/package.json +88 -4
- package/src/index.ts +6 -0
- package/src/stac/index.ts +25 -0
- package/src/stac/stac-source-loader-types.ts +65 -0
- package/src/stac/stac-source.ts +635 -0
- package/src/stac/stac-types.ts +230 -0
- package/src/wms/bundled.ts +30 -0
- package/src/wms/capability-graph.ts +152 -0
- package/src/wms/crs-utils.ts +67 -0
- package/src/wms/csw-capabilities-loader-with-parser.ts +30 -0
- package/src/wms/csw-capabilities-loader.ts +54 -0
- package/src/wms/csw-domain-loader-with-parser.ts +28 -0
- package/src/wms/csw-domain-loader.ts +53 -0
- package/src/wms/csw-records-loader-with-parser.ts +28 -0
- package/src/wms/csw-records-loader.ts +52 -0
- package/src/wms/csw-source-loader.ts +330 -0
- package/src/wms/feature-pagination.ts +198 -0
- package/src/wms/gml-loader-types.ts +62 -0
- package/src/wms/gml-loader.ts +228 -0
- package/src/wms/index.ts +171 -0
- package/src/wms/lib/deprecated/create-image-service.ts.disabled +57 -0
- package/src/wms/lib/deprecated/create-image-source.ts +75 -0
- package/src/wms/lib/deprecated/image-source-compatibility.ts +28 -0
- package/src/wms/lib/deprecated/template-image-service.ts.disabled +68 -0
- package/src/wms/lib/parsers/csw/parse-csw-capabilities.ts +105 -0
- package/src/wms/lib/parsers/csw/parse-csw-domain.ts +47 -0
- package/src/wms/lib/parsers/csw/parse-csw-records.ts +94 -0
- package/src/wms/lib/parsers/csw/parse-exception-report.ts +33 -0
- package/src/wms/lib/parsers/gml/deep-strict-equal.ts +122 -0
- package/src/wms/lib/parsers/gml/parse-gml.ts +849 -0
- package/src/wms/lib/parsers/gml/rewind-geometry.ts +45 -0
- package/src/wms/lib/parsers/ogc-api/tile-matrix-limits.ts +107 -0
- package/src/wms/lib/parsers/ogc-api/tile-matrix-set.ts +167 -0
- package/src/wms/lib/parsers/wfs/parse-wfs-capabilities.ts +165 -0
- package/src/wms/lib/parsers/wfs/parse-wfs.ts +36 -0
- package/src/wms/lib/parsers/wms/parse-wms-capabilities.ts +427 -0
- package/src/wms/lib/parsers/wms/parse-wms-error.ts +24 -0
- package/src/wms/lib/parsers/wms/parse-wms-features.ts +41 -0
- package/src/wms/lib/parsers/wms/parse-wms-layer-description.ts +24 -0
- package/src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts +281 -0
- package/src/wms/lib/parsers/xml/parse-xml-helpers.ts +67 -0
- package/src/wms/lib/parsers/xml/parse-xml-text.ts +11 -0
- package/src/wms/lib/tile-grid.ts +47 -0
- package/src/wms/managed-vector-source.ts +384 -0
- package/src/wms/ogc-api-coverages-source-loader.ts +109 -0
- package/src/wms/ogc-api-edr-source-loader.ts +127 -0
- package/src/wms/ogc-api-source-loader.ts +742 -0
- package/src/wms/service-capabilities.ts +147 -0
- package/src/wms/service-runtime.ts +225 -0
- package/src/wms/unbundled.ts +24 -0
- package/src/wms/wcs-source-loader.ts +260 -0
- package/src/wms/wfs-capabilities-loader-with-parser.ts +30 -0
- package/src/wms/wfs-capabilities-loader.ts +57 -0
- package/src/wms/wfs-source-loader.ts +987 -0
- package/src/wms/wip/data-source.ts +64 -0
- package/src/wms/wip/lib/wcs/parse-wcs-capabilities.ts +91 -0
- package/src/wms/wip/lib/wmts/parse-wmts-capabilities.ts +171 -0
- package/src/wms/wip/lib/wmts/parse-wmts.ts +39 -0
- package/src/wms/wip/services/wmts-service.ts.disabled +348 -0
- package/src/wms/wip/wcs-capabilities-loader-with-parser.ts +29 -0
- package/src/wms/wip/wcs-capabilities-loader.ts +50 -0
- package/src/wms/wip/wms-feature-info-loader-with-parser.ts +25 -0
- package/src/wms/wip/wms-feature-info-loader.ts +28 -0
- package/src/wms/wip/wms-layer-description-loader-with-parser.ts +25 -0
- package/src/wms/wip/wms-layer-description-loader.md.disabled.md +47 -0
- package/src/wms/wip/wms-layer-description-loader.ts +28 -0
- package/src/wms/wip/wmts-capabilities-loader-with-parser.ts +30 -0
- package/src/wms/wip/wmts-capabilities-loader.ts +52 -0
- package/src/wms/wms-capabilities-loader-with-parser.ts +45 -0
- package/src/wms/wms-capabilities-loader.ts +68 -0
- package/src/wms/wms-error-loader-with-parser.ts +44 -0
- package/src/wms/wms-error-loader.ts +56 -0
- package/src/wms/wms-format.ts +52 -0
- package/src/wms/wms-source-loader.ts +686 -0
- package/src/wms/wmts-capabilities-loader-with-parser.ts +17 -0
- package/src/wms/wmts-capabilities-loader.ts +30 -0
- package/src/wms/wmts-source-loader.ts +649 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
CoreAPI,
|
|
7
|
+
DataSourceOptions,
|
|
8
|
+
GetFeaturesParameters,
|
|
9
|
+
GetTileDataParameters,
|
|
10
|
+
GetTileParameters,
|
|
11
|
+
SourceLoader,
|
|
12
|
+
TileGrid,
|
|
13
|
+
TileSource,
|
|
14
|
+
TileSourceMetadata,
|
|
15
|
+
VectorSource,
|
|
16
|
+
VectorSourceData,
|
|
17
|
+
VectorSourceMetadata
|
|
18
|
+
} from '@loaders.gl/core/loader-utils';
|
|
19
|
+
import {DataSource} from '@loaders.gl/core/loader-utils';
|
|
20
|
+
import type {GeoJSONTable, Schema} from '@loaders.gl/core/schema';
|
|
21
|
+
import {convertFeaturesToWKBArrowTable} from '@loaders.gl/arrow-geometry/feature-collection-to-arrow';
|
|
22
|
+
import {convertGeojsonToBinaryFeatureCollection} from '@loaders.gl/arrow-geometry/legacy-binary';
|
|
23
|
+
import {getServiceCRSAxisOrder} from './crs-utils';
|
|
24
|
+
import type {OGCTileMatrixSet} from './lib/parsers/ogc-api/tile-matrix-set';
|
|
25
|
+
import {convertOGCTileMatrixSetToTileGrid} from './lib/parsers/ogc-api/tile-matrix-set';
|
|
26
|
+
import type {OGCTileMatrixLimits} from './lib/parsers/ogc-api/tile-matrix-limits';
|
|
27
|
+
import {
|
|
28
|
+
convertOGCTileMatrixLimits,
|
|
29
|
+
isOGCTileAvailable
|
|
30
|
+
} from './lib/parsers/ogc-api/tile-matrix-limits';
|
|
31
|
+
import {getTileGridMatrixId, validateMetersPerUnit} from './lib/tile-grid';
|
|
32
|
+
import type {FeaturePaginationOptions, FeaturePage} from './feature-pagination';
|
|
33
|
+
import {
|
|
34
|
+
addNextLinkHeader,
|
|
35
|
+
collectFeaturePages,
|
|
36
|
+
getPaginationOptions,
|
|
37
|
+
iterateFeaturePages
|
|
38
|
+
} from './feature-pagination';
|
|
39
|
+
|
|
40
|
+
/** Options shared by the minimal OGC API source adapters. */
|
|
41
|
+
export type OGCAPISourceOptions = DataSourceOptions & {
|
|
42
|
+
/** Optional collection identifier for an OGC API Features source. */
|
|
43
|
+
'ogc-api'?: {
|
|
44
|
+
/** Collection to query. */
|
|
45
|
+
collectionId?: string;
|
|
46
|
+
/** Explicit tile template for the tiles adapter. */
|
|
47
|
+
tileTemplate?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Tile matrix set for the tiles adapter, as an OGC TileMatrixSet 2.0 document or the URL of
|
|
50
|
+
* one. When set, `getMetadata()` reports it as `tileGrid`. When omitted, the tile matrix set
|
|
51
|
+
* is discovered from the tileset that `tileTemplate` belongs to.
|
|
52
|
+
*/
|
|
53
|
+
tileMatrixSet?: OGCTileMatrixSet | string;
|
|
54
|
+
/** Inclusive availability limits; overrides discovered limits, including an empty list. */
|
|
55
|
+
tileMatrixSetLimits?: OGCTileMatrixLimits[];
|
|
56
|
+
/**
|
|
57
|
+
* Set to `false` to skip discovery. `{tileMatrix}` is then the `tileMatrix` tile parameter,
|
|
58
|
+
* otherwise `z`, which suits services whose matrix identifiers are zoom numbers. Default `true`.
|
|
59
|
+
*/
|
|
60
|
+
discoverTileMatrixSet?: boolean;
|
|
61
|
+
/** Length of one CRS unit in meters, for a tile matrix set given by scale denominators. */
|
|
62
|
+
metersPerUnit?: number | null;
|
|
63
|
+
/** Opt-in bounded pagination for getFeatures(); omitted keeps the single-page behavior. */
|
|
64
|
+
pagination?: FeaturePaginationOptions;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** A small representation of an OGC API link. */
|
|
69
|
+
export type OGCAPILink = {href: string; rel?: string; type?: string; title?: string};
|
|
70
|
+
|
|
71
|
+
/** A minimal OGC API collection description. */
|
|
72
|
+
export type OGCAPICollection = {
|
|
73
|
+
id: string;
|
|
74
|
+
title?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
extent?: {spatial?: {bbox?: number[][]}; temporal?: unknown};
|
|
77
|
+
crs?: string[];
|
|
78
|
+
links?: OGCAPILink[];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* OGC API Tiles tileset metadata used to discover matrix geometry and availability.
|
|
83
|
+
*/
|
|
84
|
+
export type OGCAPITileset = {
|
|
85
|
+
/** Human-readable tileset title. */
|
|
86
|
+
title?: string;
|
|
87
|
+
/** Inclusive coverage; omitted means unrestricted, empty means no available tiles. */
|
|
88
|
+
tileMatrixSetLimits?: OGCTileMatrixLimits[];
|
|
89
|
+
/** Identifier of the tile matrix set in this API's `/tileMatrixSets`. */
|
|
90
|
+
tileMatrixSetId?: string;
|
|
91
|
+
/** Registry URI of the tile matrix set. */
|
|
92
|
+
tileMatrixSetURI?: string;
|
|
93
|
+
/** Includes the `http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme` link. */
|
|
94
|
+
links?: OGCAPILink[];
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** One entry of an OGC API Tiles `/tileMatrixSets` list. */
|
|
99
|
+
export type OGCAPITileMatrixSetSummary = {
|
|
100
|
+
id: string;
|
|
101
|
+
title?: string;
|
|
102
|
+
/** Registry URI of the tile matrix set. */
|
|
103
|
+
uri?: string;
|
|
104
|
+
links?: OGCAPILink[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** The normalized landing page returned by an OGC API service. */
|
|
108
|
+
export type OGCAPILandingPage = {
|
|
109
|
+
title?: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
links?: OGCAPILink[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/** Minimal OGC API Features source. */
|
|
115
|
+
export class OGCAPIFeaturesSource
|
|
116
|
+
extends DataSource<string, OGCAPISourceOptions>
|
|
117
|
+
implements VectorSource
|
|
118
|
+
{
|
|
119
|
+
/** Creates an OGC API Features source. */
|
|
120
|
+
constructor(url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) {
|
|
121
|
+
super(url.replace(/\/$/, ''), options, OGCAPIFeaturesSourceLoader.defaultOptions, coreApi);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Returns the landing page metadata. */
|
|
125
|
+
async getLandingPage(): Promise<OGCAPILandingPage> {
|
|
126
|
+
return (await this.fetchJSON(this.getServiceURL())) as OGCAPILandingPage;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Lists the feature collections advertised by the service. */
|
|
130
|
+
async getCollections(): Promise<OGCAPICollection[]> {
|
|
131
|
+
const response = (await this.fetchJSON(`${this.getServiceURL()}/collections`)) as {
|
|
132
|
+
collections?: OGCAPICollection[];
|
|
133
|
+
};
|
|
134
|
+
return response.collections || [];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Returns normalized metadata for the selected collection. */
|
|
138
|
+
async getMetadata(): Promise<VectorSourceMetadata> {
|
|
139
|
+
const collections = await this.getCollections();
|
|
140
|
+
const collection = this.getCollection(collections);
|
|
141
|
+
return {
|
|
142
|
+
name: collection?.id || this.getCollectionId(),
|
|
143
|
+
title: collection?.title,
|
|
144
|
+
abstract: collection?.description,
|
|
145
|
+
keywords: [],
|
|
146
|
+
layers: collection ? [toVectorLayer(collection)] : []
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Returns a minimal schema; OGC API schema extensions remain optional. */
|
|
151
|
+
async getSchema(): Promise<Schema> {
|
|
152
|
+
return {fields: [], metadata: {}};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Fetches one page, or gathers advertised pages when ogc-api.pagination is configured. */
|
|
156
|
+
async getFeatures(parameters: GetFeaturesParameters): Promise<VectorSourceData> {
|
|
157
|
+
const geoJSONTable = this.options['ogc-api']?.pagination
|
|
158
|
+
? await collectFeaturePages(this.getFeaturesInPages(parameters))
|
|
159
|
+
: (await this.fetchFeaturePage(this.getFeaturesURL(parameters), parameters.signal)).table;
|
|
160
|
+
switch (parameters.format || 'geojson') {
|
|
161
|
+
case 'binary':
|
|
162
|
+
return convertGeojsonToBinaryFeatureCollection(geoJSONTable.features);
|
|
163
|
+
case 'arrow':
|
|
164
|
+
return convertFeaturesToWKBArrowTable(geoJSONTable.features, {
|
|
165
|
+
encodingPreference: parameters.geoarrow?.encodingPreference
|
|
166
|
+
});
|
|
167
|
+
case 'geojson':
|
|
168
|
+
default:
|
|
169
|
+
return geoJSONTable;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Yields GeoJSON pages by following advertised body or HTTP-header next links.
|
|
175
|
+
* Does not invent offset parameters. Page requests are sequential and independently bounded.
|
|
176
|
+
* Unknown totals remain unknown, so managed coverage still requires count evidence.
|
|
177
|
+
*/
|
|
178
|
+
getFeaturesInPages(
|
|
179
|
+
parameters: GetFeaturesParameters,
|
|
180
|
+
options: FeaturePaginationOptions = this.options['ogc-api']?.pagination || {}
|
|
181
|
+
): AsyncIterable<GeoJSONTable> {
|
|
182
|
+
const limits = getPaginationOptions(options);
|
|
183
|
+
const url = new URL(this.getFeaturesURL(parameters));
|
|
184
|
+
url.searchParams.set('limit', String(limits.pageSize));
|
|
185
|
+
return iterateFeaturePages(
|
|
186
|
+
url.toString(),
|
|
187
|
+
pageURL => this.fetchFeaturePage(pageURL, parameters.signal),
|
|
188
|
+
limits,
|
|
189
|
+
parameters.signal,
|
|
190
|
+
(_url, _table, featureCount, matched) => {
|
|
191
|
+
if (matched !== undefined && featureCount < matched)
|
|
192
|
+
throw new Error(
|
|
193
|
+
'OGC API Features pagination ended before numberMatched without a next link'
|
|
194
|
+
);
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Builds a bounded items URL, preserving endpoint query parameters. */
|
|
201
|
+
private getFeaturesURL(parameters: GetFeaturesParameters): string {
|
|
202
|
+
const url = new URL(this.url);
|
|
203
|
+
const collectionId = this.getCollectionId(parameters.layers);
|
|
204
|
+
url.pathname = /\/collections\/[^/]+\/?$/.test(url.pathname)
|
|
205
|
+
? `${url.pathname.replace(/\/$/, '')}/items`
|
|
206
|
+
: `${url.pathname.replace(/\/$/, '')}/collections/${encodeURIComponent(collectionId)}/items`;
|
|
207
|
+
const requestCrs = parameters.requestCrs || parameters.crs;
|
|
208
|
+
url.searchParams.set('bbox', flattenBoundingBox(parameters.boundingBox, requestCrs).join(','));
|
|
209
|
+
if (parameters.crs) url.searchParams.set('crs', parameters.crs);
|
|
210
|
+
if (requestCrs) url.searchParams.set('bbox-crs', requestCrs);
|
|
211
|
+
return url.toString();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Fetches one validated page, retaining body links and HTTP Link-header pagination. */
|
|
215
|
+
private async fetchFeaturePage(url: string, signal?: AbortSignal): Promise<FeaturePage> {
|
|
216
|
+
const response = await this.fetch(url, {
|
|
217
|
+
headers: {Accept: 'application/geo+json, application/json;q=0.9'},
|
|
218
|
+
signal
|
|
219
|
+
});
|
|
220
|
+
if (!response.ok) throw new Error(`OGC API request failed: ${response.status}`);
|
|
221
|
+
const json = await response.json();
|
|
222
|
+
if (!isFeatureCollection(json) || !Array.isArray(json.features))
|
|
223
|
+
throw new Error('OGC API Features response was not a GeoJSON FeatureCollection');
|
|
224
|
+
return {
|
|
225
|
+
table: addNextLinkHeader(
|
|
226
|
+
{shape: 'geojson-table', ...json} as GeoJSONTable,
|
|
227
|
+
response.headers.get('link')
|
|
228
|
+
),
|
|
229
|
+
url: response.url || url
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Fetches and decodes a JSON representation from the service. */
|
|
234
|
+
private async fetchJSON(
|
|
235
|
+
url: string,
|
|
236
|
+
accept = 'application/json',
|
|
237
|
+
signal?: AbortSignal
|
|
238
|
+
): Promise<unknown> {
|
|
239
|
+
const response = await this.fetch(url, {headers: {Accept: accept}, signal});
|
|
240
|
+
if (!response.ok) throw new Error(`OGC API request failed: ${response.status}`);
|
|
241
|
+
return response.json();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Selects the requested collection from a collections response. */
|
|
245
|
+
private getCollection(collections: OGCAPICollection[]): OGCAPICollection | undefined {
|
|
246
|
+
const collectionId = this.getCollectionId();
|
|
247
|
+
return collections.find(collection => collection.id === collectionId) || collections[0];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Returns the configured collection identifier or the first URL collection segment. */
|
|
251
|
+
private getCollectionId(layers?: string | string[]): string {
|
|
252
|
+
const configuredId = this.options['ogc-api']?.collectionId;
|
|
253
|
+
const layerId = Array.isArray(layers) ? layers[0] : layers;
|
|
254
|
+
if (configuredId || layerId) return configuredId || layerId!;
|
|
255
|
+
const match = this.url.match(/\/collections\/([^/]+)/);
|
|
256
|
+
if (match) return decodeURIComponent(match[1]);
|
|
257
|
+
return '';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Returns the service root for both landing-page and collection URLs. */
|
|
261
|
+
private getServiceURL(): string {
|
|
262
|
+
return this.url.replace(/\/collections\/[^/]+$/, '');
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Source loader for minimal OGC API Features support. */
|
|
267
|
+
export const OGCAPIFeaturesSourceLoader = {
|
|
268
|
+
dataType: null as unknown as OGCAPIFeaturesSource,
|
|
269
|
+
batchType: null as never,
|
|
270
|
+
name: 'OGC API Features',
|
|
271
|
+
id: 'ogc-api-features',
|
|
272
|
+
module: 'ogc',
|
|
273
|
+
version: '0.0.0',
|
|
274
|
+
extensions: [],
|
|
275
|
+
mimeTypes: ['application/geo+json'],
|
|
276
|
+
type: 'ogc-api-features',
|
|
277
|
+
fromUrl: true,
|
|
278
|
+
fromBlob: false,
|
|
279
|
+
options: {'ogc-api': {}},
|
|
280
|
+
defaultOptions: {'ogc-api': {}},
|
|
281
|
+
testURL: (url: string): boolean => /\/collections(?:\/|$)|ogc[/-]?api[/-]features/i.test(url),
|
|
282
|
+
createDataSource: (url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) =>
|
|
283
|
+
new OGCAPIFeaturesSource(url, options, coreApi)
|
|
284
|
+
} as const satisfies SourceLoader<OGCAPIFeaturesSource>;
|
|
285
|
+
|
|
286
|
+
/** Minimal OGC API Tiles source that follows a discovered tile template. */
|
|
287
|
+
export class OGCAPITilesSource
|
|
288
|
+
extends DataSource<string, OGCAPISourceOptions>
|
|
289
|
+
implements TileSource
|
|
290
|
+
{
|
|
291
|
+
/** Converted tile matrix set and the options it was loaded or discovered with. */
|
|
292
|
+
private _tileGridCache: {
|
|
293
|
+
/** Configured matrix document or URL used by this request. */
|
|
294
|
+
tileMatrixSet: OGCTileMatrixSet | string | undefined;
|
|
295
|
+
/** Configured coverage override used by this request. */
|
|
296
|
+
tileMatrixSetLimits: OGCTileMatrixLimits[] | undefined;
|
|
297
|
+
/** Unit conversion used by this request. */
|
|
298
|
+
metersPerUnit: number | null | undefined;
|
|
299
|
+
/** Template the matrix set is discovered from; undefined when it is configured or not discovered. */
|
|
300
|
+
tileTemplate: string | undefined;
|
|
301
|
+
/** Shared in-flight or fulfilled matrix request. */
|
|
302
|
+
promise: Promise<TileGrid | undefined>;
|
|
303
|
+
/** The converted grid, once available. */
|
|
304
|
+
tileGrid?: TileGrid;
|
|
305
|
+
} | null = null;
|
|
306
|
+
|
|
307
|
+
/** Creates an OGC API Tiles source. */
|
|
308
|
+
constructor(url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) {
|
|
309
|
+
super(url.replace(/\/$/, ''), options, OGCAPITilesSourceLoader.defaultOptions, coreApi);
|
|
310
|
+
validateMetersPerUnit(options['ogc-api']?.metersPerUnit, 'OGC API Tiles');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** Updates options. A new `tileMatrixSet` document replaces the old one instead of merging. */
|
|
314
|
+
override setProps(options: OGCAPISourceOptions): void {
|
|
315
|
+
super.setProps(options);
|
|
316
|
+
const ogcAPIOptions = options['ogc-api'];
|
|
317
|
+
if (ogcAPIOptions && 'tileMatrixSet' in ogcAPIOptions) {
|
|
318
|
+
this.options['ogc-api'] = {
|
|
319
|
+
...this.options['ogc-api'],
|
|
320
|
+
tileMatrixSet: ogcAPIOptions.tileMatrixSet
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** Returns basic tileset metadata from the service landing page and configured matrix set. */
|
|
326
|
+
async getMetadata(): Promise<TileSourceMetadata> {
|
|
327
|
+
const [landingPage, tileGrid] = await Promise.all([
|
|
328
|
+
this.fetchJSON(this.url) as Promise<OGCAPILandingPage>,
|
|
329
|
+
this.getTileGrid()
|
|
330
|
+
]);
|
|
331
|
+
const tileLink = landingPage.links?.find(link => link.rel?.includes('tileset'));
|
|
332
|
+
return {
|
|
333
|
+
name: landingPage.title || '',
|
|
334
|
+
title: landingPage.title,
|
|
335
|
+
format: tileLink?.type,
|
|
336
|
+
...(tileGrid ? {tileGrid} : {})
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Lists the tile matrix sets the API advertises at `/tileMatrixSets`. */
|
|
341
|
+
async getTileMatrixSets(): Promise<OGCAPITileMatrixSetSummary[]> {
|
|
342
|
+
const response = (await this.fetchJSON(resolveLink('tileMatrixSets', this.url))) as {
|
|
343
|
+
tileMatrixSets?: OGCAPITileMatrixSetSummary[];
|
|
344
|
+
};
|
|
345
|
+
return Array.isArray(response?.tileMatrixSets) ? response.tileMatrixSets : [];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Fetches one tile matrix set from `/tileMatrixSets/{tileMatrixSetId}`. */
|
|
349
|
+
async getTileMatrixSet(tileMatrixSetId: string): Promise<OGCTileMatrixSet> {
|
|
350
|
+
return (await this.fetchJSON(this.getTileMatrixSetIdURL(tileMatrixSetId))) as OGCTileMatrixSet;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** Returns the URL of `/tileMatrixSets/{tileMatrixSetId}`. */
|
|
354
|
+
private getTileMatrixSetIdURL(tileMatrixSetId: string): string {
|
|
355
|
+
return resolveLink(`tileMatrixSets/${encodeURIComponent(tileMatrixSetId)}`, this.url);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Returns the configured or discovered tile matrix set as a tile grid. The result is reused until
|
|
360
|
+
* the options change, and concurrent callers share one request. A failed load or discovery
|
|
361
|
+
* rejects, and is retried on the next call.
|
|
362
|
+
*/
|
|
363
|
+
private getTileGrid(): Promise<TileGrid | undefined> {
|
|
364
|
+
const key = this.getTileGridKey();
|
|
365
|
+
const cache = this._tileGridCache;
|
|
366
|
+
if (cache && isSameTileGridKey(cache, key)) {
|
|
367
|
+
return cache.promise;
|
|
368
|
+
}
|
|
369
|
+
const {tileMatrixSet, tileMatrixSetLimits, metersPerUnit, tileTemplate} = key;
|
|
370
|
+
const promise = tileMatrixSet
|
|
371
|
+
? this.loadTileGrid(tileMatrixSet, metersPerUnit, tileMatrixSetLimits)
|
|
372
|
+
: this.discoverTileGrid(tileTemplate, metersPerUnit, tileMatrixSetLimits).catch(error => {
|
|
373
|
+
throw new Error(
|
|
374
|
+
`OGC API Tiles could not discover the tile matrix set: ${(error as Error)?.message}`,
|
|
375
|
+
{cause: error}
|
|
376
|
+
);
|
|
377
|
+
});
|
|
378
|
+
const newCache: NonNullable<OGCAPITilesSource['_tileGridCache']> = {...key, promise};
|
|
379
|
+
this._tileGridCache = newCache;
|
|
380
|
+
newCache.promise.then(
|
|
381
|
+
tileGrid => {
|
|
382
|
+
newCache.tileGrid = tileGrid;
|
|
383
|
+
},
|
|
384
|
+
() => {
|
|
385
|
+
if (this._tileGridCache === newCache) this._tileGridCache = null;
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
return newCache.promise;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* The options a tile grid depends on. `tileTemplate` is set only when the matrix set is
|
|
393
|
+
* discovered from it: a configured matrix set or `discoverTileMatrixSet: false` disables discovery.
|
|
394
|
+
*/
|
|
395
|
+
private getTileGridKey() {
|
|
396
|
+
const {tileMatrixSet, tileMatrixSetLimits, metersPerUnit, tileTemplate, discoverTileMatrixSet} =
|
|
397
|
+
this.options['ogc-api'] || {};
|
|
398
|
+
const discover = !tileMatrixSet && discoverTileMatrixSet !== false;
|
|
399
|
+
return {
|
|
400
|
+
tileMatrixSet,
|
|
401
|
+
tileMatrixSetLimits,
|
|
402
|
+
metersPerUnit,
|
|
403
|
+
tileTemplate: discover ? tileTemplate : undefined
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** Whether the tile matrix set is configured or discovered, rather than absent. */
|
|
408
|
+
private requiresTileGrid(): boolean {
|
|
409
|
+
const {tileMatrixSet, tileTemplate} = this.getTileGridKey();
|
|
410
|
+
return Boolean(tileMatrixSet || (tileTemplate && getTilesetURL(tileTemplate)));
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Discovers the tile matrix set of the tileset that a `{tileMatrix}` template belongs to. The
|
|
415
|
+
* tileset metadata is the template path before `/{tileMatrix}`, as OGC API Tiles lays out tile
|
|
416
|
+
* resources. Its tiling-scheme link is followed; otherwise `tileMatrixSetId` is looked up in
|
|
417
|
+
* `/tileMatrixSets`, and a `tileMatrixSetURI` is matched against the `/tileMatrixSets` list.
|
|
418
|
+
* Resolves to undefined when the template has no `{tileMatrix}`, and rejects when the tileset
|
|
419
|
+
* or its tile matrix set cannot be loaded.
|
|
420
|
+
*/
|
|
421
|
+
private async discoverTileGrid(
|
|
422
|
+
tileTemplate: string | undefined,
|
|
423
|
+
metersPerUnit: number | null | undefined,
|
|
424
|
+
configuredLimits: OGCTileMatrixLimits[] | undefined
|
|
425
|
+
): Promise<TileGrid | undefined> {
|
|
426
|
+
// Find the tileset path before resolving, since URL parsing may percent-encode the braces.
|
|
427
|
+
const tilesetPath = tileTemplate && getTilesetURL(tileTemplate);
|
|
428
|
+
if (!tilesetPath) return applyTileMatrixLimits(undefined, configuredLimits);
|
|
429
|
+
const tilesetUrl = resolveLink(tilesetPath, this.url);
|
|
430
|
+
const tileset = (await this.fetchJSON(tilesetUrl)) as OGCAPITileset;
|
|
431
|
+
const tileMatrixSetUrl = await this.getTileMatrixSetURL(tileset, tilesetUrl);
|
|
432
|
+
const document = (await this.fetchJSON(tileMatrixSetUrl)) as OGCTileMatrixSet;
|
|
433
|
+
return applyTileMatrixLimits(
|
|
434
|
+
convertOGCTileMatrixSetToTileGrid(document, {metersPerUnit}),
|
|
435
|
+
configuredLimits === undefined ? tileset.tileMatrixSetLimits : configuredLimits
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/** Returns the URL of the tile matrix set a tileset uses. */
|
|
440
|
+
private async getTileMatrixSetURL(tileset: OGCAPITileset, tilesetUrl: string): Promise<string> {
|
|
441
|
+
const link = findJSONLink(tileset?.links, isTilingSchemeRel);
|
|
442
|
+
if (link) return resolveDocumentLink(link.href, tilesetUrl);
|
|
443
|
+
if (typeof tileset?.tileMatrixSetId === 'string' && tileset.tileMatrixSetId) {
|
|
444
|
+
return this.getTileMatrixSetIdURL(tileset.tileMatrixSetId);
|
|
445
|
+
}
|
|
446
|
+
if (typeof tileset?.tileMatrixSetURI === 'string' && tileset.tileMatrixSetURI) {
|
|
447
|
+
const listUrl = resolveLink('tileMatrixSets', this.url);
|
|
448
|
+
const summary = (await this.getTileMatrixSets()).find(
|
|
449
|
+
candidate => candidate.uri === tileset.tileMatrixSetURI
|
|
450
|
+
);
|
|
451
|
+
const selfLink = findJSONLink(summary?.links, rel => rel === 'self');
|
|
452
|
+
if (selfLink) return resolveDocumentLink(selfLink.href, listUrl);
|
|
453
|
+
if (summary?.id) return this.getTileMatrixSetIdURL(summary.id);
|
|
454
|
+
throw new Error(`${tileset.tileMatrixSetURI} is not listed in ${listUrl}`);
|
|
455
|
+
}
|
|
456
|
+
throw new Error(`${tilesetUrl} names no tile matrix set`);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Returns the tile grid if it is available without waiting: an inline document is converted
|
|
461
|
+
* immediately, while a document given as a URL or discovered is available once loaded.
|
|
462
|
+
*/
|
|
463
|
+
private getLoadedTileGrid(): TileGrid | undefined {
|
|
464
|
+
const tileMatrixSet = this.options['ogc-api']?.tileMatrixSet;
|
|
465
|
+
const cache = this._tileGridCache;
|
|
466
|
+
if (cache?.tileGrid && isSameTileGridKey(cache, this.getTileGridKey())) return cache.tileGrid;
|
|
467
|
+
if (tileMatrixSet && typeof tileMatrixSet !== 'string') {
|
|
468
|
+
return applyTileMatrixLimits(
|
|
469
|
+
convertOGCTileMatrixSetToTileGrid(tileMatrixSet, {
|
|
470
|
+
metersPerUnit: this.options['ogc-api']?.metersPerUnit
|
|
471
|
+
}),
|
|
472
|
+
this.options['ogc-api']?.tileMatrixSetLimits
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
return this.requiresTileGrid()
|
|
476
|
+
? undefined
|
|
477
|
+
: applyTileMatrixLimits(undefined, this.options['ogc-api']?.tileMatrixSetLimits);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** Converts a tile matrix set, fetching it first when given as a URL. */
|
|
481
|
+
private async loadTileGrid(
|
|
482
|
+
tileMatrixSet: OGCTileMatrixSet | string | undefined,
|
|
483
|
+
metersPerUnit: number | null | undefined,
|
|
484
|
+
limits: OGCTileMatrixLimits[] | undefined
|
|
485
|
+
): Promise<TileGrid | undefined> {
|
|
486
|
+
if (!tileMatrixSet) return undefined;
|
|
487
|
+
const document =
|
|
488
|
+
typeof tileMatrixSet === 'string'
|
|
489
|
+
? ((await this.fetchJSON(resolveLink(tileMatrixSet, this.url))) as OGCTileMatrixSet)
|
|
490
|
+
: tileMatrixSet;
|
|
491
|
+
return applyTileMatrixLimits(
|
|
492
|
+
convertOGCTileMatrixSetToTileGrid(document, {metersPerUnit}),
|
|
493
|
+
limits
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** Fetches raw bytes for one tile from an advertised template. */
|
|
498
|
+
async getTile(parameters: GetTileParameters): Promise<ArrayBuffer | null> {
|
|
499
|
+
if (parameters.signal?.aborted)
|
|
500
|
+
throw new DOMException('The operation was aborted', 'AbortError');
|
|
501
|
+
// The matrix identifier in the URL comes from the configured or discovered tile matrix set.
|
|
502
|
+
const tileGrid = await this.getTileGrid();
|
|
503
|
+
if (!isOGCTileAvailable(parameters, tileGrid)) return null;
|
|
504
|
+
const url = this.getTileURL(parameters);
|
|
505
|
+
const response = await this.fetch(url, {
|
|
506
|
+
headers: {Accept: 'application/octet-stream'},
|
|
507
|
+
signal: parameters.signal
|
|
508
|
+
});
|
|
509
|
+
if (!response.ok) throw new Error(`OGC API Tiles request failed: ${response.status}`);
|
|
510
|
+
return response.arrayBuffer();
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** Fetches a tile using the deck.gl-compatible request shape. */
|
|
514
|
+
async getTileData(parameters: GetTileDataParameters): Promise<ArrayBuffer | null> {
|
|
515
|
+
return this.getTile({
|
|
516
|
+
...parameters.index,
|
|
517
|
+
tileMatrix: parameters.tileMatrix,
|
|
518
|
+
signal: parameters.signal
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** Checks advertised coverage; load remote metadata with getMetadata() first. */
|
|
523
|
+
isTileAvailable(parameters: GetTileParameters): boolean {
|
|
524
|
+
const tileGrid = this.getLoadedTileGrid();
|
|
525
|
+
if (!tileGrid && this.requiresTileGrid()) {
|
|
526
|
+
throw new Error(
|
|
527
|
+
'OGC API Tiles has not loaded its tile matrix set; await getMetadata() before isTileAvailable()'
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
return isOGCTileAvailable(parameters, tileGrid);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Expands a `{tileMatrix}`, `{tileRow}`, and `{tileCol}` template. `{tileMatrix}` is
|
|
535
|
+
* `parameters.tileMatrix` when given, otherwise the identifier of the matrix whose id equals
|
|
536
|
+
* `z`, otherwise the matrix at index `z`. With a tile matrix set, a matrix it does not contain
|
|
537
|
+
* throws a `RangeError`. A matrix set given by URL or discovered must be loaded first, by
|
|
538
|
+
* `getMetadata()` or `getTile()`; until then this throws rather than using `z`. Only without a
|
|
539
|
+
* matrix set (no `{tileMatrix}` to discover, or `discoverTileMatrixSet: false`) is
|
|
540
|
+
* `{tileMatrix}` the explicit identifier or `z`. `{z}` is always the number.
|
|
541
|
+
*/
|
|
542
|
+
getTileURL(parameters: GetTileParameters): string {
|
|
543
|
+
const template = this.options['ogc-api']?.tileTemplate;
|
|
544
|
+
if (!template) throw new Error('OGC API Tiles requires ogc-api.tileTemplate');
|
|
545
|
+
const loadedGrid = this.getLoadedTileGrid();
|
|
546
|
+
if (!isOGCTileAvailable(parameters, loadedGrid)) {
|
|
547
|
+
throw new RangeError('OGC tile is outside advertised coverage');
|
|
548
|
+
}
|
|
549
|
+
// XYZ placeholders keep numeric z; only OGC placeholders substitute a matrix identifier.
|
|
550
|
+
let tileMatrixId = '';
|
|
551
|
+
if (template.includes('{tileMatrix}')) {
|
|
552
|
+
const tileGrid = this.getLoadedTileGrid();
|
|
553
|
+
if (!tileGrid && parameters.tileMatrix === undefined && this.requiresTileGrid()) {
|
|
554
|
+
throw new Error(
|
|
555
|
+
'OGC API Tiles has not loaded its tile matrix set; await getMetadata() before getTileURL()'
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
tileMatrixId = getTileGridMatrixId(tileGrid, parameters);
|
|
559
|
+
}
|
|
560
|
+
const tileUrl = template
|
|
561
|
+
.replaceAll('{tileMatrix}', encodeURIComponent(tileMatrixId))
|
|
562
|
+
.replaceAll('{tileRow}', String(parameters.y))
|
|
563
|
+
.replaceAll('{tileCol}', String(parameters.x))
|
|
564
|
+
.replaceAll('{z}', String(parameters.z))
|
|
565
|
+
.replaceAll('{y}', String(parameters.y))
|
|
566
|
+
.replaceAll('{x}', String(parameters.x));
|
|
567
|
+
return resolveLink(tileUrl, this.url);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
private async fetchJSON(url: string): Promise<unknown> {
|
|
571
|
+
const response = await this.fetch(url, {headers: {Accept: 'application/json'}});
|
|
572
|
+
if (!response.ok) throw new Error(`OGC API request failed: ${response.status}`);
|
|
573
|
+
return response.json();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** Source loader for minimal OGC API Tiles support. */
|
|
578
|
+
export const OGCAPITilesSourceLoader = {
|
|
579
|
+
dataType: null as unknown as OGCAPITilesSource,
|
|
580
|
+
batchType: null as never,
|
|
581
|
+
name: 'OGC API Tiles',
|
|
582
|
+
id: 'ogc-api-tiles',
|
|
583
|
+
module: 'ogc',
|
|
584
|
+
version: '0.0.0',
|
|
585
|
+
extensions: [],
|
|
586
|
+
mimeTypes: [],
|
|
587
|
+
type: 'ogc-api-tiles',
|
|
588
|
+
fromUrl: true,
|
|
589
|
+
fromBlob: false,
|
|
590
|
+
options: {},
|
|
591
|
+
defaultOptions: {},
|
|
592
|
+
testURL: (url: string): boolean => /\/tiles(?:\/|$)|ogc[/-]?api[/-]tiles/i.test(url),
|
|
593
|
+
createDataSource: (url: string, options: OGCAPISourceOptions = {}, coreApi?: CoreAPI) =>
|
|
594
|
+
new OGCAPITilesSource(url, options, coreApi)
|
|
595
|
+
} as const satisfies SourceLoader<OGCAPITilesSource>;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Resolves a link against a landing page treated as a directory, so `tileMatrixSets/x` under
|
|
599
|
+
* `https://host/api` becomes `https://host/api/tileMatrixSets/x`. Absolute links are returned
|
|
600
|
+
* unchanged, and a relative landing page stays relative.
|
|
601
|
+
*/
|
|
602
|
+
function resolveLink(link: string, landingPageUrl: string): string {
|
|
603
|
+
return resolveDocumentLink(link, landingPageUrl, true);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Resolves a link found in a document against the document URL, as browsers do. With
|
|
608
|
+
* `asDirectory`, the URL is treated as a directory. A relative document URL stays relative.
|
|
609
|
+
*/
|
|
610
|
+
function resolveDocumentLink(link: string, documentUrl: string, asDirectory = false): string {
|
|
611
|
+
if (/^[a-z][a-z\d+.-]*:/i.test(link)) return link;
|
|
612
|
+
const placeholderOrigin = 'http://placeholder.invalid';
|
|
613
|
+
const isAbsolute = /^[a-z][a-z\d+.-]*:/i.test(documentUrl);
|
|
614
|
+
const isPathRelative = !isAbsolute && !documentUrl.startsWith('/');
|
|
615
|
+
// Anchor relative paths deeply enough that URL normalization preserves every leading ../.
|
|
616
|
+
// The marker cannot occur in either input, so it cannot be mistaken for a real path segment.
|
|
617
|
+
let anchorSegment = '__loaders_relative_base__';
|
|
618
|
+
while (documentUrl.includes(anchorSegment) || link.includes(anchorSegment)) anchorSegment += '_';
|
|
619
|
+
const anchorDepth = documentUrl.split('/').length + link.split('/').length + 1;
|
|
620
|
+
const anchorPath = isPathRelative ? `/${`${anchorSegment}/`.repeat(anchorDepth)}` : '/';
|
|
621
|
+
const base = new URL(documentUrl, `${placeholderOrigin}${anchorPath}`);
|
|
622
|
+
if (asDirectory && !base.pathname.endsWith('/')) base.pathname += '/';
|
|
623
|
+
const resolved = new URL(link, base);
|
|
624
|
+
if (isAbsolute) return resolved.href;
|
|
625
|
+
if (
|
|
626
|
+
resolved.origin !== placeholderOrigin ||
|
|
627
|
+
documentUrl.startsWith('//') ||
|
|
628
|
+
link.startsWith('//')
|
|
629
|
+
) {
|
|
630
|
+
return `//${resolved.host}${resolved.pathname}${resolved.search}${resolved.hash}`;
|
|
631
|
+
}
|
|
632
|
+
if (isPathRelative && !link.startsWith('/')) {
|
|
633
|
+
const segments = resolved.pathname.slice(1).split('/');
|
|
634
|
+
let preservedDepth = 0;
|
|
635
|
+
while (segments[preservedDepth] === anchorSegment) preservedDepth++;
|
|
636
|
+
const relativePath =
|
|
637
|
+
'../'.repeat(anchorDepth - preservedDepth) + segments.slice(preservedDepth).join('/');
|
|
638
|
+
// ./ also protects a leading colon or slash from being interpreted as a scheme or root.
|
|
639
|
+
const pathname = relativePath.startsWith('../') ? relativePath : `./${relativePath}`;
|
|
640
|
+
return `${pathname}${resolved.search}${resolved.hash}`;
|
|
641
|
+
}
|
|
642
|
+
return `${resolved.pathname}${resolved.search}${resolved.hash}`;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Returns the tileset metadata URL for an OGC tile template: the path before `/{tileMatrix}`,
|
|
647
|
+
* keeping query parameters other than the `f` format selector. Undefined for other templates.
|
|
648
|
+
*/
|
|
649
|
+
function getTilesetURL(tileTemplate: string): string | undefined {
|
|
650
|
+
const index = tileTemplate.indexOf('/{tileMatrix}');
|
|
651
|
+
if (index < 0) return undefined;
|
|
652
|
+
const queryIndex = tileTemplate.indexOf('?', index);
|
|
653
|
+
const query = new URLSearchParams(queryIndex < 0 ? '' : tileTemplate.slice(queryIndex + 1));
|
|
654
|
+
query.delete('f');
|
|
655
|
+
const queryString = query.toString();
|
|
656
|
+
return tileTemplate.slice(0, index) + (queryString ? `?${queryString}` : '');
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** The current and legacy link relations from a tileset to its tile matrix set. */
|
|
660
|
+
function isTilingSchemeRel(rel: string): boolean {
|
|
661
|
+
return rel === 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme' || rel === 'tiling-scheme';
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/** Returns the matching link with a JSON media type, otherwise the first one without a type. */
|
|
665
|
+
function findJSONLink(
|
|
666
|
+
links: OGCAPILink[] | undefined,
|
|
667
|
+
matchesRel: (rel: string) => boolean
|
|
668
|
+
): OGCAPILink | undefined {
|
|
669
|
+
const candidates = (Array.isArray(links) ? links : []).filter(
|
|
670
|
+
link => typeof link?.href === 'string' && typeof link.rel === 'string' && matchesRel(link.rel)
|
|
671
|
+
);
|
|
672
|
+
return (
|
|
673
|
+
candidates.find(link => /^application\/([\w.-]+\+)?json\b/i.test(link.type || '')) ||
|
|
674
|
+
candidates.find(link => !link.type)
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/** Tests whether a cached tile grid was loaded with these options. */
|
|
679
|
+
function isSameTileGridKey(
|
|
680
|
+
cachedKey: {
|
|
681
|
+
tileMatrixSet: unknown;
|
|
682
|
+
tileMatrixSetLimits: unknown;
|
|
683
|
+
metersPerUnit: unknown;
|
|
684
|
+
tileTemplate: unknown;
|
|
685
|
+
},
|
|
686
|
+
requestedKey: {
|
|
687
|
+
tileMatrixSet: unknown;
|
|
688
|
+
tileMatrixSetLimits: unknown;
|
|
689
|
+
metersPerUnit: unknown;
|
|
690
|
+
tileTemplate: unknown;
|
|
691
|
+
}
|
|
692
|
+
): boolean {
|
|
693
|
+
return (
|
|
694
|
+
cachedKey.tileMatrixSet === requestedKey.tileMatrixSet &&
|
|
695
|
+
cachedKey.tileMatrixSetLimits === requestedKey.tileMatrixSetLimits &&
|
|
696
|
+
cachedKey.metersPerUnit === requestedKey.metersPerUnit &&
|
|
697
|
+
cachedKey.tileTemplate === requestedKey.tileTemplate
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/** Converts the loaders.gl nested bounding box into the OGC comma-separated form. */
|
|
702
|
+
function flattenBoundingBox(
|
|
703
|
+
boundingBox: GetFeaturesParameters['boundingBox'],
|
|
704
|
+
requestCrs?: GetFeaturesParameters['requestCrs']
|
|
705
|
+
): number[] {
|
|
706
|
+
const values = [boundingBox[0][0], boundingBox[0][1], boundingBox[1][0], boundingBox[1][1]];
|
|
707
|
+
if (getServiceCRSAxisOrder(requestCrs) === 'yx') {
|
|
708
|
+
return [values[1], values[0], values[3], values[2]];
|
|
709
|
+
}
|
|
710
|
+
return values;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/** Checks that a decoded response has the required GeoJSON feature-collection marker. */
|
|
714
|
+
function isFeatureCollection(value: unknown): value is Pick<GeoJSONTable, 'type' | 'features'> {
|
|
715
|
+
return Boolean(value && typeof value === 'object' && (value as any).type === 'FeatureCollection');
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/** Converts an OGC collection extent into the normalized source-layer shape. */
|
|
719
|
+
function toVectorLayer(collection: OGCAPICollection) {
|
|
720
|
+
const bbox = collection.extent?.spatial?.bbox?.[0];
|
|
721
|
+
return {
|
|
722
|
+
name: collection.id,
|
|
723
|
+
title: collection.title,
|
|
724
|
+
crs: collection.crs,
|
|
725
|
+
boundingBox: bbox
|
|
726
|
+
? ([
|
|
727
|
+
[bbox[0], bbox[1]],
|
|
728
|
+
[bbox[2], bbox[3]]
|
|
729
|
+
] as [[number, number], [number, number]])
|
|
730
|
+
: undefined,
|
|
731
|
+
layers: []
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/** Attaches normalized coverage without requiring complete matrix geometry. */
|
|
736
|
+
function applyTileMatrixLimits(
|
|
737
|
+
grid: TileGrid | undefined,
|
|
738
|
+
limits: OGCTileMatrixLimits[] | undefined
|
|
739
|
+
): TileGrid | undefined {
|
|
740
|
+
if (limits === undefined) return grid;
|
|
741
|
+
return {...grid, limits: convertOGCTileMatrixLimits(limits, grid || {})};
|
|
742
|
+
}
|