Skip to content

Module titiler.mosaic.factory

TiTiler.mosaic Router factories.

Variables

MAX_THREADS
WGS84_CRS
img_endpoint_params

Functions

PixelSelectionParams

def PixelSelectionParams(
    pixel_selection: Annotated[Literal['first', 'highest', 'lowest', 'mean', 'median', 'stdev', 'lastbandlow', 'lastbandhight', 'count'], Query(PydanticUndefined)] = 'first'
) -> rio_tiler.mosaic.methods.base.MosaicMethodBase

Returns the mosaic method used to combine datasets together.

Classes

MosaicTilerFactory

class MosaicTilerFactory(
    reader: Type[cogeo_mosaic.backends.base.BaseBackend] = <function MosaicBackend at 0x7f859c566f20>,
    router: fastapi.routing.APIRouter = <factory>,
    path_dependency: Callable[..., Any] = <function DatasetPathParams at 0x7f859c09c4a0>,
    layer_dependency: Type[titiler.core.dependencies.DefaultDependency] = <class 'titiler.core.dependencies.BidxExprParams'>,
    dataset_dependency: Type[titiler.core.dependencies.DefaultDependency] = <class 'titiler.core.dependencies.DatasetParams'>,
    process_dependency: Callable[..., Optional[titiler.core.algorithm.base.BaseAlgorithm]] = <function Algorithms.dependency.<locals>.post_process at 0x7f859be6a660>,
    rescale_dependency: Callable[..., Optional[List[Tuple[float, ...]]]] = <function RescalingParams at 0x7f859c09dc60>,
    color_formula_dependency: Callable[..., Optional[str]] = <function ColorFormulaParams at 0x7f859beec9a0>,
    colormap_dependency: Callable[..., Union[Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]], NoneType]] = <function create_colormap_dependency.<locals>.deps at 0x7f859c09cb80>,
    render_dependency: Type[titiler.core.dependencies.DefaultDependency] = <class 'titiler.core.dependencies.ImageRenderingParams'>,
    reader_dependency: Type[titiler.core.dependencies.DefaultDependency] = <class 'titiler.core.dependencies.DefaultDependency'>,
    environment_dependency: Callable[..., Dict] = <function BaseTilerFactory.<lambda> at 0x7f859be6a700>,
    supported_tms: morecantile.defaults.TileMatrixSets = TileMatrixSets(tms={'CDB1GlobalGrid': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/CDB1GlobalGrid.json'), 'CanadianNAD83_LCC': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/CanadianNAD83_LCC.json'), 'EuropeanETRS89_LAEAQuad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/EuropeanETRS89_LAEAQuad.json'), 'GNOSISGlobalGrid': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/GNOSISGlobalGrid.json'), 'LINZAntarticaMapTilegrid': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/LINZAntarticaMapTilegrid.json'), 'NZTM2000Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/NZTM2000Quad.json'), 'UPSAntarcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/UPSAntarcticWGS84Quad.json'), 'UPSArcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/UPSArcticWGS84Quad.json'), 'UTM31WGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/UTM31WGS84Quad.json'), 'WGS1984Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/WGS1984Quad.json'), 'WebMercatorQuad': <TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, 'WorldCRS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/WorldCRS84Quad.json'), 'WorldMercatorWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/morecantile/data/WorldMercatorWGS84Quad.json')}),
    default_tms: Optional[str] = None,
    router_prefix: str = '',
    optional_headers: List[titiler.core.resources.enums.OptionalHeader] = <factory>,
    route_dependencies: List[Tuple[List[titiler.core.routing.EndpointScope], List[fastapi.params.Depends]]] = <factory>,
    extensions: List[titiler.core.factory.FactoryExtension] = <factory>,
    templates: starlette.templating.Jinja2Templates = <starlette.templating.Jinja2Templates object at 0x7f859be78150>,
    dataset_reader: Union[Type[rio_tiler.io.base.BaseReader], Type[rio_tiler.io.base.MultiBaseReader], Type[rio_tiler.io.base.MultiBandReader]] = <class 'rio_tiler.io.rasterio.Reader'>,
    backend_dependency: Type[titiler.core.dependencies.DefaultDependency] = <class 'titiler.core.dependencies.DefaultDependency'>,
    pixel_selection_dependency: Callable[..., rio_tiler.mosaic.methods.base.MosaicMethodBase] = <function PixelSelectionParams at 0x7f85a691cd60>,
    tile_dependency: Type[titiler.core.dependencies.DefaultDependency] = <class 'titiler.core.dependencies.TileParams'>,
    add_viewer: bool = True
)

MosaicTiler Factory.

The main difference with titiler.endpoint.factory.TilerFactory is that this factory needs the reader to be of cogeo_mosaic.backends.BaseBackend type (e.g MosaicBackend) and a dataset_reader (BaseReader).

Ancestors (in MRO)

  • titiler.core.factory.BaseTilerFactory

Class variables

add_viewer
backend_dependency
dataset_dependency
dataset_reader
default_tms
layer_dependency
reader_dependency
render_dependency
router_prefix
supported_tms
templates
tile_dependency

Methods

add_route_dependencies

def add_route_dependencies(
    self,
    *,
    scopes: List[titiler.core.routing.EndpointScope],
    dependencies=typing.List[fastapi.params.Depends]
)

Add dependencies to routes.

Allows a developer to add dependencies to a route after the route has been defined.

assets

def assets(
    self
)

Register /assets endpoint.

bounds

def bounds(
    self
)

Register /bounds endpoint.

color_formula_dependency

def color_formula_dependency(
    color_formula: Annotated[Optional[str], Query(PydanticUndefined)] = None
) -> Optional[str]

ColorFormula Parameter.

colormap_dependency

def colormap_dependency(
    colormap_name: Annotated[Literal['plasma_r', 'pastel2', 'rdylbu_r', 'cividis', 'purples_r', 'twilight_shifted_r', 'brbg_r', 'gist_ncar_r', 'tarn', 'set1_r', 'rainbow_r', 'bupu_r', 'turbid', 'diff', 'turbid_r', 'ice_r', 'ocean', 'accent_r', 'hot', 'reds_r', 'rdylgn_r', 'gist_yarg', 'hsv', 'nipy_spectral_r', 'greens', 'inferno_r', 'ylgnbu', 'prism_r', 'winter', 'set2_r', 'gnuplot2', 'gnuplot2_r', 'set3', 'speed', 'seismic_r', 'cool', 'bwr', 'purples', 'topo_r', 'spring_r', 'blues', 'rdpu_r', 'terrain_r', 'pastel2_r', 'brg_r', 'rain_r', 'binary_r', 'gist_heat', 'tarn_r', 'amp_r', 'topo', 'prgn', 'phase_r', 'gist_ncar', 'blues_r', 'delta_r', 'tab20_r', 'delta', 'solar_r', 'summer_r', 'oranges', 'tempo', 'spectral_r', 'gist_earth', 'gnuplot', 'piyg', 'viridis', 'orrd', 'cubehelix_r', 'phase', 'magma_r', 'viridis_r', 'twilight_r', 'wistia', 'curl', 'cividis_r', 'tab20b', 'gist_rainbow', 'winter_r', 'pastel1_r', 'flag_r', 'ocean_r', 'bugn', 'rdgy', 'rain', 'algae_r', 'wistia_r', 'accent', 'tempo_r', 'afmhot', 'amp', 'rdbu_r', 'puor_r', 'ylorrd', 'pubu_r', 'brbg', 'pink_r', 'greys_r', 'pubugn_r', 'cmrmap', 'flag', 'turbo', 'oxy_r', 'ylorbr_r', 'matter_r', 'twilight', 'deep', 'purd', 'coolwarm', 'gist_rainbow_r', 'spring', 'autumn', 'spectral', 'hot_r', 'coolwarm_r', 'schwarzwald', 'tab10_r', 'speed_r', 'ylgn_r', 'gnuplot_r', 'gist_heat_r', 'rdylbu', 'orrd_r', 'piyg_r', 'balance', 'balance_r', 'pubu', 'pink', 'prgn_r', 'inferno', 'bupu', 'dark2_r', 'deep_r', 'matter', 'jet', 'tab20c_r', 'diff_r', 'nipy_spectral', 'gist_earth_r', 'gist_stern_r', 'haline', 'turbo_r', 'prism', 'purd_r', 'haline_r', 'rplumbo', 'gist_gray', 'greens_r', 'gray', 'algae', 'tab10', 'hsv_r', 'autumn_r', 'rdpu', 'thermal_r', 'oxy', 'cmrmap_r', 'cubehelix', 'ylgnbu_r', 'dense', 'bugn_r', 'gist_stern', 'tab20', 'ylorbr', 'summer', 'rdylgn', 'tab20b_r', 'jet_r', 'paired_r', 'dark2', 'binary', 'twilight_shifted', 'seismic', 'pubugn', 'ylgn', 'rdbu', 'bone', 'tab20c', 'dense_r', 'gnbu', 'set2', 'paired', 'gnbu_r', 'copper_r', 'gist_yarg_r', 'pastel1', 'bwr_r', 'greys', 'puor', 'oranges_r', 'cool_r', 'afmhot_r', 'rdgy_r', 'bone_r', 'thermal', 'ice', 'gray_r', 'copper', 'cfastie', 'curl_r', 'reds', 'brg', 'solar', 'ylorrd_r', 'magma', 'plasma', 'set3_r', 'rainbow', 'terrain', 'gist_gray_r', 'set1'], Query(PydanticUndefined)] = None,
    colormap: Annotated[Optional[str], Query(PydanticUndefined)] = None
)

environment_dependency

def environment_dependency(

)

info

def info(
    self
)

Register /info endpoint

map_viewer

def map_viewer(
    self
)

Register /map endpoint.

path_dependency

def path_dependency(
    url: typing.Annotated[str, Query(PydanticUndefined)]
) -> str

Create dataset path from args

pixel_selection_dependency

def pixel_selection_dependency(
    pixel_selection: Annotated[Literal['first', 'highest', 'lowest', 'mean', 'median', 'stdev', 'lastbandlow', 'lastbandhight', 'count'], Query(PydanticUndefined)] = 'first'
) -> rio_tiler.mosaic.methods.base.MosaicMethodBase

Returns the mosaic method used to combine datasets together.

point

def point(
    self
)

Register /point endpoint.

process_dependency

def process_dependency(
    algorithm: Annotated[Literal['hillshade', 'contours', 'normalizedIndex', 'terrarium', 'terrainrgb'], Query(PydanticUndefined)] = None,
    algorithm_params: Annotated[Optional[str], Query(PydanticUndefined)] = None
) -> Optional[titiler.core.algorithm.base.BaseAlgorithm]

Data Post-Processing options.

read

def read(
    self
)

Register / (Get) Read endpoint.

reader

def reader(
    input: str,
    *args: Any,
    **kwargs: Any
) -> cogeo_mosaic.backends.base.BaseBackend

Select mosaic backend for input.

register_routes

def register_routes(
    self
)

This Method register routes to the router.

Because we wrap the endpoints in a class we cannot define the routes as methods (because of the self argument). The HACK is to define routes inside the class method and register them after the class initialization.

rescale_dependency

def rescale_dependency(
    rescale: Annotated[Optional[List[str]], Query(PydanticUndefined)] = None
) -> Optional[List[Tuple[float, ...]]]

Min/Max data Rescaling

tile

def tile(
    self
)

Register /tiles endpoints.

tilejson

def tilejson(
    self
)

Add tilejson endpoint.

url_for

def url_for(
    self,
    request: starlette.requests.Request,
    name: str,
    **path_params: Any
) -> str

Return full url (with prefix) for a specific endpoint.

validate

def validate(
    self
)

Register /validate endpoint.

wmts

def wmts(
    self
)

Add wmts endpoint.