Skip to content

Commit

Permalink
Merge pull request #205 from stac-utils/feature/update-for-titiler-0.19
Browse files Browse the repository at this point in the history
update for titiler 0.19
  • Loading branch information
vincentsarago authored Nov 28, 2024
2 parents d212969 + e67795b commit 12e54c0
Show file tree
Hide file tree
Showing 25 changed files with 1,546 additions and 599 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_benchmark_tile(benchmark, tile, search_id):

def f(input_tile):
response = httpx.get(
f"http://{host}:{port}/searches/{search_id}/tiles/{input_tile}?assets=asset"
f"http://{host}:{port}/searches/{search_id}/tiles/WebMercatorQuad/{input_tile}?assets=asset"
)
assert response.status_code == 200
return response
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,5 @@ ENV/
log-config.yml

.pgdata/

dev_notebooks/
38 changes: 38 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Release Notes

## 1.5.0 (2024-11-28)

* update titiler requirement to `>=0.19.0,<0.20`

* Use `@attrs.define` instead of dataclass for factories **breaking change**

* Remove default `WebMercatorQuad` tile matrix set in `/tiles`, `/tilesjson.json`, `/map` and `/WMTSCapabilities.xml` endpoints **breaking change**

```
# Before
/tiles/{z}/{x}/{y}
/tilejson.json
/map
/WMTSCapabilities.xml
# Now
/tiles/WebMercatorQuad/{z}/{x}/{y}
/WebMercatorQuad/tilejson.json
/WebMercatorQuad/map
/WebMercatorQuad/WMTSCapabilities.xml
```
* Use `.as_dict()` method when passing option to rio-tiler Reader's methods to avoid parameter conflicts when using custom Readers.
* add OGC Tiles `/tiles` and `/tiles/{tileMatrixSet}` endpoints
* add `/point` prefix to `/{lon},{lat}/assets` endpoint **breaking change**
* rename `reader` attribute to `backend` in `MosaicTilerFactory` **breaking change**
* rename `titiler/pgstac/mosaic.py → titiler/pgstac/backend.py` **breaking change**
* rename `titiler.pgstac.mosaic.CustomSTACReader → titiler.pgstac.reader.SimpleSTACReader` **breaking change**
* rename factory's method to match the one from `titiler.core/titiler.mosaic` **breaking change**
* split `_assets_routes` into `assets_tile` and `assets_point` **breaking change**
## 1.4.0 (2024-09-06)
* add `/collections/{collection_id}/items/{item_id}/assets/{asset_id}` optional endpoints (`TITILER_PGSTAC_API_ENABLE_ASSETS_ENDPOINTS=TRUE|FALSE`)
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile.uvicorn
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ ARG PYTHON_VERSION=3.11

FROM python:${PYTHON_VERSION}-slim

# ref: https://github.com/rasterio/rasterio-wheels/issues/136, https://github.com/docker-library/python/issues/989
RUN apt update && apt install -y libexpat1

WORKDIR /tmp

COPY titiler/ titiler/
COPY pyproject.toml pyproject.toml
COPY README.md README.md
COPY LICENSE LICENSE

RUN pip install --no-cache-dir --upgrade .["psycopg-binary"] uvicorn
RUN python -m pip install --no-cache-dir --upgrade .["psycopg-binary"] uvicorn
RUN rm -rf titiler/ pyproject.toml README.md LICENSE

# http://www.uvicorn.org/settings/
Expand Down
5 changes: 3 additions & 2 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ nav:
- Mosaic metadata specification: advanced/metadata.md
- Mosaic list: advanced/searches_list.md
- Custom search model: advanced/custom_search.md
- Custom TileJSON endpoint : advanced/custom_tilejson.md
- Custom TileJSON endpoint: advanced/custom_tilejson.md
- Zarr/NetCDF support: advanced/support_multidim_dataset.md
- Examples:
- demo: notebooks/demo.ipynb
- API:
Expand All @@ -41,7 +42,7 @@ nav:
- extensions: api/titiler/pgstac/extensions.md
- factory: api/titiler/pgstac/factory.md
- model: api/titiler/pgstac/model.md
- mosaic: api/titiler/pgstac/mosaic.md
- backend: api/titiler/pgstac/backend.md
- reader: api/titiler/pgstac/reader.md
- settings: api/titiler/pgstac/settings.md
- utils: api/titiler/pgstac/utils.md
Expand Down
21 changes: 10 additions & 11 deletions docs/src/advanced/custom_tilejson.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ from starlette.requests import Request
class MosaicTilerFactory(TitilerPgSTACFactory.MosaicTilerFactory):
"""Custom factory."""

def _tilejson_routes(self) -> None:
def tilejson(self) -> None:
"""Custom TileJSON endpoint."""

@self.router.get(
"/tilejson.json",
response_model=TileJSON,
responses={200: {"description": "Return a tilejson"}},
response_model_exclude_none=True,
)
@self.router.get(
"/{tileMatrixSetId}/tilejson.json",
response_model=TileJSON,
Expand All @@ -40,15 +34,19 @@ class MosaicTilerFactory(TitilerPgSTACFactory.MosaicTilerFactory):
)
def tilejson(
request: Request,
search_id=Depends(self.path_dependency),
tileMatrixSetId: Annotated[ # type: ignore
tileMatrixSetId: Annotated[
Literal[tuple(self.supported_tms.list())],
f"Identifier selecting one of the TileMatrixSetId supported (default: '{self.default_tms}')",
] = self.default_tms,
Path(
description="Identifier selecting one of the TileMatrixSetId supported."
),
],
########################################################
# CUSTOM: add `layer=` query-parameter
layer: Annotated[
str,
Query(description="Name of default configuration"),
] = None,
########################################################
tile_format: Annotated[
Optional[ImageType],
Query(
Expand All @@ -69,6 +67,7 @@ class MosaicTilerFactory(TitilerPgSTACFactory.MosaicTilerFactory):
Optional[int],
Query(description="Overwrite default maxzoom."),
] = None,
search_id=Depends(self.path_dependency),
layer_params=Depends(self.layer_dependency),
dataset_params=Depends(self.dataset_dependency),
pixel_selection=Depends(self.pixel_selection_dependency),
Expand Down
Loading

0 comments on commit 12e54c0

Please sign in to comment.