Skip to content

Module tipg.factory

tipg.factory: router factories.

Variables

COMMON_CONFORMS
DEFAULT_TEMPLATES
FEATURES_CONFORMS
TILES_CONFORMS
features_settings
jinja2_env
mvt_settings
tms_settings

Functions

create_csv_rows

def create_csv_rows(
    data: Iterable[Dict]
) -> Generator[str, NoneType, NoneType]

Creates an iterator that returns lines of csv from an iterable of dicts.

create_html_response

def create_html_response(
    request: starlette.requests.Request,
    data: Any,
    templates: starlette.templating.Jinja2Templates,
    template_name: str,
    title: Union[str, NoneType] = None,
    router_prefix: Union[str, NoneType] = None,
    **kwargs: Any
) -> starlette.templating._TemplateResponse

Create Template response.

Classes

Endpoints

class Endpoints(
    router: fastapi.routing.APIRouter = <factory>,
    collection_dependency: Callable[..., tipg.collections.Collection] = <function CollectionParams at 0x7fcb9aec2670>,
    router_prefix: str = '',
    templates: starlette.templating.Jinja2Templates = <starlette.templating.Jinja2Templates object at 0x7fcb9ae4f310>,
    with_common: bool = True,
    title: str = 'OGC API',
    collections_dependency: Callable[..., tipg.collections.CollectionList] = <function CollectionsParams at 0x7fcb9aec25e0>,
    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': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/WebMercatorQuad.json'), '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')}),
    with_tiles_viewer: bool = True
)

OGC Features and Tiles Endpoints Factory.

Ancestors (in MRO)

  • tipg.factory.EndpointsFactory

Class variables

router_prefix
supported_tms
templates
title
with_common
with_tiles_viewer

Instance variables

conforms_to

Endpoints conformances.

Methods

collection_dependency

def collection_dependency(
    request: starlette.requests.Request,
    collectionId: typing_extensions.Annotated[str, Path(PydanticUndefined)]
) -> tipg.collections.Collection

Return Layer Object.

collections_dependency

def collections_dependency(
    request: starlette.requests.Request,
    bbox_filter: typing_extensions.Annotated[Union[List[float], NoneType], Depends(bbox_query)],
    datetime_filter: typing_extensions.Annotated[Union[List[str], NoneType], Depends(datetime_query)],
    type_filter: typing_extensions.Annotated[Union[Literal['Function', 'Table'], NoneType], Query(PydanticUndefined)] = None,
    limit: typing_extensions.Annotated[Union[int, NoneType], Query(PydanticUndefined)] = None,
    offset: typing_extensions.Annotated[Union[int, NoneType], Query(PydanticUndefined)] = None
) -> tipg.collections.CollectionList

Return Collections Catalog.

def links(
    self,
    request: starlette.requests.Request
) -> List[tipg.model.Link]

List of available links.

register_routes

def register_routes(
    self
)

Register factory Routes.

url_for

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

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

EndpointsFactory

class EndpointsFactory(
    router: fastapi.routing.APIRouter = <factory>,
    collection_dependency: Callable[..., tipg.collections.Collection] = <function CollectionParams at 0x7fcb9aec2670>,
    router_prefix: str = '',
    templates: starlette.templating.Jinja2Templates = <starlette.templating.Jinja2Templates object at 0x7fcb9ae4f310>,
    with_common: bool = True,
    title: str = 'OGC API'
)

Endpoints Factory.

Descendants

  • tipg.factory.OGCFeaturesFactory
  • tipg.factory.OGCTilesFactory
  • tipg.factory.Endpoints

Class variables

router_prefix
templates
title
with_common

Instance variables

conforms_to

Endpoints conformances.

Methods

collection_dependency

def collection_dependency(
    request: starlette.requests.Request,
    collectionId: typing_extensions.Annotated[str, Path(PydanticUndefined)]
) -> tipg.collections.Collection

Return Layer Object.

def links(
    self,
    request: starlette.requests.Request
) -> List[tipg.model.Link]

Register factory Routes.

register_routes

def register_routes(
    self
)

Register factory Routes.

url_for

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

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

OGCFeaturesFactory

class OGCFeaturesFactory(
    router: fastapi.routing.APIRouter = <factory>,
    collection_dependency: Callable[..., tipg.collections.Collection] = <function CollectionParams at 0x7fcb9aec2670>,
    router_prefix: str = '',
    templates: starlette.templating.Jinja2Templates = <starlette.templating.Jinja2Templates object at 0x7fcb9ae4f310>,
    with_common: bool = True,
    title: str = 'OGC API',
    collections_dependency: Callable[..., tipg.collections.CollectionList] = <function CollectionsParams at 0x7fcb9aec25e0>
)

OGC Features Endpoints Factory.

Ancestors (in MRO)

  • tipg.factory.EndpointsFactory

Class variables

router_prefix
templates
title
with_common

Instance variables

conforms_to

Factory conformances.

Methods

collection_dependency

def collection_dependency(
    request: starlette.requests.Request,
    collectionId: typing_extensions.Annotated[str, Path(PydanticUndefined)]
) -> tipg.collections.Collection

Return Layer Object.

collections_dependency

def collections_dependency(
    request: starlette.requests.Request,
    bbox_filter: typing_extensions.Annotated[Union[List[float], NoneType], Depends(bbox_query)],
    datetime_filter: typing_extensions.Annotated[Union[List[str], NoneType], Depends(datetime_query)],
    type_filter: typing_extensions.Annotated[Union[Literal['Function', 'Table'], NoneType], Query(PydanticUndefined)] = None,
    limit: typing_extensions.Annotated[Union[int, NoneType], Query(PydanticUndefined)] = None,
    offset: typing_extensions.Annotated[Union[int, NoneType], Query(PydanticUndefined)] = None
) -> tipg.collections.CollectionList

Return Collections Catalog.

def links(
    self,
    request: starlette.requests.Request
) -> List[tipg.model.Link]

OGC Features API links.

register_routes

def register_routes(
    self
)

Register OGC Features endpoints.

url_for

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

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

OGCTilesFactory

class OGCTilesFactory(
    router: fastapi.routing.APIRouter = <factory>,
    collection_dependency: Callable[..., tipg.collections.Collection] = <function CollectionParams at 0x7fcb9aec2670>,
    router_prefix: str = '',
    templates: starlette.templating.Jinja2Templates = <starlette.templating.Jinja2Templates object at 0x7fcb9ae4f310>,
    with_common: bool = True,
    title: str = 'OGC API',
    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': PosixPath('/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/morecantile/data/WebMercatorQuad.json'), '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')}),
    with_viewer: bool = True
)

OGC Tiles Endpoints Factory.

Ancestors (in MRO)

  • tipg.factory.EndpointsFactory

Class variables

router_prefix
supported_tms
templates
title
with_common
with_viewer

Instance variables

conforms_to

Factory conformances.

Methods

collection_dependency

def collection_dependency(
    request: starlette.requests.Request,
    collectionId: typing_extensions.Annotated[str, Path(PydanticUndefined)]
) -> tipg.collections.Collection

Return Layer Object.

def links(
    self,
    request: starlette.requests.Request
) -> List[tipg.model.Link]

OGC Tiles API links.

register_routes

def register_routes(
    self
)

Register OGC Tiles endpoints.

url_for

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

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