From 7f0949e07ed4ec48c617bc1da1af5ae4fb931782 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Tue, 23 Jan 2024 15:57:57 +0100 Subject: [PATCH] update rio-tiler, add align stats and fix morecantile breaking change --- CHANGES.md | 6 ++++++ pyproject.toml | 1 + titiler/pgstac/factory.py | 3 ++- titiler/pgstac/main.py | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index e5f46c82..d24061b0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Release Notes +## 0.8.2 (2024-01-23) + +* update rio-tiler version to `>6.3.0` (defined in `titiler>=0.17`) +* use new `align_bounds_with_dataset=True` rio-tiler option in GeoJSON statistics methods for more precise calculation [backported from 1.2.0] +* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private TileMatrixSet._resolution method [backported from 1.1.0] + ## 0.8.1 (2023-11-10) * add `algorithm` options for `/statistics [POST]` endpoints diff --git a/pyproject.toml b/pyproject.toml index 691d8186..43fa549c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ classifiers = [ dependencies = [ "titiler.core>=0.15.0,<0.16", "titiler.mosaic>=0.15.0,<0.16", + "rio-tiler>=6.3.0,<7.0", "geojson-pydantic~=1.0", "pydantic>=2.4,<3.0", "pydantic-settings~=2.0", diff --git a/titiler/pgstac/factory.py b/titiler/pgstac/factory.py index b5a95b4b..47847205 100644 --- a/titiler/pgstac/factory.py +++ b/titiler/pgstac/factory.py @@ -450,7 +450,7 @@ def map_viewer( "request": request, "tilejson_endpoint": tilejson_url, "tms": tms, - "resolutions": [tms._resolution(matrix) for matrix in tms], + "resolutions": [matrix.cellSize for matrix in tms], }, media_type="text/html", ) @@ -1083,6 +1083,7 @@ def geojson_statistics( dst_crs=dst_crs, pixel_selection=pixel_selection, threads=MOSAIC_THREADS, + align_bounds_with_dataset=True, **image_params, **layer_params, **dataset_params, diff --git a/titiler/pgstac/main.py b/titiler/pgstac/main.py index 05be1e3b..41831df6 100644 --- a/titiler/pgstac/main.py +++ b/titiler/pgstac/main.py @@ -1,6 +1,7 @@ """TiTiler+PgSTAC FastAPI application.""" import logging +import re from contextlib import asynccontextmanager from typing import Dict @@ -209,6 +210,9 @@ def landing(request: Request): } urlpath = request.url.path + if root_path := request.app.root_path: + urlpath = re.sub(r"^" + root_path, "", urlpath) + crumbs = [] baseurl = str(request.base_url).rstrip("/")