From 5bcf7d9bcf750a6e56c20d33c57e0714d4e7eae1 Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Tue, 7 Jan 2025 11:34:48 -0800 Subject: [PATCH] Fix antimeridian adjustment. Z0 can't wait until the end of the tile --- tests/ne_110m_ocean/join/joined.mbtiles.json | 2 +- tile-join.cpp | 38 +++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/tests/ne_110m_ocean/join/joined.mbtiles.json b/tests/ne_110m_ocean/join/joined.mbtiles.json index 08148a955..4c2c3c801 100644 --- a/tests/ne_110m_ocean/join/joined.mbtiles.json +++ b/tests/ne_110m_ocean/join/joined.mbtiles.json @@ -1,5 +1,5 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "-180.000000,-85.051129,180.000000,85.051129", +"antimeridian_adjusted_bounds": "0.000000,-85.051129,359.912109,85.051129", "bounds": "-180.000000,-85.051129,180.000000,85.051129", "center": "-45.000000,33.256630,4", "description": "tests/ne_110m_ocean/join/ocean.mbtiles", diff --git a/tile-join.cpp b/tile-join.cpp index 8589c5ad0..eb2b160a3 100644 --- a/tile-join.cpp +++ b/tile-join.cpp @@ -273,6 +273,9 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::mapmaxlat = std::max(a->maxlat, std::max(lat1, lat2)); a->maxlon = std::max(a->maxlon, std::max(lon1, lon2)); - if (lon1 < 0 || lon2 < 0) { - lon1 += 360; - lon2 += 360; - } + tile2lonlat(minx2, maxy, 32, &lon1, &lat1); + tile2lonlat(maxx2, miny, 32, &lon2, &lat2); a->minlon2 = std::min(a->minlon2, std::min(lon1, lon2)); a->maxlon2 = std::max(a->maxlon2, std::max(lon1, lon2));