TMS v2.0 and Morecantile v4¶
In September 2022, the Open Geospatial Consortium released an updated specification for Tile Matrix Sets - version 2.0.
This updated spec includes some breaking changes that alter the TMS JSON document. Some of these changes include:
- Addition of a
uriparameter for TileMatrixSets registered on the official OGC NA TileMatrixSets registry identifierrenamed toidin both TileMatrix and TileMatrixSet- Only
crsandtileMatricesare required inTileMatrixSet supportedCRSrenamed tocrstileMatrixrenamed totileMatricestopLeftCornerrenamed topointOfOrigin- Add
cellSizeandcornerOfOrigin(Optional) parameters to TileMatrix - Remove
typeobject properties - Added optional axis ordering
Morecantile version 4 has been updated to support the updated TMS 2.0 specification. When using the predefined Tile Matrix Sets or making a custom TMS this should work as normal with some renamed properties (specified above).
If you want to create a new Tile Matrix Set from a JSON made to the old TMS v1 specification, there is a new class method called from_v1 that does this.
from morecantile.models import TileMatrixSet
import json
with open("tms_v1.json") as f:
data = json.load(f)
TileMatrixSet.from_v1(data)