FA-69909 / Map projection transforms / Member archive
Slippy map tile index from coordinates: row lower clamp · case 04
Latitudes beyond the mercator limit produce negative row numbers.
Case contract
Input [lon, lat, z] with lon in [-180, 180], any latitude, z >= 0. With n = 2**z tiles per axis, column = floor((lon+180)/360*n) and row = floor((1 - asinh(tan(lat))/pi)/2*n) (row 0 at the north edge); both are clamped to [0, n-1] so lon=180 falls in the last column and latitudes beyond the mercator limit fall in the edge rows. Return [z, column, row].
Why this case matters
Tile servers and caches key storage by these indices; an off-by-one or flipped axis fetches the wrong image.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary #2 | [5, 16, -9] | [5, 16, 0] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗