{"id":6722,"library":"morecantile","title":"Morecantile","description":"Morecantile is a Python library for constructing and using map tile grids, also known as TileMatrixSet (TMS). It extends the functionality of libraries like mercantile by supporting a wider range of TileMatrixSet grids beyond just Web Mercator. The library is currently at version 7.0.3 and maintains an active release cadence, providing tools to work with OGC TMS specifications (currently TMS 2.0).","status":"active","version":"7.0.3","language":"en","source_language":"en","source_url":"https://github.com/developmentseed/morecantile","tags":["mapping","tiles","GIS","TileMatrixSet","geospatial"],"install":[{"cmd":"pip install morecantile","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for Coordinate Reference System (CRS) transformations.","package":"pyproj","optional":false},{"reason":"Used for defining and validating TileMatrixSet documents.","package":"pydantic","optional":false},{"reason":"Optional dependency for integration with raster data operations, often installed as an extra.","package":"rasterio","optional":true}],"imports":[{"note":"The 'tms' object is the primary entry point for accessing default and custom TileMatrixSets.","symbol":"tms","correct":"import morecantile\ntms = morecantile.tms.get('WebMercatorQuad')"},{"note":"Represents a single map tile with x, y, z coordinates.","symbol":"Tile","correct":"from morecantile import Tile"},{"note":"The Pydantic model for defining custom TileMatrixSets.","symbol":"TileMatrixSet","correct":"from morecantile.models import TileMatrixSet"}],"quickstart":{"code":"import morecantile\n\n# Get a default TileMatrixSet (TMS) like WebMercatorQuad\ntms = morecantile.tms.get(\"WebMercatorQuad\")\n\n# Define a tile (Z, X, Y)\ntile = morecantile.Tile(x=10, y=10, z=4)\n\n# Get the bounding box of the tile in the TMS's CRS (e.g., EPSG:3857 for WebMercatorQuad)\nxy_bounds = tms.xy_bounds(tile)\nprint(f\"Tile {tile} XY Bounds: {xy_bounds}\")\n\n# Get the bounding box of the tile in Geographic CRS (e.g., EPSG:4326)\ngeographic_bounds = tms.bounds(tile)\nprint(f\"Tile {tile} Geographic Bounds: {geographic_bounds}\")\n\n# List available default TileMatrixSets\nprint(f\"Available TMS grids: {morecantile.tms.list()[:3]}...\")","lang":"python","description":"This quickstart demonstrates how to load a predefined TileMatrixSet, create a Tile object, and retrieve its bounding box in both the TMS's native CRS and in a geographic CRS."},"warnings":[{"fix":"Upgrade your Python environment to version 3.11 or later to use morecantile 7.x.","message":"Morecantile 7.0.0 dropped support for Python versions 3.8, 3.9, and 3.10. It now requires Python 3.11 or newer.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Update your code to expect WGS84 for GeoJSON outputs, and adjust property access for `tms` and `tms_crs` if you were consuming `grid_name` or `grid_crs`. If you need a different CRS, explicitly set the `geographic_crs` option in the relevant methods.","message":"Starting with version 7.0.0, the default CRS for GeoJSON outputs from methods like `TileMatrixSet.feature` is now WGS84 (EPSG:4326) as per specification. Additionally, property names like `grid_name` and `grid_crs` were renamed to `tms` and `tms_crs` respectively within GeoJSON responses.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"If your application relies on the previous, more lenient behavior, you can pass `strict=False` to the `is_valid` method: `tms.is_valid(x, y, z, strict=False)`.","message":"The `TileMatrixSet.is_valid` method became strict by default in 7.0.0. This means it will raise an error if a requested tile's zoom level is beyond the TMS's `maxzoom` and a corresponding `TileMatrix` is not explicitly defined, whereas previous versions might have issued a `UserWarning`.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"If you are defining custom TileMatrixSets using JSON files, update your JSON documents to conform to the TMS 2.0 specification. Alternatively, for older TMS v1 JSONs, use the `TileMatrixSet.from_v1` class method to parse them.","message":"Morecantile versions 4.0.0 and above adopted the OGC TMS 2.0 specification, which introduced several breaking changes to the TMS JSON document structure. Key field renames include `identifier` to `id`, `supportedCRS` to `crs`, `tileMatrix` to `tileMatrices`, and `topLeftCorner` to `pointOfOrigin`.","severity":"breaking","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}