-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): load the min/max zoom levels of a cotar overview from t…
…he wmtscapabilties (#2621) * feat(config): load the min/max zoom levels of a cotar overview from the wmtscapabilties * refactor: fixup lint
- Loading branch information
Showing
6 changed files
with
61 additions
and
46 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/cli/src/cli/overview/__test__/wmts.overview.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import o from 'ospec'; | ||
import { zoomLevelsFromWmts } from '@basemaps/config'; | ||
import { GoogleTms, Nztm2000QuadTms } from '@basemaps/geo'; | ||
import { createOverviewWmtsCapabilities } from '../overview.wmts.js'; | ||
|
||
// This test should really live in @basemaps/config, but all the WMTS generation logic does not live in @basemaps/config | ||
o.spec('zoomLevelsFromWmts', () => { | ||
o('should extract zoom levels', () => { | ||
const wmts = createOverviewWmtsCapabilities(Nztm2000QuadTms, 10, 'Test Title'); | ||
o(zoomLevelsFromWmts(wmts, Nztm2000QuadTms)).deepEquals({ minZoom: 0, maxZoom: 10 }); | ||
}); | ||
|
||
o('should include all zoom levels', () => { | ||
const wmts = createOverviewWmtsCapabilities(GoogleTms, GoogleTms.maxZoom, 'Test Title'); | ||
o(zoomLevelsFromWmts(wmts, GoogleTms)).deepEquals({ minZoom: 0, maxZoom: GoogleTms.maxZoom }); | ||
}); | ||
o('should not extract zoom levels for wrong projection', () => { | ||
const wmts = createOverviewWmtsCapabilities(GoogleTms, 10, 'Test Title'); | ||
o(zoomLevelsFromWmts(wmts, Nztm2000QuadTms)).equals(null); | ||
}); | ||
|
||
o('should not return if zooms are invalid', () => { | ||
const wmts = createOverviewWmtsCapabilities(Nztm2000QuadTms, 0, 'Test Title'); | ||
o(zoomLevelsFromWmts(wmts, Nztm2000QuadTms)).equals(null); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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