FAILURE MAP
← Case archive

FA-69926 / Map projection transforms / Open access

Geographic bounds of a map tile: edge latitude factor · case 01

All tile edges crowd toward the north, the south half of the world disappears.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The sinh argument uses (1 - r/n) instead of (1 - 2r/n), mapping the bottom row edge to the equator.

VERIFIED REPAIR

At the edge latitude factor step restore `math.pi * (1 - 2 * r / n)`, leaving the rest of the model unchanged.

Unsuccessful approach: Dividing by n+1 instead of n shrinks the grid so no row reaches the southern limit exactly.

Case contract

Input [z, col, row, scheme] where scheme is "xyz" (row 0 at north) or "tms" (row 0 at south). Return [west, south, east, north] in degrees rounded to 6 decimals, using lon = col/n*360-180 and lat = degrees(atan(sinh(pi*(1-2*r/n)))) for an xyz row edge r, n = 2**z. A tms row t is the xyz row n-1-t.

Why this case matters

Tile footprints drive cache invalidation, label placement and raster reprojection; wrong edges misalign tiles.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    z, col, row, scheme = x
    n = 2 ** z
    if scheme == 'tms':
        row = n - 1 - row
    def edge_lat(r):
        return math.degrees(math.atan(math.sinh(math.pi * (1 - r / n))))
    west = col / n * 360.0 - 180.0
    east = (col + 1) / n * 360.0 - 180.0
    north = edge_lat(row)
    south = edge_lat(row + 1)
    return [round(west, 6), round(south, 6), round(east, 6), round(north, 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573])], [('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361])], [('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control #0[-180.0, 0.0, 180.0, 85.051129][-180.0, -85.051129, 180.0, 85.051129]Failed
control #1[0.0, 66.51326, 180.0, 85.051129][0.0, 0.0, 180.0, 85.051129]Failed
control #2[90.0, 79.171335, 180.0, 85.051129][90.0, 66.51326, 180.0, 85.051129]Failed
control #3[45.0, 74.019543, 90.0, 79.171335][45.0, 40.979898, 90.0, 66.51326]Failed
control #4[-22.5, 70.612614, 0.0, 74.019543][-22.5, 21.943046, 0.0, 40.979898]Failed
control #5[0.0, 75.497157, 11.25, 76.840816][0.0, 48.922499, 11.25, 55.776573]Failed
control #6[5.625, 50.736455, 11.25, 52.48278][5.625, -52.48278, 11.25, -48.922499]Failed
control #7[101.25, 76.516819, 104.0625, 76.840816][101.25, 54.162434, 104.0625, 55.776573]Failed

SHA-256 / c6a6ff87c9bcbea9d4b68a1448618be4233075cb98d04c122caab8136348c196

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    z, col, row, scheme = x
    n = 2 ** z
    if scheme == 'tms':
        row = n - 1 - row
    def edge_lat(r):
        return math.degrees(math.atan(math.sinh(math.pi * (1 - 2 * r / (n + 1)))))
    west = col / n * 360.0 - 180.0
    east = (col + 1) / n * 360.0 - 180.0
    north = edge_lat(row)
    south = edge_lat(row + 1)
    return [round(west, 6), round(south, 6), round(east, 6), round(north, 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573])], [('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361])], [('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control #0[-180.0, 0.0, 180.0, 85.051129][-180.0, -85.051129, 180.0, 85.051129]Failed
control #1[0.0, 51.326035, 180.0, 85.051129][0.0, 0.0, 180.0, 85.051129]Failed
control #2[90.0, 72.732786, 180.0, 85.051129][90.0, 66.51326, 180.0, 85.051129]Failed
control #3[45.0, 51.326035, 90.0, 70.193377][45.0, 40.979898, 90.0, 66.51326]Failed
control #4[-22.5, 30.252369, 0.0, 46.700873][-22.5, 21.943046, 0.0, 40.979898]Failed
control #5[0.0, 51.326035, 11.25, 57.647182][0.0, 48.922499, 11.25, 55.776573]Failed
control #6[5.625, -50.157843, 11.25, -46.47698][5.625, -52.48278, 11.25, -48.922499]Failed
control #7[101.25, 54.682497, 104.0625, 56.263977][101.25, 54.162434, 104.0625, 55.776573]Failed

SHA-256 / 4c7d4c6cfefa2c02bcf75884b7d7d91390f107da678112bb703c3328ea8ce02e

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    z, col, row, scheme = x
    n = 2 ** z
    if scheme == 'tms':
        row = n - 1 - row
    def edge_lat(r):
        return math.degrees(math.atan(math.sinh(math.pi * (1 - 2 * r / n))))
    west = col / n * 360.0 - 180.0
    east = (col + 1) / n * 360.0 - 180.0
    north = edge_lat(row)
    south = edge_lat(row + 1)
    return [round(west, 6), round(south, 6), round(east, 6), round(north, 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573])], [('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #6', [6, 33, 21, 'tms'], [5.625, -52.48278, 11.25, -48.922499]), ('control #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361])], [('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('control #9', [8, 255, 0, 'tms'], [178.59375, -85.051129, 180.0, -84.928321]), ('control #10', [10, 550, 335, 'xyz'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #11', [10, 550, 688, 'tms'], [13.359375, 52.48278, 13.710938, 52.696361]), ('control #12', [12, 1206, 1540, 'xyz'], [-74.003906, 40.647304, -73.916016, 40.713956]), ('control #13', [3, 0, 7, 'tms'], [-180.0, 79.171335, -135.0, 85.051129]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])], [('control #0', [0, 0, 0, 'xyz'], [-180.0, -85.051129, 180.0, 85.051129]), ('control #1', [1, 1, 0, 'xyz'], [0.0, 0.0, 180.0, 85.051129]), ('control #2', [2, 3, 3, 'tms'], [90.0, 66.51326, 180.0, 85.051129]), ('control #3', [3, 5, 2, 'xyz'], [45.0, 40.979898, 90.0, 66.51326]), ('control #4', [4, 7, 9, 'tms'], [-22.5, 21.943046, 0.0, 40.979898]), ('control #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 55.776573]), ('control #14', [1, 0, 1, 'tms'], [-180.0, 0.0, 0.0, 85.051129]), ('control #15', [9, 300, 200, 'xyz'], [30.9375, 36.031332, 31.640625, 36.597889])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control #0[-180.0, -85.051129, 180.0, 85.051129][-180.0, -85.051129, 180.0, 85.051129]Passed
control #1[0.0, 0.0, 180.0, 85.051129][0.0, 0.0, 180.0, 85.051129]Passed
control #2[90.0, 66.51326, 180.0, 85.051129][90.0, 66.51326, 180.0, 85.051129]Passed
control #3[45.0, 40.979898, 90.0, 66.51326][45.0, 40.979898, 90.0, 66.51326]Passed
control #4[-22.5, 21.943046, 0.0, 40.979898][-22.5, 21.943046, 0.0, 40.979898]Passed
control #5[0.0, 48.922499, 11.25, 55.776573][0.0, 48.922499, 11.25, 55.776573]Passed
control #6[5.625, -52.48278, 11.25, -48.922499][5.625, -52.48278, 11.25, -48.922499]Passed
control #7[101.25, 54.162434, 104.0625, 55.776573][101.25, 54.162434, 104.0625, 55.776573]Passed

SHA-256 / ba901fc9ed43b5caaae7a7aec163a1e094fb9dbc34f30a03bf478d09b6d7bb7b

Verification & scope

Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:48:15.874073+00:00.

Case digest / eee59b96a4db35c89fdfd294abccb834569da75c3923bc0b5cae4117e23ab3b0