Skip to content

Description:

  • Construct and use map tile grids

Resources:

Get TMS bounding box

import morecantile
tms = morecantile.tms.get("WebMercatorQuad")
print(tms.xy_bbox)

Get the bounds for tile Z=4, X=10, Y=10 in the TMS’s CRS (e.g epsg:3857)

import morecantile
tms = morecantile.tms.get("WebMercatorQuad")
print(tms.xy_bounds(morecantile.Tile(10, 10, 4)))

Get the bounds for tile Z=4, X=10, Y=10 in Geographic CRS (e.g epsg:4326)

import morecantile
tms = morecantile.tms.get("WebMercatorQuad")
print(tms.bounds(morecantile.Tile(10, 10, 4)))

Define a custom grid

import morecantile
from pyproj import CRS
crs = CRS.from_epsg(3031)
extent = [-948.75, -543592.47, 5817.41, -3333128.95] # From https:///epsg.io/3031
customEPGS3031 = morecantile.TileMatrixSet.custom(extent, crs, id="MyCustomTmsEPSG3031")
print(customEPGS3031.matrix(0).dict(exclude_none=True))

ganymede is made by Eugo