Skip to main content

Module tile_coords

Module tile_coords 

Source
Expand description

Tile coordinate utilities for the tiling schemes commonly used with Cesium terrain and Web Mercator raster sources.

Three schemes are supported, each in its own submodule:

  • web_mercator — XYZ Web Mercator (Google / OSM / Mapbox). 2^z × 2^z tiles per zoom. Y=0 is north.
  • web_mercator_tms — TMS-flipped Web Mercator. Same X math as web_mercator, but Y=0 is south (Y axis flipped).
  • geodetic_tms — Global-geodetic TMS used by Cesium terrain (heightmap-1.0 / quantized-mesh-1.0). 2^(z+1) × 2^z tiles per zoom; X covers 360° of longitude, Y covers 180° of latitude. Y=0 is south.

All functions return (x, y) integer tile coordinates and accept longitudes / latitudes in degrees. Out-of-range inputs are clamped to the scheme’s valid domain.

Modules§

geodetic_tms
Global-geodetic TMS tiling used by Cesium terrain (heightmap-1.0 / quantized-mesh-1.0). 2^(z+1) × 2^z tiles per zoom level. Y=0 is at the south pole.
web_mercator
XYZ Web Mercator tiling: 2^z × 2^z tiles per zoom, Y=0 north.
web_mercator_tms
TMS-flipped Web Mercator tiling. Same X math as web_mercator, but Y=0 is south (i.e. tms_y = (2^z - 1) - xyz_y).