Module titiler.mosaic.factory¶
TiTiler.mosaic Router factories.
Variables¶
MAX_THREADS
WGS84_CRS
img_endpoint_params
Functions¶
PixelSelectionParams¶
def PixelSelectionParams(
pixel_selection: typing_extensions.Annotated[Literal['first', 'highest', 'lowest', 'mean', 'median', 'stdev', 'lastbandlow', 'lastbandhight'], 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 0x7fc46c8c9af0>,
router: fastapi.routing.APIRouter = <factory>,
path_dependency: Callable[..., Any] = <function DatasetPathParams at 0x7fc46bbf3d30>,
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[..., Union[titiler.core.algorithm.base.BaseAlgorithm, NoneType]] = <function Algorithms.dependency.<locals>.post_process at 0x7fc46ba24310>,
rescale_dependency: Callable[..., Union[List[Tuple[float, ...]], NoneType]] = <function RescalingParams at 0x7fc46bbf3dc0>,
color_formula_dependency: Callable[..., Union[str, NoneType]] = <function ColorFormulaParams at 0x7fc46bbcce50>,
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 0x7fc46bbf3ca0>,
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 0x7fc46ba24280>,
supported_tms: morecantile.defaults.TileMatrixSets = TileMatrixSets(tms={'CDB1GlobalGrid': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/CDB1GlobalGrid.json'), 'CanadianNAD83_LCC': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/CanadianNAD83_LCC.json'), 'EuropeanETRS89_LAEAQuad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/EuropeanETRS89_LAEAQuad.json'), 'GNOSISGlobalGrid': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/GNOSISGlobalGrid.json'), 'LINZAntarticaMapTilegrid': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/LINZAntarticaMapTilegrid.json'), 'NZTM2000Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/NZTM2000Quad.json'), 'UPSAntarcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/UPSAntarcticWGS84Quad.json'), 'UPSArcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/UPSArcticWGS84Quad.json'), 'UTM31WGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/UTM31WGS84Quad.json'), 'WGS1984Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/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.8.18/x64/lib/python3.8/site-packages/morecantile/data/WorldCRS84Quad.json'), 'WorldMercatorWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/WorldMercatorWGS84Quad.json')}),
default_tms: str = 'WebMercatorQuad',
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 0x7fc46bbde8b0>,
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 0x7fc46c8c99d0>,
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: typing_extensions.Annotated[Union[str, NoneType], Query(PydanticUndefined)] = None
) -> Union[str, NoneType]
ColorFormula Parameter.
colormap_dependency¶
def colormap_dependency(
colormap_name: typing_extensions.Annotated[Literal['coolwarm', 'plasma_r', 'brbg_r', 'tab20c', 'phase_r', 'turbid_r', 'pastel1', 'matter_r', 'bone', 'oranges', 'solar_r', 'ylgnbu', 'gnuplot2', 'dark2', 'diff', 'ylorrd', 'schwarzwald', 'purd', 'purd_r', 'set3', 'phase', 'set1_r', 'afmhot', 'twilight_shifted', 'tab20c_r', 'greens_r', 'tab10_r', 'cool_r', 'greys', 'rdbu_r', 'ylgnbu_r', 'puor_r', 'matter', 'pubugn', 'gist_rainbow', 'amp', 'jet', 'wistia_r', 'curl', 'tempo', 'spring_r', 'autumn_r', 'rplumbo', 'thermal_r', 'jet_r', 'pastel2', 'inferno_r', 'gist_heat_r', 'ice_r', 'haline_r', 'rdbu', 'solar', 'copper_r', 'puor', 'hsv_r', 'copper', 'topo_r', 'turbo', 'seismic_r', 'reds_r', 'gnuplot2_r', 'summer_r', 'spectral_r', 'rainbow', 'rdylgn', 'oxy_r', 'gist_ncar_r', 'prism', 'set1', 'prgn_r', 'tab20', 'pubugn_r', 'pastel2_r', 'gist_stern_r', 'viridis_r', 'twilight_r', 'pink_r', 'cividis_r', 'deep', 'tab20b_r', 'algae_r', 'accent', 'gnuplot_r', 'gist_stern', 'dense', 'twilight_shifted_r', 'spectral', 'ice', 'amp_r', 'purples', 'flag_r', 'prism_r', 'afmhot_r', 'paired', 'gist_gray_r', 'winter', 'rdgy_r', 'bupu_r', 'greens', 'cmrmap', 'prgn', 'orrd', 'gist_earth', 'dark2_r', 'gist_rainbow_r', 'nipy_spectral', 'deep_r', 'oranges_r', 'cubehelix', 'topo', 'gist_yarg', 'ylorbr_r', 'binary_r', 'gray_r', 'binary', 'purples_r', 'hot', 'gnbu', 'set2', 'bugn_r', 'tab20_r', 'algae', 'rdpu_r', 'rainbow_r', 'ylorrd_r', 'plasma', 'set3_r', 'piyg_r', 'rdylbu', 'seismic', 'gray', 'cfastie', 'gist_ncar', 'balance_r', 'rdylgn_r', 'gist_earth_r', 'tarn', 'inferno', 'gnuplot', 'ocean', 'coolwarm_r', 'blues_r', 'paired_r', 'turbo_r', 'oxy', 'ylorbr', 'bwr_r', 'viridis', 'orrd_r', 'pubu', 'twilight', 'ylgn_r', 'rain_r', 'nipy_spectral_r', 'delta', 'rdylbu_r', 'pastel1_r', 'summer', 'rain', 'diff_r', 'brg_r', 'cmrmap_r', 'brbg', 'terrain_r', 'gist_heat', 'hot_r', 'blues', 'bupu', 'curl_r', 'bugn', 'magma', 'flag', 'cividis', 'terrain', 'bwr', 'balance', 'hsv', 'spring', 'greys_r', 'pink', 'cool', 'speed', 'wistia', 'brg', 'delta_r', 'ocean_r', 'cubehelix_r', 'gist_yarg_r', 'tarn_r', 'haline', 'accent_r', 'gnbu_r', 'tempo_r', 'tab10', 'ylgn', 'reds', 'autumn', 'magma_r', 'speed_r', 'pubu_r', 'tab20b', 'set2_r', 'piyg', 'turbid', 'rdpu', 'bone_r', 'gist_gray', 'thermal', 'rdgy', 'dense_r', 'winter_r'], Query(PydanticUndefined)] = None,
colormap: typing_extensions.Annotated[Union[str, NoneType], 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_extensions.Annotated[str, Query(PydanticUndefined)]
) -> str
Create dataset path from args
pixel_selection_dependency¶
def pixel_selection_dependency(
pixel_selection: typing_extensions.Annotated[Literal['first', 'highest', 'lowest', 'mean', 'median', 'stdev', 'lastbandlow', 'lastbandhight'], 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: typing_extensions.Annotated[Literal['hillshade', 'contours', 'normalizedIndex', 'terrarium', 'terrainrgb'], Query(PydanticUndefined)] = None,
algorithm_params: typing_extensions.Annotated[Union[str, NoneType], Query(PydanticUndefined)] = None
) -> Union[titiler.core.algorithm.base.BaseAlgorithm, NoneType]
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: typing_extensions.Annotated[Union[List[str], NoneType], Query(PydanticUndefined)] = None
) -> Union[List[Tuple[float, ...]], NoneType]
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.