Skip to content

Commit

Permalink
add more debug endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jun 10, 2024
1 parent 6ac6de4 commit 6791a52
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 17 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


## [Unreleased]

## [0.1.0] - TBD

* initial release

[Unreleased]: <https://github.com/developmentseed/titiler-stacapi/compare/0.1.0..main>
[0.1.0]: <https://github.com/developmentseed/titiler-stacapi/tree/0.1.0>
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=
- 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"
8 changes: 4 additions & 4 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 42 additions & 12 deletions titiler/stacapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
},
}

0 comments on commit 6791a52

Please sign in to comment.