Skip to content

Commit

Permalink
PMTiles: invert y axis of tile coordinates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hfs committed Jan 3, 2024
1 parent 68b9ff9 commit d13d61f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static Stream<TileXYZ> 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);
}

Expand Down

0 comments on commit d13d61f

Please sign in to comment.