Repository navigation
Conversation
The WMTSSource ol-proxy definition now maps layer, style and requestEncoding and builds its tile grid from a plain JSON description. New helpers in @mapsight/ui turn WMS and WMTS capabilities documents into plain data and ready-to-use layer definitions.
WMTSSource copies the dimensions it is given, recreates the source when a dimension changes or is removed, and validates the tile grid description before creating the source, so frozen config is never mutated and no source without a working tile grid reaches the map. The capabilities helpers skip WMTS layers with malformed tile matrix data, compare identifiers case-sensitively (CRS codes excepted), resolve WMS queryable per layer element and report it only when known, and remove the parameters the WMS source generates from the advertised GetMap URL.
🦋 Changeset detectedLatest commit: 4b5bb5a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WMTSSourcedefinition (@mapsight/core)A WMTS layer could not be configured from JSON: the ol-proxy definition did not map
layer,styleandrequestEncoding, and passedtileGridthrough as raw JSON, so the OpenLayers constructor threw or the source ignored layer, style and REST encoding.ol/tilegrid/WMTSfrom a plain JSON description (origin/origins,resolutions,matrixIds,tileSize/tileSizes, optionallyextent,sizes,tileRanges). Tile grid instances are still accepted.validateWMTSTileGridDescriptionandcreateWMTSTileGridare exported). An invalid or missing tile grid logs one error and no source is created, instead of failing later during rendering.tileRangestake precedence overextent.dimensionsis copied instead of being handed to OpenLayers, so frozen config is never mutated. Changing, adding or removing a dimension creates a new source, because OpenLayers can merge dimensions but never remove one.Capabilities helpers (
@mapsight/ui)wmsCapabilitiesToLayers(@mapsight/ui/config/ogc/wms) andwmtsCapabilitiesToLayers(@mapsight/ui/config/ogc/wmts). They take a capabilities XML string or its parsed form and return plain data per layer plus a ready-to-use layer definition (TileLayerwithTileWMSSourceorWMTSSource). They make no requests; fetching and cross-origin handling stay with the host application. Parsing needs a DOM (DOMParser).metaData(attribution, legends) or other fields that may be rendered as HTML.queryableis resolved per layer element and omitted when unknown. Parameters the source generates itself are removed from the advertised GetMap URL; vendor and authentication parameters are kept.Docs: new "WMTS" and "From capabilities to layer config" sections in
docs/integration/OGC_LAYERS.md.Test plan
pnpm --filter @mapsight/core test(356 tests) andpnpm --filter @mapsight/ui test(621 tests);typecheckandlintfor both (no errors);pnpm run checkWMTSSourcethrough the ol-proxy machinery: tile URLs for KVP and REST, origin handling, tile ranges, instance pass-through; the original tests fail against the previous definitionqueryablefor same-named layers, malformed numeric fields, finalTileWMStile URLs for both WMS versions, and a round trip from helper output through ol-proxy to a workingol/source/WMTS