FA-69921 / Map projection transforms / Open access
Geographic bounds of a map tile: north edge row · case 01
Tiles have zero height: north equals south.
ROOT CAUSE
The north edge is evaluated at row+1, the same edge used for the southern boundary.
VERIFIED REPAIR
At the north edge row step restore `north = edge_lat(row)`, leaving the rest of the model unchanged.
Unsuccessful approach: Using row-1 returns the northern edge of the tile above, doubling each tile height.
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 - 2 * r / n))))
west = col / n * 360.0 - 180.0
east = (col + 1) / n * 360.0 - 180.0
north = edge_lat(row + 1)
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 #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 #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 #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 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 #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 #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('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 #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [-180.0, -85.051129, 180.0, -85.051129] | [-180.0, -85.051129, 180.0, 85.051129] | Failed |
| control #1 | [0.0, 0.0, 180.0, 0.0] | [0.0, 0.0, 180.0, 85.051129] | Failed |
| control #2 | [90.0, 66.51326, 180.0, 66.51326] | [90.0, 66.51326, 180.0, 85.051129] | Failed |
| control #3 | [45.0, 40.979898, 90.0, 40.979898] | [45.0, 40.979898, 90.0, 66.51326] | Failed |
| control #4 | [-22.5, 21.943046, 0.0, 21.943046] | [-22.5, 21.943046, 0.0, 40.979898] | Failed |
| control #5 | [0.0, 48.922499, 11.25, 48.922499] | [0.0, 48.922499, 11.25, 55.776573] | Failed |
| control #6 | [5.625, -52.48278, 11.25, -52.48278] | [5.625, -52.48278, 11.25, -48.922499] | Failed |
| control #7 | [101.25, 54.162434, 104.0625, 54.162434] | [101.25, 54.162434, 104.0625, 55.776573] | Failed |
SHA-256 / c7f6f6093e6f01d35480d13572f6b7f02b89e12a037be93c33366c8546932787
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))))
west = col / n * 360.0 - 180.0
east = (col + 1) / n * 360.0 - 180.0
north = edge_lat(max(row - 1, 0))
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 #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 #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 #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 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 #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 #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('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 #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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, 79.171335] | [45.0, 40.979898, 90.0, 66.51326] | Failed |
| control #4 | [-22.5, 21.943046, 0.0, 55.776573] | [-22.5, 21.943046, 0.0, 40.979898] | Failed |
| control #5 | [0.0, 48.922499, 11.25, 61.606396] | [0.0, 48.922499, 11.25, 55.776573] | Failed |
| control #6 | [5.625, -52.48278, 11.25, -45.089036] | [5.625, -52.48278, 11.25, -48.922499] | Failed |
| control #7 | [101.25, 54.162434, 104.0625, 57.326521] | [101.25, 54.162434, 104.0625, 55.776573] | Failed |
SHA-256 / 91b7549b17adaabcb658875b4b8ab9e384d18d441b8b159186de1b04e414edef
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 #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 #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 #5', [5, 16, 10, 'xyz'], [0.0, 48.922499, 11.25, 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 #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 #7', [7, 100, 40, 'xyz'], [101.25, 54.162434, 104.0625, 55.776573]), ('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 #8', [8, 0, 255, 'xyz'], [-180.0, -85.051129, -178.59375, -84.928321]), ('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 / c97879ba0989f9adb52d72f735d0bc25572a75fd56fe8fec15c460f319599e39
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.822354+00:00.
Case digest / 2e2ca16445b275c80ac2cd63103fdbe80f35225de10acf3c962646aecce0f781