Exemplo n.º 1
0
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())])


async def request_hash(request: Request) -> str:
    """Create SHA224 id from reuqest."""
    return get_hash(**dict(request.query_params), **request.path_params)


def WebMercatorTMSParams(
        TileMatrixSetId: WebMercatorTileMatrixSetName = Query(
Exemplo n.º 2
0
#                       CMAP AND TMS Customization
morecantile.tms.register(custom_tms.EPSG3413)
# REGISTER CUSTOM TMS
#
# e.g morecantile.tms.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("ColorMapNames",
                     [(a, a) for a in sorted(cmap.list())])  # type: ignore
TileMatrixSetNames = Enum(
    "TileMatrixSetNames",
    [(a, a) for a in sorted(morecantile.tms.list())])  # type: ignore
ResamplingNames = Enum("ResamplingNames",
                       [(r.name, r.name) for r in Resampling])  # type: ignore


async def request_hash(request: Request) -> str:
    """Create SHA224 id from reuqest."""
    return get_hash(**dict(request.query_params), **request.path_params)


class CommonTileParams:
    """Common Tile parameters."""
    def __init__(