Skip to content

fix(CogSource): add zoom property and check in extentInsideLimit#2727

Open
ymoisan wants to merge 1 commit into
iTowns:masterfrom
ymoisan:fix/cogsource-elevation-support
Open

fix(CogSource): add zoom property and check in extentInsideLimit#2727
ymoisan wants to merge 1 commit into
iTowns:masterfrom
ymoisan:fix/cogsource-elevation-support

Conversation

@ymoisan
Copy link
Copy Markdown

@ymoisan ymoisan commented Mar 25, 2026

Again all AI generated (below this sentence), but this is a simple and quite focused fix that allows using CogSource for elevation.

CogSource was missing the zoom property that all other Source subclasses set (TMSSource, WMTSSource, WMSSource, FileSource, WFSSource). This caused a crash in TiledGeometryLayer.preUpdate when CogSource was used as an ElevationLayer source, because the tile system reads source.zoom.max to determine maximum subdivision depth.

Additionally, extentInsideLimit was not checking the zoom parameter, causing the source to claim data availability at all zoom levels regardless of configuration.

Changes:

  • Add zoom to CogSourceConfig type (default: { min: 0, max: Infinity })
  • Add zoom class property and initialize from config in constructor
  • Update extentInsideLimit to check zoom bounds, matching the contract used by other Source subclasses

Before contributing

Read CONTRIBUTING.md and CODING.md to apply iTowns conventions on PRs, Git history and code.

Description

Motivation and Context

Screenshots (if appropriate)

CogSource was missing the `zoom` property that all other Source
subclasses set (TMSSource, WMTSSource, WMSSource, FileSource,
WFSSource). This caused a crash in TiledGeometryLayer.preUpdate
when CogSource was used as an ElevationLayer source, because the
tile system reads `source.zoom.max` to determine maximum subdivision
depth.

Additionally, `extentInsideLimit` was not checking the zoom parameter,
causing the source to claim data availability at all zoom levels
regardless of configuration.

Changes:
- Add `zoom` to CogSourceConfig type (default: { min: 0, max: Infinity })
- Add `zoom` class property and initialize from config in constructor
- Update `extentInsideLimit` to check zoom bounds, matching the
  contract used by other Source subclasses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jailln
Copy link
Copy Markdown
Contributor

jailln commented Mar 26, 2026

Thanks for the fix ! :)

There is a ts error to fix though before we can merge: https://github.com/iTowns/itowns/actions/runs/23560566574/job/68677322715?pr=2727#step:7:26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants