Skip to content

Fix tile rendering#1234

Open
clarasb wants to merge 5 commits into
mainfrom
clarasb/xxx-tile_shift_followup
Open

Fix tile rendering#1234
clarasb wants to merge 5 commits into
mainfrom
clarasb/xxx-tile_shift_followup

Conversation

@clarasb

@clarasb clarasb commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

This PR is a follow-up to #1216.

#1216 improved the tile indexing step by using nearest-pixel rounding when mapping tile pixels to dataset pixels. This fixed the actual tile shift, because target pixels are now sampled from the nearest source pixel instead of being consistently biased toward one side.

However, the source subset used for rendering was still computed too tightly. The subset bbox describes the transformed positions of the target tile pixel centers, but nearest-pixel rounding may select a source pixel whose center lies just outside that bbox.

source pixel centers:
      x        x        x        x
      |--------|--------|--------|

transformed target bbox:
           |----------------|
           ^                ^
   nearest source pixel     
   may lie outside bbox     

If such an edge source pixel was not included in the loaded subset, it was treated as invalid and rendered as missing or transparent data. This PR fixes this behaviour by enlarging the source subset now using the dataset’s own pixel size, including the half-pixel margin required by nearest-pixel rounding.

Example: xcube serve -vvv -c examples/serve/panels-demo/config.yaml

image

Checklist:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/source/*
  • Changes documented in CHANGES.md
  • GitHub CI passes
  • Test coverage remains or increases (target 100%)

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.60%. Comparing base (2a384fc) to head (036ba4d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1234      +/-   ##
==========================================
- Coverage   89.61%   89.60%   -0.01%     
==========================================
  Files         280      280              
  Lines       21694    21700       +6     
==========================================
+ Hits        19440    19444       +4     
- Misses       2254     2256       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@clarasb
clarasb requested review from TonioF and forman July 16, 2026 14:45
@clarasb
clarasb marked this pull request as ready for review July 16, 2026 14:47

@TonioF TonioF left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment, otherwise it looks good to me.

Comment thread CHANGES.md
### Fixes
* Improved raster tile alignment by using nearest-pixel rounding during tile reprojection,
reducing visual offsets between rendered map tiles and dataset coordinates. (#1216)
reducing visual offsets between rendered map tiles and dataset coordinates. (#1216, #1234)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reducing visual offsets between rendered map tiles and dataset coordinates. (#1216, #1234)
Reducing visual offsets between rendered map tiles and dataset coordinates. (#1216, #1234)

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