factory
titiler.core.factory ¶
TiTiler Router factories.
AlgorithmFactory ¶
BaseFactory ¶
Base Factory.
Abstract Base Class which defines most inputs used by dynamic tiler.
Attributes:
-
router
(APIRouter
) –Application router to register endpoints to.
-
router_prefix
(str
) –prefix where the router will be mounted in the application.
__attrs_post_init__ ¶
__attrs_post_init__()
Post Init: register route and configure specific options.
add_route_dependencies ¶
add_route_dependencies(*, scopes: List[EndpointScope], dependencies=List[DependsFunc])
Add dependencies to routes.
Allows a developer to add dependencies to a route after the route has been defined.
ColorMapFactory ¶
FactoryExtension ¶
Factory Extension.
MultiBandTilerFactory ¶
Bases: TilerFactory
Custom Tiler Factory for MultiBandReader classes.
Note
To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a bands
argument to most of its methods. By using the BandsExprParams
for the layer_dependency
, the
.tile(), .point(), .preview() and the .part() methods will receive bands or expression arguments.
The rio_tiler.io.MultiBandReader .info()
and .metadata()
have bands
as
a requirement arguments (github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/io/base.py#L775).
This means we have to update the /info and /metadata endpoints in order to add the bands
dependency.
For implementation example see developmentseed/titiler-pds
MultiBaseTilerFactory ¶
Bases: TilerFactory
Custom Tiler Factory for MultiBaseReader classes.
Note
To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a assets
argument to most of its methods. By using the AssetsBidxExprParams
for the layer_dependency
, the
.tile(), .point(), .preview() and the .part() methods will receive assets, expression or indexes arguments.
The rio_tiler.io.MultiBaseReader .info()
and .metadata()
have assets
as
a requirement arguments (github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/io/base.py#L365).
This means we have to update the /info and /metadata endpoints in order to add the assets
dependency.
TMSFactory ¶
TilerFactory ¶
Bases: BaseFactory
Tiler Factory.
Attributes:
-
reader
(BaseReader
) –A rio-tiler reader. Defaults to
rio_tiler.io.Reader
. -
path_dependency
(Callable
) –Endpoint dependency defining
path
to pass to the reader init. -
dataset_dependency
(DefaultDependency
) –Endpoint dependency defining dataset overwriting options (e.g nodata).
-
layer_dependency
(DefaultDependency
) –Endpoint dependency defining dataset indexes/bands/assets options.
-
render_dependency
(DefaultDependency
) –Endpoint dependency defining image rendering options (e.g add_mask).
-
colormap_dependency
(Callable
) –Endpoint dependency defining ColorMap options (e.g colormap_name).
-
process_dependency
(DefaultDependency
) –Endpoint dependency defining image post-processing options (e.g rescaling, color-formula).
-
tms_dependency
(Callable
) –Endpoint dependency defining TileMatrixSet to use.
-
reader_dependency
(DefaultDependency
) –Endpoint dependency defining BaseReader options.
-
environment_dependency
(Callable
) –Endpoint dependency to define GDAL environment at runtime.
-
stats_dependency
(DefaultDependency
) –Endpoint dependency defining options for rio-tiler's statistics method.
-
histogram_dependency
(DefaultDependency
) –Endpoint dependency defining options for numpy's histogram method.
-
img_preview_dependency
(DefaultDependency
) –Endpoint dependency defining options for rio-tiler's preview method.
-
img_part_dependency
(DefaultDependency
) –Endpoint dependency defining options for rio-tiler's part/feature methods.
-
add_preview
(bool
) –add
/preview
endpoints. Defaults to True. -
add_part
(bool
) –add
/bbox
and/feature
endpoints. Defaults to True. -
add_viewer
(bool
) –add
/map
endpoints. Defaults to True.
register_routes ¶
register_routes()
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.