Skip to content

Commit 6791a52

Browse files
committed
add more debug endpoint
1 parent 6ac6de4 commit 6791a52

File tree

5 files changed

+68
-17
lines changed

5 files changed

+68
-17
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
## [Unreleased]
4+
5+
## [0.1.0] - TBD
6+
7+
* initial release
8+
9+
[Unreleased]: <https://github.com/developmentseed/titiler-stacapi/compare/0.1.0..main>
10+
[0.1.0]: <https://github.com/developmentseed/titiler-stacapi/tree/0.1.0>

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ uvicorn titiler.stacapi.main:app --port 8000
5454
```
5555
$ git clone https://github.com/developmentseed/titiler-stacapi.git
5656
$ cd titiler-stacapi
57+
$ export TITILER_STACAPI_STAC_API_URL=https://api.stac
5758
$ docker-compose up --build api
5859
```
5960

@@ -63,6 +64,12 @@ It runs `titiler.stacapi` using Gunicorn web server.
6364

6465
![](https://github.com/developmentseed/titiler-stacapi/assets/10407788/2e53bfe3-402a-4c57-bf61-c055e32f1362)
6566

67+
### WMTS and the Render extension
68+
69+
`titiler-stacapi` makes extensive use of the [**Render**](https://github.com/stac-extensions/render) extension, specifically at the `Collection` level.
70+
By using the render's metadata, the `/wmts` endpoint (from the `OGCWMTSFactory` factory) can populate a set of `layers` returned by the `GetCapabilities` service.
71+
72+
6673
## Contribution & Development
6774

6875
See [CONTRIBUTING.md](https://github.com//developmentseed/titiler-stacapi/blob/main/CONTRIBUTING.md)

docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ services:
3737
# setting the configuration option CPL_VSIL_CURL_CACHE_SIZE (in bytes).
3838
- CPL_VSIL_CURL_CACHE_SIZE=200000000
3939
# TiTiler Config
40+
# - RIO_TILER_MAX_THREADS=
4041
- MOSAIC_CONCURRENCY=5
4142
# AWS S3 endpoint config
4243
# - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
4344
# - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
4445
# TiTiler STAC API Config
4546
- TITILER_STACAPI_API_DEBUG=TRUE
46-
- TITILER_STACAPI_STAC_API_URL=
47+
- TITILER_STACAPI_STAC_API_URL=${TITILER_STACAPI_STAC_API_URL}
48+
command:
49+
# You can also overwrite the CMD option and use simple `uvicorn` ASGI server
50+
bash -c "uvicorn titiler.stacapi.main:app --port 8081 --host 0.0.0.0"

docs/mkdocs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ nav:
1818
- Home: index.md
1919
- Endpoints:
2020
- endpoints/index.md
21-
- OGC WMTS: endpoints/ogc_wmts_endpoints.md
22-
- Collections: endpoints/collections_endpoints.md
23-
- Items: endpoints/items_endpoints.md
24-
- TileMatrixSet: endpoints/tms_endpoints.md
21+
- OGC Web Map Tile Service: endpoints/ogc_wmts_endpoints.md
22+
- STAC Collections: endpoints/collections_endpoints.md
23+
- STAC Items: endpoints/items_endpoints.md
24+
- OGC TileMatrix Schemes: endpoints/tms_endpoints.md
2525
- Customization:
2626
- Authentication: custom/application_with_auth.md
2727
- Technical Considerations: technical-considerations.md

titiler/stacapi/main.py

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@
8383
app.add_middleware(LoggerMiddleware, headers=True, querystrings=True)
8484
optional_headers = [OptionalHeader.server_timing, OptionalHeader.x_assets]
8585

86+
###############################################################################
87+
# OGC WMTS Endpoints
88+
wmts = OGCWMTSFactory(
89+
path_dependency=STACApiParams,
90+
templates=templates,
91+
)
92+
app.include_router(
93+
wmts.router,
94+
tags=["OGC Web Map Tile Service"],
95+
)
96+
8697
###############################################################################
8798
# STAC COLLECTION Endpoints
8899
# Notes:
@@ -118,21 +129,10 @@
118129
prefix="/collections/{collection_id}/items/{item_id}",
119130
)
120131

121-
###############################################################################
122-
# OGC WMTS Endpoints
123-
wmts = OGCWMTSFactory(
124-
path_dependency=STACApiParams,
125-
templates=templates,
126-
)
127-
app.include_router(
128-
wmts.router,
129-
tags=["Web Map Tile Service"],
130-
)
131-
132132
###############################################################################
133133
# Tiling Schemes Endpoints
134134
tms = TMSFactory()
135-
app.include_router(tms.router, tags=["Tiling Schemes"])
135+
app.include_router(tms.router, tags=["OGC TileMatrix Schemes"])
136136

137137
###############################################################################
138138
# Algorithms Endpoints
@@ -223,3 +223,33 @@ def landing(
223223
)
224224

225225
return data
226+
227+
228+
if settings.debug:
229+
230+
@app.get("/debug", include_in_schema=False, tags=["DEBUG"])
231+
def debug(request: Request) -> Dict:
232+
"""APP Info."""
233+
234+
import rasterio
235+
from fastapi import __version__ as fastapi_version
236+
from pydantic import __version__ as pydantic_version
237+
from rio_tiler import __version__ as rio_tiler_version
238+
from starlette import __version__ as starlette_version
239+
240+
from titiler.core import __version__ as titiler_version
241+
242+
return {
243+
"url": request.app.state.stac_url,
244+
"versions": {
245+
"titiler.stacapi": titiler_stacapi_version,
246+
"titiler.core": titiler_version,
247+
"rio-tiler": rio_tiler_version,
248+
"rasterio": rasterio.__version__,
249+
"gdal": rasterio.__gdal_version__,
250+
"proj": rasterio.__proj_version__,
251+
"fastapi": fastapi_version,
252+
"starlette": starlette_version,
253+
"pydantic": pydantic_version,
254+
},
255+
}

0 commit comments

Comments
 (0)