From 6791a52f6518d3e1dc519bee9eb7b73cc482d39f Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 10 Jun 2024 16:21:33 +0200 Subject: [PATCH] add more debug endpoint --- CHANGELOG.md | 10 ++++++++ README.md | 7 ++++++ docker-compose.yml | 6 ++++- docs/mkdocs.yml | 8 +++--- titiler/stacapi/main.py | 54 ++++++++++++++++++++++++++++++++--------- 5 files changed, 68 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..5331435 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ + + +## [Unreleased] + +## [0.1.0] - TBD + +* initial release + +[Unreleased]: +[0.1.0]: diff --git a/README.md b/README.md index a25464b..e980326 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ uvicorn titiler.stacapi.main:app --port 8000 ``` $ git clone https://github.com/developmentseed/titiler-stacapi.git $ cd titiler-stacapi +$ export TITILER_STACAPI_STAC_API_URL=https://api.stac $ docker-compose up --build api ``` @@ -63,6 +64,12 @@ It runs `titiler.stacapi` using Gunicorn web server. ![](https://github.com/developmentseed/titiler-stacapi/assets/10407788/2e53bfe3-402a-4c57-bf61-c055e32f1362) +### WMTS and the Render extension + +`titiler-stacapi` makes extensive use of the [**Render**](https://github.com/stac-extensions/render) extension, specifically at the `Collection` level. +By using the render's metadata, the `/wmts` endpoint (from the `OGCWMTSFactory` factory) can populate a set of `layers` returned by the `GetCapabilities` service. + + ## Contribution & Development See [CONTRIBUTING.md](https://github.com//developmentseed/titiler-stacapi/blob/main/CONTRIBUTING.md) diff --git a/docker-compose.yml b/docker-compose.yml index f1e7205..bf2d679 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,10 +37,14 @@ services: # setting the configuration option CPL_VSIL_CURL_CACHE_SIZE (in bytes). - CPL_VSIL_CURL_CACHE_SIZE=200000000 # TiTiler Config + # - RIO_TILER_MAX_THREADS= - MOSAIC_CONCURRENCY=5 # AWS S3 endpoint config # - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} # - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} # TiTiler STAC API Config - TITILER_STACAPI_API_DEBUG=TRUE - - TITILER_STACAPI_STAC_API_URL= \ No newline at end of file + - TITILER_STACAPI_STAC_API_URL=${TITILER_STACAPI_STAC_API_URL} + command: + # You can also overwrite the CMD option and use simple `uvicorn` ASGI server + bash -c "uvicorn titiler.stacapi.main:app --port 8081 --host 0.0.0.0" diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index a2f0f9f..e39746c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -18,10 +18,10 @@ nav: - Home: index.md - Endpoints: - endpoints/index.md - - OGC WMTS: endpoints/ogc_wmts_endpoints.md - - Collections: endpoints/collections_endpoints.md - - Items: endpoints/items_endpoints.md - - TileMatrixSet: endpoints/tms_endpoints.md + - OGC Web Map Tile Service: endpoints/ogc_wmts_endpoints.md + - STAC Collections: endpoints/collections_endpoints.md + - STAC Items: endpoints/items_endpoints.md + - OGC TileMatrix Schemes: endpoints/tms_endpoints.md - Customization: - Authentication: custom/application_with_auth.md - Technical Considerations: technical-considerations.md diff --git a/titiler/stacapi/main.py b/titiler/stacapi/main.py index 5abd396..610801a 100644 --- a/titiler/stacapi/main.py +++ b/titiler/stacapi/main.py @@ -83,6 +83,17 @@ app.add_middleware(LoggerMiddleware, headers=True, querystrings=True) optional_headers = [OptionalHeader.server_timing, OptionalHeader.x_assets] +############################################################################### +# OGC WMTS Endpoints +wmts = OGCWMTSFactory( + path_dependency=STACApiParams, + templates=templates, +) +app.include_router( + wmts.router, + tags=["OGC Web Map Tile Service"], +) + ############################################################################### # STAC COLLECTION Endpoints # Notes: @@ -118,21 +129,10 @@ prefix="/collections/{collection_id}/items/{item_id}", ) -############################################################################### -# OGC WMTS Endpoints -wmts = OGCWMTSFactory( - path_dependency=STACApiParams, - templates=templates, -) -app.include_router( - wmts.router, - tags=["Web Map Tile Service"], -) - ############################################################################### # Tiling Schemes Endpoints tms = TMSFactory() -app.include_router(tms.router, tags=["Tiling Schemes"]) +app.include_router(tms.router, tags=["OGC TileMatrix Schemes"]) ############################################################################### # Algorithms Endpoints @@ -223,3 +223,33 @@ def landing( ) return data + + +if settings.debug: + + @app.get("/debug", include_in_schema=False, tags=["DEBUG"]) + def debug(request: Request) -> Dict: + """APP Info.""" + + import rasterio + from fastapi import __version__ as fastapi_version + from pydantic import __version__ as pydantic_version + from rio_tiler import __version__ as rio_tiler_version + from starlette import __version__ as starlette_version + + from titiler.core import __version__ as titiler_version + + return { + "url": request.app.state.stac_url, + "versions": { + "titiler.stacapi": titiler_stacapi_version, + "titiler.core": titiler_version, + "rio-tiler": rio_tiler_version, + "rasterio": rasterio.__version__, + "gdal": rasterio.__gdal_version__, + "proj": rasterio.__proj_version__, + "fastapi": fastapi_version, + "starlette": starlette_version, + "pydantic": pydantic_version, + }, + }