From d13d61f13c1d8b7718cbecfce5cf7f321f1dd28a Mon Sep 17 00:00:00 2001 From: Hermann Schwarting Date: Wed, 3 Jan 2024 17:36:30 +0100 Subject: [PATCH] PMTiles: invert y axis of tile coordinates The y axis of XYZ tiles is oriented from north to south. When enumerating tiles for a given bounding box, the y coordinates have to be enumerated from north/top to south/bottom. --- .../mapwithai/backend/BoundingBoxMapWithAIDownloader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java index d43ab420..e1472b40 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java @@ -135,7 +135,7 @@ private static Stream tilesFromBBox(int zoom, Bounds bounds) { final var tile1 = tileFromLatLonZoom(left, bottom, zoom); final var tile2 = tileFromLatLonZoom(right, top, zoom); return IntStream.rangeClosed(tile1.x, tile2.x) - .mapToObj(x -> IntStream.rangeClosed(tile1.y, tile2.y).mapToObj(y -> new TileXYZ(x, y, zoom))) + .mapToObj(x -> IntStream.rangeClosed(tile2.y, tile1.y).mapToObj(y -> new TileXYZ(x, y, zoom))) .flatMap(stream -> stream); }