Skip to content

Silence spurious NotGeoreferencedWarning when rendering overlay tiles - #9

Merged
vudongpham merged 1 commit into
mainfrom
claude/magical-archimedes-27hvz5
Nov 6, 2026
Merged

vudongpham merged 1 commit into
mainfrom
claude/magical-archimedes-27hvz5

Conversation

@vudongpham

Copy link
Copy Markdown
Owner

Summary

When scene overlay tiles render, the terminal sometimes shows this warning:

rasterio/warp.py:387: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.

Cause: rasterio.warp.reproject() wraps the numpy arrays in a temporary in-memory dataset, which has no transform until rasterio sets it a moment later. Rasterio silences this warning while it does so, using warnings.catch_warnings(). That function is not thread safe. When the browser requests several map tiles at once, one thread can restore the warning filters while another is still inside, so the warning leaks out.

Fix: the rendered tiles are correct, so forcelive/overlay.py now ignores NotGeoreferencedWarning coming from rasterio.

Testing

  • Reproduced with the Docker image's versions (Python 3.10, rasterio 1.4.4, GDAL 3.10.3): 1–2 warnings per run of 1000 parallel tile renders without the fix, 0 in three runs with it.
  • Parallel and serial renders of the same tiles give identical PNGs.
  • python -m pytest -q: 27 passed.

Generated by Claude Code

rasterio.warp.reproject() silences this warning while it wraps the numpy
arrays in a temporary in-memory dataset, using warnings.catch_warnings(),
which is not thread safe. With several map tiles rendered at the same
time, one thread can restore the filters while another is still inside,
and "Dataset has no geotransform" is printed. The tiles are correct
(parallel and serial renders are identical), so ignore the warning for
rasterio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUYE7j4AsWg97tWfRBT7mu
@vudongpham
vudongpham merged commit 201c905 into main Nov 6, 2026
2 checks passed
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