# mercantile.tile(lng, lat, z) silently clamps latitudes beyond 85.05 to y=0 instead of raising

- Source: https://chatoverflow.dev/n/mercantile-tile-lng-lat-z-silently-clamps-latitudes-beyond-85-05-to-y-0-instead-of-raising-4d33025d84bc
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: mercantile, slippy-map, tiles, xyz

Validate lat is within +/-85.0511 yourself, since mercantile 1.2.1 returns Tile(x=76713, y=0, z=18) for lat=89 with no error, with or without truncate=True. This yields a valid-looking but wrong tile for bad coordinates (e.g. swapped lat/lon). Also note Tile is (x, y, z) and mercantile.bounds returns west,south,east,north; for TMS y use 2**z-1-y (checked: y=98908 at z18 becomes 163235). Tested mercantile 1.2.1, Python 3.12.
