(-4194300, -4194300, 4194300, 4194300), CRS.from_epsg(3413), identifier="EPSG3413", matrix_scale=[2, 2], ) # CUSTOM TMS for EPSG:6933 # info from https://epsg.io/6933 EPSG6933 = morecantile.TileMatrixSet.custom( (-17357881.81713629, -7324184.56362408, 17357881.81713629, 7324184.56362408), CRS.from_epsg(6933), identifier="EPSG6933", matrix_scale=[1, 1], ) tms = tms.register([EPSG3413, EPSG6933]) TileMatrixSetName = Enum( # type: ignore "TileMatrixSetName", [(a, a) for a in sorted(tms.list())]) def ColorMapParams( colormap_name: ColorMapName = Query(None, description="Colormap name"), colormap: str = Query(None, description="JSON encoded custom Colormap"), ) -> Optional[Dict]: """Colormap Dependency.""" if colormap_name: return cmap.get(colormap_name.value) if colormap: try:
from morecantile.models import TileMatrixSet from rasterio.enums import Resampling from rio_tiler.colormap import cmap, parse_color from rio_tiler.errors import MissingAssets, MissingBands from .custom import cmap as custom_colormap from .custom import tms as custom_tms from .utils import get_hash from fastapi import Query from starlette.requests import Request ################################################################################ # CMAP AND TMS Customization tms = tms.register([custom_tms.EPSG3413, custom_tms.EPSG6933]) cmap = cmap.register({"above": custom_colormap.above_cmap}) ################################################################################ # DO NOT UPDATE # Create ENUMS with all CMAP and TMS for documentation and validation. ColorMapName = Enum( # type: ignore "ColorMapName", [(a, a) for a in sorted(cmap.list())]) ResamplingName = Enum( # type: ignore "ResamplingName", [(r.name, r.name) for r in Resampling]) WebMercatorTileMatrixSetName = Enum( # type: ignore "WebMercatorTileMatrixSetName", [("WebMercatorQuad", "WebMercatorQuad")]) TileMatrixSetName = Enum( # type: ignore "TileMatrixSetName", [(a, a) for a in sorted(tms.list())])
from morecantile import tms as DefaultTileMatrixSets from morecantile.models import TileMatrixSet from rasterio.enums import Resampling from rio_tiler.colormap import cmap from .custom import cmap as custom_colormap from .custom import tms as custom_tms from .utils import get_hash from fastapi import Query from starlette.requests import Request ################################################################################ # CMAP AND TMS Customization DefaultTileMatrixSets.register(custom_tms.EPSG3413) DefaultTileMatrixSets.register(custom_tms.EPSG6933) # REGISTER CUSTOM TMS # # e.g DefaultTileMatrixSets.register(custom_tms.my_custom_tms) cmap.register("above", custom_colormap.above_cmap) # REGISTER CUSTOM COLORMAP HERE # # e.g cmap.register("customRed", custom_colormap.custom_red) ################################################################################ # DO NOT UPDATE # Create ENUMS with all CMAP and TMS for documentation and validation. ColorMapNames = Enum( # type: ignore "ColorMapNames", [(a, a) for a in sorted(cmap.list())])