> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# Morecantile

> Morecantile: Construct and use map tile grids. A Python demo notebook from ganymede.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/geospatial/morecantile/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/geospatial/morecantile/morecantile.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/geospatial/morecantile.ipynb)

Description:
- Construct and use map tile grids

Resources:
- [GitHub] https://github.com/developmentseed/morecantile
- [Docs] https://developmentseed.org/morecantile/usage/

## Example 1

Get TMS bounding box

```python
import morecantile

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

## Example 2

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

```python
import morecantile

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

## Example 3

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

```python
import morecantile

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

## Example 4

Define a custom grid

```python
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))
```
