Borner le comblement du MNT à l'enveloppe des points, ajouter la couche précision et un affichage relief/précision, encoder les sous-tuiles une seule fois en q75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Antoine Jacquin
2026-09-27 15:07:04 +02:00
parent c5097e21a0
commit 90dbe61f3b
17 changed files with 994 additions and 593 deletions

View File

@ -687,3 +687,28 @@ def test_existing_cache_without_registry_is_refreshed_once(tmp_path):
tiles._seen_cache.clear()
tiles.source_index(tmp_path, force=True)
assert tiles.cached_tile(tmp_path, "slope", z, x, y)[1] == "fresh"
def test_webp_subtiles_indexed_and_rendered_nearest(tmp_path):
"""Couche densité : quadrants .webp sans perte reconnus comme palier fin,
et rendus au plus proche voisin (16 gris exacts même agrandis)."""
from PIL import Image
from lidar_pipeline import tiles
base = _make_dalle(tmp_path, 1054, 6882, ["densite_sol"])
sub = tmp_path / "index_subtiles"
sub.mkdir(parents=True, exist_ok=True)
for i in range(2):
for j in range(2):
im = Image.new("L", (8, 8), 0)
im.paste(255, (0, 0, 4, 8)) # moitié blanche, moitié noire
im.save(str(sub / f"{base}_densite_sol_{i}_{j}.webp"), format="WEBP", lossless=True)
tiers = tiles.source_index(tmp_path, force=True)["densite_sol"][(1054, 6882)]
quads = next(t for t in tiers if len(t) == 4)
assert all(q.path.suffix == ".webp" for q in quads)
assert "densite_sol" in tiles.NEAREST_LAYERS
# z17 : résolution visée (~0,8 m) atteinte par les quadrants (0,5 m ici)
x, y = _tile_of_cell(1054, 6882, 17)
img = tiles.render_tile(tmp_path, "densite_sol", 17, x, y)
assert img is not None
grays = {p[0] for p in img.getdata() if p[3] == 255}
assert grays <= {0, 255} # aucun gris intermédiaire inventé