feat(extract): Chunk-Zuordnung in Python und Beschriftungsliste lesen

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5 committed 2026-09-13 18:27:33 +02:00
1 parent a8817e2849
commit c9e0615a88
4 files changed
+299 -1

No files matched your search

+11 -1
View File
@@ -1,7 +1,7 @@
import json
from pathlib import Path
from leonida.coords import SLICE, chunk_name, parse_chunk_name, pixel_to_world, slice_tiles, tile_for_world
from leonida.coords import SLICE, chunk_for_world, chunk_name, parse_chunk_name, pixel_to_world, slice_tiles, tile_for_world
# Derselbe Beispielsatz wie tests/coords.test.js — JavaScript und Python dürfen nicht auseinanderlaufen.
NAMES = json.loads((Path(__file__).resolve().parents[3] / "tests/fixtures/chunk-names.json").read_text())
@@ -48,3 +48,13 @@ def test_chunk_names_round_trip_for_all_144_chunks():
def test_chunk_names_reject_invalid_index_types():
for i, j in NAMES["invalidIndices"]:
assert chunk_name(i, j) is None
def test_chunk_for_world_matches_javascript():
# Dieselben Beispiele wie tests/coords.test.js: Ecken des Ausschnitts, der Downtown-Bezugspunkt aus
# data/districts.json in B9 und der höchste Turm, das Southeast Financial Center, in C12.
assert chunk_for_world(-1000, 2500) == (0, 0)
assert chunk_for_world(1999, -499) == (11, 11)
assert chunk_for_world(-511, 254) == (1, 8)
assert chunk_name(*chunk_for_world(-511, 254)) == "B9"
assert chunk_name(*chunk_for_world(-461.31, -460.1)) == "C12"