feat(extract): Koordinaten, Kachel-Download und Mosaik

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Sonnet 5 committed 2026-09-12 13:50:20 +02:00
1 parent 2280617d9e
commit 3d112e98cd
7 files changed
+596

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
from leonida.coords import SLICE, pixel_to_world, slice_tiles, tile_for_world
def test_tile_of_vice_beach():
assert tile_for_world(1409.4, 2803.2) == (53, 69)
def test_slice_covers_expected_grid():
tiles = slice_tiles()
assert len(tiles) == 144
assert min(c for _, c in tiles) == 60 and max(c for _, c in tiles) == 71
assert min(r for r, _ in tiles) == 54 and max(r for r, _ in tiles) == 65
def test_pixel_origin_is_slice_corner():
# Pixel (0,0) des beschnittenen Mosaiks ist die Nordwest-Ecke des Ausschnitts.
assert pixel_to_world(0, 0) == (SLICE["x0"], SLICE["y1"])
assert pixel_to_world(2999, 2999) == (SLICE["x0"] + 2999, SLICE["y1"] - 2999)
+14
View File
@@ -0,0 +1,14 @@
import numpy as np
from leonida.tiles import assemble
def fake_tile(row: int, col: int) -> np.ndarray:
# Jede Kachel einfarbig, Farbe kodiert Zeile und Spalte.
return np.full((256, 256, 3), (row, col, 7), dtype=np.uint8)
def test_assemble_crops_to_slice():
mosaic = assemble(fake_tile)
assert mosaic.shape == (3000, 3000, 3)
# Nordwest-Ecke stammt aus Kachel (54, 60)
assert tuple(mosaic[0, 0]) == (54, 60, 7)
# Südost-Ecke stammt aus Kachel (65, 71)
assert tuple(mosaic[-1, -1]) == (65, 71, 7)