From fce7194d798c50f1eec11181066fc8e5700fbf61 Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Mon, 8 Jan 2024 11:42:58 +0100 Subject: [PATCH 01/32] limit fastapi upper version to avoid starlette breaking change (#746) --- CHANGES.md | 4 ++++ src/titiler/core/pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 2e0f9f3f6..5e0b486f5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ## Unreleased +### titiler.core + +* update FastAPI version upper limit to `0.107.0` to avoid starlette breaking change (`0.28`) + ### titiler.application * add simple *auth* (optional) based on `global_access_token` string, set with `TITILER_API_GLOBAL_ACCESS_TOKEN` environment variable (author @DeflateAwning, https://github.com/developmentseed/titiler/pull/735) diff --git a/src/titiler/core/pyproject.toml b/src/titiler/core/pyproject.toml index 7323f97b7..81cdb8c44 100644 --- a/src/titiler/core/pyproject.toml +++ b/src/titiler/core/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "fastapi>=0.100.0", + "fastapi>=0.100.0,<0.107.0", "geojson-pydantic>=1.0,<2.0", "jinja2>=2.11.2,<4.0.0", "numpy", From 28c0b5149c061ccbf0644d7ed94a5551976b112a Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 11:43:41 +0100 Subject: [PATCH 02/32] release date --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 5e0b486f5..a67e29dd2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Release Notes -## Unreleased +## 0.15.7 (2024-01-08) ### titiler.core From 33914c7facc0fbc12be7c67fd3b4a8615184bdef Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 11:43:44 +0100 Subject: [PATCH 03/32] =?UTF-8?q?Bump=20version:=200.15.6=20=E2=86=92=200.?= =?UTF-8?q?15.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- deployment/aws/lambda/Dockerfile | 2 +- deployment/k8s/charts/Chart.yaml | 2 +- pyproject.toml | 10 +++++----- src/titiler/application/pyproject.toml | 6 +++--- .../application/titiler/application/__init__.py | 2 +- src/titiler/core/titiler/core/__init__.py | 2 +- src/titiler/extensions/pyproject.toml | 2 +- src/titiler/extensions/titiler/extensions/__init__.py | 2 +- src/titiler/mosaic/pyproject.toml | 2 +- src/titiler/mosaic/titiler/mosaic/__init__.py | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 614fc611c..96d2a13a8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.15.6 +current_version = 0.15.7 commit = True tag = True tag_name = {new_version} diff --git a/deployment/aws/lambda/Dockerfile b/deployment/aws/lambda/Dockerfile index 69961ce19..9d39994bb 100644 --- a/deployment/aws/lambda/Dockerfile +++ b/deployment/aws/lambda/Dockerfile @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} WORKDIR /tmp RUN pip install pip -U -RUN pip install "titiler.application==0.15.6" "mangum>=0.10.0" -t /asset --no-binary pydantic +RUN pip install "titiler.application==0.15.7" "mangum>=0.10.0" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; diff --git a/deployment/k8s/charts/Chart.yaml b/deployment/k8s/charts/Chart.yaml index 8758e641f..366c68535 100644 --- a/deployment/k8s/charts/Chart.yaml +++ b/deployment/k8s/charts/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.15.6 +appVersion: 0.15.7 description: A dynamic Web Map tile server name: titiler version: 1.1.2 diff --git a/pyproject.toml b/pyproject.toml index 25adc3481..e62a0f318 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: GIS", ] -version="0.15.6" +version="0.15.7" dependencies = [ - "titiler.core==0.15.6", - "titiler.extensions==0.15.6", - "titiler.mosaic==0.15.6", - "titiler.application==0.15.6", + "titiler.core==0.15.7", + "titiler.extensions==0.15.7", + "titiler.mosaic==0.15.7", + "titiler.application==0.15.7", ] [project.optional-dependencies] diff --git a/src/titiler/application/pyproject.toml b/src/titiler/application/pyproject.toml index 3388b7299..ac1bebf84 100644 --- a/src/titiler/application/pyproject.toml +++ b/src/titiler/application/pyproject.toml @@ -29,9 +29,9 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.15.6", - "titiler.extensions[cogeo,stac]==0.15.6", - "titiler.mosaic==0.15.6", + "titiler.core==0.15.7", + "titiler.extensions[cogeo,stac]==0.15.7", + "titiler.mosaic==0.15.7", "starlette-cramjam>=0.3,<0.4", "pydantic-settings~=2.0", ] diff --git a/src/titiler/application/titiler/application/__init__.py b/src/titiler/application/titiler/application/__init__.py index 5618f7f98..ab2979b5d 100644 --- a/src/titiler/application/titiler/application/__init__.py +++ b/src/titiler/application/titiler/application/__init__.py @@ -1,3 +1,3 @@ """titiler.application""" -__version__ = "0.15.6" +__version__ = "0.15.7" diff --git a/src/titiler/core/titiler/core/__init__.py b/src/titiler/core/titiler/core/__init__.py index f6d699e73..72ecf3cac 100644 --- a/src/titiler/core/titiler/core/__init__.py +++ b/src/titiler/core/titiler/core/__init__.py @@ -1,6 +1,6 @@ """titiler.core""" -__version__ = "0.15.6" +__version__ = "0.15.7" from . import dependencies, errors, factory, routing # noqa from .factory import ( # noqa diff --git a/src/titiler/extensions/pyproject.toml b/src/titiler/extensions/pyproject.toml index 586ad2b11..20973221f 100644 --- a/src/titiler/extensions/pyproject.toml +++ b/src/titiler/extensions/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.15.6" + "titiler.core==0.15.7" ] [project.optional-dependencies] diff --git a/src/titiler/extensions/titiler/extensions/__init__.py b/src/titiler/extensions/titiler/extensions/__init__.py index bb898cad8..e61611701 100644 --- a/src/titiler/extensions/titiler/extensions/__init__.py +++ b/src/titiler/extensions/titiler/extensions/__init__.py @@ -1,6 +1,6 @@ """titiler.extensions""" -__version__ = "0.15.6" +__version__ = "0.15.7" from .cogeo import cogValidateExtension # noqa from .stac import stacExtension # noqa diff --git a/src/titiler/mosaic/pyproject.toml b/src/titiler/mosaic/pyproject.toml index 91d906061..1fbc77d9e 100644 --- a/src/titiler/mosaic/pyproject.toml +++ b/src/titiler/mosaic/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.15.6", + "titiler.core==0.15.7", "cogeo-mosaic>=7.0,<8.0", ] diff --git a/src/titiler/mosaic/titiler/mosaic/__init__.py b/src/titiler/mosaic/titiler/mosaic/__init__.py index 087ad9912..050b058f0 100644 --- a/src/titiler/mosaic/titiler/mosaic/__init__.py +++ b/src/titiler/mosaic/titiler/mosaic/__init__.py @@ -1,6 +1,6 @@ """titiler.mosaic""" -__version__ = "0.15.6" +__version__ = "0.15.7" from . import errors, factory # noqa from .factory import MosaicTilerFactory # noqa From 27f8f6eefbeb1ef24703f0672c2e1c5b64d94a52 Mon Sep 17 00:00:00 2001 From: Jason Giancono Date: Mon, 8 Jan 2024 22:43:53 +0800 Subject: [PATCH 04/32] fix template loading for starlette >= 0.28 (#744) * fix template loading for starlette >= 0.28 * update from main and set fastapi version to >=0.107.0 --------- Co-authored-by: vincentsarago --- CHANGES.md | 14 ++++++++++++++ .../application/titiler/application/main.py | 11 ++++++----- src/titiler/core/pyproject.toml | 2 +- src/titiler/core/titiler/core/factory.py | 9 ++++----- .../extensions/titiler/extensions/viewer.py | 8 ++++---- src/titiler/extensions/titiler/extensions/wms.py | 9 ++++----- 6 files changed, 33 insertions(+), 20 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a67e29dd2..a37c64868 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,19 @@ # Release Notes +## Unreleased + +### titiler.core + +* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument + +### titiler.extensions + +* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument + +### titiler.application + +* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument + ## 0.15.7 (2024-01-08) ### titiler.core diff --git a/src/titiler/application/titiler/application/main.py b/src/titiler/application/titiler/application/main.py index 8e81fddca..e85fdf180 100644 --- a/src/titiler/application/titiler/application/main.py +++ b/src/titiler/application/titiler/application/main.py @@ -40,10 +40,10 @@ logging.getLogger("botocore.utils").disabled = True logging.getLogger("rio-tiler").setLevel(logging.ERROR) -templates = Jinja2Templates( - directory="", - loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]), -) # type:ignore +jinja2_env = jinja2.Environment( + loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]) +) +templates = Jinja2Templates(env=jinja2_env) api_settings = ApiSettings() @@ -56,7 +56,8 @@ def validate_access_token(access_token: str = Security(api_key_query)): """Validates API key access token, set as the `api_settings.global_access_token` value. Returns True if no access token is required, or if the access token is valid. - Raises an HTTPException (401) if the access token is required but invalid/missing.""" + Raises an HTTPException (401) if the access token is required but invalid/missing. + """ if api_settings.global_access_token is None: return True diff --git a/src/titiler/core/pyproject.toml b/src/titiler/core/pyproject.toml index 81cdb8c44..745728746 100644 --- a/src/titiler/core/pyproject.toml +++ b/src/titiler/core/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "fastapi>=0.100.0,<0.107.0", + "fastapi>=0.107.0", "geojson-pydantic>=1.0,<2.0", "jinja2>=2.11.2,<4.0.0", "numpy", diff --git a/src/titiler/core/titiler/core/factory.py b/src/titiler/core/titiler/core/factory.py index 8ce191498..e3295f58f 100644 --- a/src/titiler/core/titiler/core/factory.py +++ b/src/titiler/core/titiler/core/factory.py @@ -70,11 +70,10 @@ from titiler.core.routing import EndpointScope from titiler.core.utils import render_image -DEFAULT_TEMPLATES = Jinja2Templates( - directory="", - loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]), -) # type:ignore - +jinja2_env = jinja2.Environment( + loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]) +) +DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env) img_endpoint_params: Dict[str, Any] = { "responses": { diff --git a/src/titiler/extensions/titiler/extensions/viewer.py b/src/titiler/extensions/titiler/extensions/viewer.py index cdd14192b..48838de12 100644 --- a/src/titiler/extensions/titiler/extensions/viewer.py +++ b/src/titiler/extensions/titiler/extensions/viewer.py @@ -9,10 +9,10 @@ from titiler.core.factory import BaseTilerFactory, FactoryExtension -DEFAULT_TEMPLATES = Jinja2Templates( - directory="", - loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]), -) # type:ignore +jinja2_env = jinja2.Environment( + loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]) +) +DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env) @dataclass diff --git a/src/titiler/extensions/titiler/extensions/wms.py b/src/titiler/extensions/titiler/extensions/wms.py index 76fc37ab1..6b59ed2a0 100644 --- a/src/titiler/extensions/titiler/extensions/wms.py +++ b/src/titiler/extensions/titiler/extensions/wms.py @@ -22,10 +22,10 @@ from titiler.core.resources.enums import ImageType, MediaType from titiler.core.utils import render_image -DEFAULT_TEMPLATES = Jinja2Templates( - directory="", - loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]), -) # type:ignore +jinja2_env = jinja2.Environment( + loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]) +) +DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env) class WMSMediaType(str, Enum): @@ -522,7 +522,6 @@ def _reader(src_path: str): return image, format, transparent if request_type.lower() == "getmap": - # List of required parameters (styles and crs are excluded) req_keys = { "version", From 691b13d4510aa15c5a7db1d8c85b4579547a4472 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 15:52:40 +0100 Subject: [PATCH 05/32] update changelog --- CHANGES.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a37c64868..9458fde6d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,21 +4,22 @@ ### titiler.core -* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument +* update FastAPI version lower limit to `>=0.107.0` +* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744) ### titiler.extensions -* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument +* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744) ### titiler.application -* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument +* fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744) ## 0.15.7 (2024-01-08) ### titiler.core -* update FastAPI version upper limit to `0.107.0` to avoid starlette breaking change (`0.28`) +* update FastAPI version upper limit to `<0.107.0` to avoid starlette breaking change (`0.28`) ### titiler.application From 936a0b9d1dbdbb0f6e08336050141fa896a629b3 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 15:57:54 +0100 Subject: [PATCH 06/32] release date --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9458fde6d..61b5045a3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Release Notes -## Unreleased +## 0.16.0 (2024-01-08) ### titiler.core From 3c17f83af4d63e850c2a9cffe4ac1c7446914709 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 15:58:05 +0100 Subject: [PATCH 07/32] =?UTF-8?q?Bump=20version:=200.15.7=20=E2=86=92=200.?= =?UTF-8?q?16.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- deployment/aws/lambda/Dockerfile | 2 +- deployment/k8s/charts/Chart.yaml | 2 +- pyproject.toml | 10 +++++----- src/titiler/application/pyproject.toml | 6 +++--- .../application/titiler/application/__init__.py | 2 +- src/titiler/core/titiler/core/__init__.py | 2 +- src/titiler/extensions/pyproject.toml | 2 +- src/titiler/extensions/titiler/extensions/__init__.py | 2 +- src/titiler/mosaic/pyproject.toml | 2 +- src/titiler/mosaic/titiler/mosaic/__init__.py | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 96d2a13a8..61a10344b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.15.7 +current_version = 0.16.0 commit = True tag = True tag_name = {new_version} diff --git a/deployment/aws/lambda/Dockerfile b/deployment/aws/lambda/Dockerfile index 9d39994bb..8d759b404 100644 --- a/deployment/aws/lambda/Dockerfile +++ b/deployment/aws/lambda/Dockerfile @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} WORKDIR /tmp RUN pip install pip -U -RUN pip install "titiler.application==0.15.7" "mangum>=0.10.0" -t /asset --no-binary pydantic +RUN pip install "titiler.application==0.16.0" "mangum>=0.10.0" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; diff --git a/deployment/k8s/charts/Chart.yaml b/deployment/k8s/charts/Chart.yaml index 366c68535..3edf83691 100644 --- a/deployment/k8s/charts/Chart.yaml +++ b/deployment/k8s/charts/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.15.7 +appVersion: 0.16.0 description: A dynamic Web Map tile server name: titiler version: 1.1.2 diff --git a/pyproject.toml b/pyproject.toml index e62a0f318..a6c50fb34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: GIS", ] -version="0.15.7" +version="0.16.0" dependencies = [ - "titiler.core==0.15.7", - "titiler.extensions==0.15.7", - "titiler.mosaic==0.15.7", - "titiler.application==0.15.7", + "titiler.core==0.16.0", + "titiler.extensions==0.16.0", + "titiler.mosaic==0.16.0", + "titiler.application==0.16.0", ] [project.optional-dependencies] diff --git a/src/titiler/application/pyproject.toml b/src/titiler/application/pyproject.toml index ac1bebf84..1cb2a8bae 100644 --- a/src/titiler/application/pyproject.toml +++ b/src/titiler/application/pyproject.toml @@ -29,9 +29,9 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.15.7", - "titiler.extensions[cogeo,stac]==0.15.7", - "titiler.mosaic==0.15.7", + "titiler.core==0.16.0", + "titiler.extensions[cogeo,stac]==0.16.0", + "titiler.mosaic==0.16.0", "starlette-cramjam>=0.3,<0.4", "pydantic-settings~=2.0", ] diff --git a/src/titiler/application/titiler/application/__init__.py b/src/titiler/application/titiler/application/__init__.py index ab2979b5d..4966e22d7 100644 --- a/src/titiler/application/titiler/application/__init__.py +++ b/src/titiler/application/titiler/application/__init__.py @@ -1,3 +1,3 @@ """titiler.application""" -__version__ = "0.15.7" +__version__ = "0.16.0" diff --git a/src/titiler/core/titiler/core/__init__.py b/src/titiler/core/titiler/core/__init__.py index 72ecf3cac..d577c7be4 100644 --- a/src/titiler/core/titiler/core/__init__.py +++ b/src/titiler/core/titiler/core/__init__.py @@ -1,6 +1,6 @@ """titiler.core""" -__version__ = "0.15.7" +__version__ = "0.16.0" from . import dependencies, errors, factory, routing # noqa from .factory import ( # noqa diff --git a/src/titiler/extensions/pyproject.toml b/src/titiler/extensions/pyproject.toml index 20973221f..f5678ed7e 100644 --- a/src/titiler/extensions/pyproject.toml +++ b/src/titiler/extensions/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.15.7" + "titiler.core==0.16.0" ] [project.optional-dependencies] diff --git a/src/titiler/extensions/titiler/extensions/__init__.py b/src/titiler/extensions/titiler/extensions/__init__.py index e61611701..50bdc39df 100644 --- a/src/titiler/extensions/titiler/extensions/__init__.py +++ b/src/titiler/extensions/titiler/extensions/__init__.py @@ -1,6 +1,6 @@ """titiler.extensions""" -__version__ = "0.15.7" +__version__ = "0.16.0" from .cogeo import cogValidateExtension # noqa from .stac import stacExtension # noqa diff --git a/src/titiler/mosaic/pyproject.toml b/src/titiler/mosaic/pyproject.toml index 1fbc77d9e..f40ab43d1 100644 --- a/src/titiler/mosaic/pyproject.toml +++ b/src/titiler/mosaic/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.15.7", + "titiler.core==0.16.0", "cogeo-mosaic>=7.0,<8.0", ] diff --git a/src/titiler/mosaic/titiler/mosaic/__init__.py b/src/titiler/mosaic/titiler/mosaic/__init__.py index 050b058f0..ae7f40967 100644 --- a/src/titiler/mosaic/titiler/mosaic/__init__.py +++ b/src/titiler/mosaic/titiler/mosaic/__init__.py @@ -1,6 +1,6 @@ """titiler.mosaic""" -__version__ = "0.15.7" +__version__ = "0.16.0" from . import errors, factory # noqa from .factory import MosaicTilerFactory # noqa From 2bd03046fa2c18cd308e348f9632e99bfb1d6c36 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 20:45:12 +0100 Subject: [PATCH 08/32] fix issue with deprecated morecantile method --- CHANGES.md | 10 ++++++++++ src/titiler/core/titiler/core/factory.py | 2 +- src/titiler/mosaic/titiler/mosaic/factory.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 61b5045a3..cbe17b8b4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,15 @@ # Release Notes +## 0.16.1 (2024-01-08) + +### titiler.core + +* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method + +### titiler.mosaic + +* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method + ## 0.16.0 (2024-01-08) ### titiler.core diff --git a/src/titiler/core/titiler/core/factory.py b/src/titiler/core/titiler/core/factory.py index e3295f58f..ccab84b8c 100644 --- a/src/titiler/core/titiler/core/factory.py +++ b/src/titiler/core/titiler/core/factory.py @@ -740,7 +740,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", ) diff --git a/src/titiler/mosaic/titiler/mosaic/factory.py b/src/titiler/mosaic/titiler/mosaic/factory.py index 60cab4d89..52f83f1aa 100644 --- a/src/titiler/mosaic/titiler/mosaic/factory.py +++ b/src/titiler/mosaic/titiler/mosaic/factory.py @@ -505,7 +505,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", ) From 81bea67b8c879620ac57a77cbe4b3155f0b5c548 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 21:08:19 +0100 Subject: [PATCH 09/32] =?UTF-8?q?Bump=20version:=200.16.0=20=E2=86=92=200.?= =?UTF-8?q?16.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- deployment/aws/lambda/Dockerfile | 2 +- deployment/k8s/charts/Chart.yaml | 2 +- pyproject.toml | 10 +++++----- src/titiler/application/pyproject.toml | 6 +++--- .../application/titiler/application/__init__.py | 2 +- src/titiler/core/titiler/core/__init__.py | 2 +- src/titiler/extensions/pyproject.toml | 2 +- src/titiler/extensions/titiler/extensions/__init__.py | 2 +- src/titiler/mosaic/pyproject.toml | 2 +- src/titiler/mosaic/titiler/mosaic/__init__.py | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 61a10344b..f17fdef69 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.16.0 +current_version = 0.16.1 commit = True tag = True tag_name = {new_version} diff --git a/deployment/aws/lambda/Dockerfile b/deployment/aws/lambda/Dockerfile index 8d759b404..8d5eb66c5 100644 --- a/deployment/aws/lambda/Dockerfile +++ b/deployment/aws/lambda/Dockerfile @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} WORKDIR /tmp RUN pip install pip -U -RUN pip install "titiler.application==0.16.0" "mangum>=0.10.0" -t /asset --no-binary pydantic +RUN pip install "titiler.application==0.16.1" "mangum>=0.10.0" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; diff --git a/deployment/k8s/charts/Chart.yaml b/deployment/k8s/charts/Chart.yaml index 3edf83691..fe7c5bcaa 100644 --- a/deployment/k8s/charts/Chart.yaml +++ b/deployment/k8s/charts/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.16.0 +appVersion: 0.16.1 description: A dynamic Web Map tile server name: titiler version: 1.1.2 diff --git a/pyproject.toml b/pyproject.toml index a6c50fb34..7e105647d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: GIS", ] -version="0.16.0" +version="0.16.1" dependencies = [ - "titiler.core==0.16.0", - "titiler.extensions==0.16.0", - "titiler.mosaic==0.16.0", - "titiler.application==0.16.0", + "titiler.core==0.16.1", + "titiler.extensions==0.16.1", + "titiler.mosaic==0.16.1", + "titiler.application==0.16.1", ] [project.optional-dependencies] diff --git a/src/titiler/application/pyproject.toml b/src/titiler/application/pyproject.toml index 1cb2a8bae..1195ab4ce 100644 --- a/src/titiler/application/pyproject.toml +++ b/src/titiler/application/pyproject.toml @@ -29,9 +29,9 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.0", - "titiler.extensions[cogeo,stac]==0.16.0", - "titiler.mosaic==0.16.0", + "titiler.core==0.16.1", + "titiler.extensions[cogeo,stac]==0.16.1", + "titiler.mosaic==0.16.1", "starlette-cramjam>=0.3,<0.4", "pydantic-settings~=2.0", ] diff --git a/src/titiler/application/titiler/application/__init__.py b/src/titiler/application/titiler/application/__init__.py index 4966e22d7..4333026e9 100644 --- a/src/titiler/application/titiler/application/__init__.py +++ b/src/titiler/application/titiler/application/__init__.py @@ -1,3 +1,3 @@ """titiler.application""" -__version__ = "0.16.0" +__version__ = "0.16.1" diff --git a/src/titiler/core/titiler/core/__init__.py b/src/titiler/core/titiler/core/__init__.py index d577c7be4..12395e78f 100644 --- a/src/titiler/core/titiler/core/__init__.py +++ b/src/titiler/core/titiler/core/__init__.py @@ -1,6 +1,6 @@ """titiler.core""" -__version__ = "0.16.0" +__version__ = "0.16.1" from . import dependencies, errors, factory, routing # noqa from .factory import ( # noqa diff --git a/src/titiler/extensions/pyproject.toml b/src/titiler/extensions/pyproject.toml index f5678ed7e..67c251c63 100644 --- a/src/titiler/extensions/pyproject.toml +++ b/src/titiler/extensions/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.0" + "titiler.core==0.16.1" ] [project.optional-dependencies] diff --git a/src/titiler/extensions/titiler/extensions/__init__.py b/src/titiler/extensions/titiler/extensions/__init__.py index 50bdc39df..7e5d880d1 100644 --- a/src/titiler/extensions/titiler/extensions/__init__.py +++ b/src/titiler/extensions/titiler/extensions/__init__.py @@ -1,6 +1,6 @@ """titiler.extensions""" -__version__ = "0.16.0" +__version__ = "0.16.1" from .cogeo import cogValidateExtension # noqa from .stac import stacExtension # noqa diff --git a/src/titiler/mosaic/pyproject.toml b/src/titiler/mosaic/pyproject.toml index f40ab43d1..5e1e8028a 100644 --- a/src/titiler/mosaic/pyproject.toml +++ b/src/titiler/mosaic/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.0", + "titiler.core==0.16.1", "cogeo-mosaic>=7.0,<8.0", ] diff --git a/src/titiler/mosaic/titiler/mosaic/__init__.py b/src/titiler/mosaic/titiler/mosaic/__init__.py index ae7f40967..314e2f30a 100644 --- a/src/titiler/mosaic/titiler/mosaic/__init__.py +++ b/src/titiler/mosaic/titiler/mosaic/__init__.py @@ -1,6 +1,6 @@ """titiler.mosaic""" -__version__ = "0.16.0" +__version__ = "0.16.1" from . import errors, factory # noqa from .factory import MosaicTilerFactory # noqa From e396959e7f818909a5494301a809b5f795aa202e Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 8 Jan 2024 21:41:39 +0100 Subject: [PATCH 10/32] update changelog --- CHANGES.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index cbe17b8b4..dd914aeaa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -25,6 +25,16 @@ * fix template loading for starlette >= 0.28 by using `jinja2.Environment` argument (author @jasongi, https://github.com/developmentseed/titiler/pull/744) +## 0.15.8 (2024-01-08) + +### titiler.core + +* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method [backported from 0.16.1] + +### titiler.mosaic + +* use morecantile `TileMatrixSet.cellSize` property instead of deprecated/private `TileMatrixSet._resolution` method [backported from 0.16.1] + ## 0.15.7 (2024-01-08) ### titiler.core From ef5caf9e4736427b8b6c303d4bcc8439a28a921b Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 10 Jan 2024 15:04:32 +0000 Subject: [PATCH 11/32] Fix leafletjs template maxZoom to great than 18 zoom (#749) --- src/titiler/core/titiler/core/templates/map.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/titiler/core/titiler/core/templates/map.html b/src/titiler/core/titiler/core/templates/map.html index 5aac27d8b..5c4f284c0 100644 --- a/src/titiler/core/titiler/core/templates/map.html +++ b/src/titiler/core/titiler/core/templates/map.html @@ -113,7 +113,7 @@ L.tileLayer( data.tiles[0], { minZoom: data.minzoom, - maxNativeZoom: data.maxzoom, + maxZoom: data.maxzoom, bounds: L.latLngBounds([bottom, left], [top, right]), } ).addTo(map); From b66f228c7809b8706addf22508d7d4589ecfdb15 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 10 Jan 2024 16:36:35 +0100 Subject: [PATCH 12/32] update changelog --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index dd914aeaa..d74fabfa7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Release Notes +## Unreleased + +### titiler.core + +* fix leafletjs template maxZoom to great than 18 for `/map` endpoint (author @Firefishy, https://github.com/developmentseed/titiler/pull/749) + ## 0.16.1 (2024-01-08) ### titiler.core From 9388311ed899921c08484e7a07ae35dd44734eb0 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 17 Jan 2024 09:50:47 +0100 Subject: [PATCH 13/32] update changelog --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d74fabfa7..1bf050491 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Release Notes -## Unreleased +## 0.16.2 (2024-01-17) ### titiler.core From 41fea96f029e3b18a5158a1ceb0a0fe85b611680 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 17 Jan 2024 09:50:52 +0100 Subject: [PATCH 14/32] =?UTF-8?q?Bump=20version:=200.16.1=20=E2=86=92=200.?= =?UTF-8?q?16.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- deployment/aws/lambda/Dockerfile | 2 +- deployment/k8s/charts/Chart.yaml | 2 +- pyproject.toml | 10 +++++----- src/titiler/application/pyproject.toml | 6 +++--- .../application/titiler/application/__init__.py | 2 +- src/titiler/core/titiler/core/__init__.py | 2 +- src/titiler/extensions/pyproject.toml | 2 +- src/titiler/extensions/titiler/extensions/__init__.py | 2 +- src/titiler/mosaic/pyproject.toml | 2 +- src/titiler/mosaic/titiler/mosaic/__init__.py | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f17fdef69..9fd4fc7f9 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.16.1 +current_version = 0.16.2 commit = True tag = True tag_name = {new_version} diff --git a/deployment/aws/lambda/Dockerfile b/deployment/aws/lambda/Dockerfile index 8d5eb66c5..fff81b40a 100644 --- a/deployment/aws/lambda/Dockerfile +++ b/deployment/aws/lambda/Dockerfile @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} WORKDIR /tmp RUN pip install pip -U -RUN pip install "titiler.application==0.16.1" "mangum>=0.10.0" -t /asset --no-binary pydantic +RUN pip install "titiler.application==0.16.2" "mangum>=0.10.0" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; diff --git a/deployment/k8s/charts/Chart.yaml b/deployment/k8s/charts/Chart.yaml index fe7c5bcaa..ad7768147 100644 --- a/deployment/k8s/charts/Chart.yaml +++ b/deployment/k8s/charts/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.16.1 +appVersion: 0.16.2 description: A dynamic Web Map tile server name: titiler version: 1.1.2 diff --git a/pyproject.toml b/pyproject.toml index 7e105647d..2fbf44780 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: GIS", ] -version="0.16.1" +version="0.16.2" dependencies = [ - "titiler.core==0.16.1", - "titiler.extensions==0.16.1", - "titiler.mosaic==0.16.1", - "titiler.application==0.16.1", + "titiler.core==0.16.2", + "titiler.extensions==0.16.2", + "titiler.mosaic==0.16.2", + "titiler.application==0.16.2", ] [project.optional-dependencies] diff --git a/src/titiler/application/pyproject.toml b/src/titiler/application/pyproject.toml index 1195ab4ce..3206e11e7 100644 --- a/src/titiler/application/pyproject.toml +++ b/src/titiler/application/pyproject.toml @@ -29,9 +29,9 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.1", - "titiler.extensions[cogeo,stac]==0.16.1", - "titiler.mosaic==0.16.1", + "titiler.core==0.16.2", + "titiler.extensions[cogeo,stac]==0.16.2", + "titiler.mosaic==0.16.2", "starlette-cramjam>=0.3,<0.4", "pydantic-settings~=2.0", ] diff --git a/src/titiler/application/titiler/application/__init__.py b/src/titiler/application/titiler/application/__init__.py index 4333026e9..a3aabef7f 100644 --- a/src/titiler/application/titiler/application/__init__.py +++ b/src/titiler/application/titiler/application/__init__.py @@ -1,3 +1,3 @@ """titiler.application""" -__version__ = "0.16.1" +__version__ = "0.16.2" diff --git a/src/titiler/core/titiler/core/__init__.py b/src/titiler/core/titiler/core/__init__.py index 12395e78f..c3d53b140 100644 --- a/src/titiler/core/titiler/core/__init__.py +++ b/src/titiler/core/titiler/core/__init__.py @@ -1,6 +1,6 @@ """titiler.core""" -__version__ = "0.16.1" +__version__ = "0.16.2" from . import dependencies, errors, factory, routing # noqa from .factory import ( # noqa diff --git a/src/titiler/extensions/pyproject.toml b/src/titiler/extensions/pyproject.toml index 67c251c63..2da99a3fc 100644 --- a/src/titiler/extensions/pyproject.toml +++ b/src/titiler/extensions/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.1" + "titiler.core==0.16.2" ] [project.optional-dependencies] diff --git a/src/titiler/extensions/titiler/extensions/__init__.py b/src/titiler/extensions/titiler/extensions/__init__.py index 7e5d880d1..d02184673 100644 --- a/src/titiler/extensions/titiler/extensions/__init__.py +++ b/src/titiler/extensions/titiler/extensions/__init__.py @@ -1,6 +1,6 @@ """titiler.extensions""" -__version__ = "0.16.1" +__version__ = "0.16.2" from .cogeo import cogValidateExtension # noqa from .stac import stacExtension # noqa diff --git a/src/titiler/mosaic/pyproject.toml b/src/titiler/mosaic/pyproject.toml index 5e1e8028a..ceddc53c9 100644 --- a/src/titiler/mosaic/pyproject.toml +++ b/src/titiler/mosaic/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.1", + "titiler.core==0.16.2", "cogeo-mosaic>=7.0,<8.0", ] diff --git a/src/titiler/mosaic/titiler/mosaic/__init__.py b/src/titiler/mosaic/titiler/mosaic/__init__.py index 314e2f30a..23fb3e83c 100644 --- a/src/titiler/mosaic/titiler/mosaic/__init__.py +++ b/src/titiler/mosaic/titiler/mosaic/__init__.py @@ -1,6 +1,6 @@ """titiler.mosaic""" -__version__ = "0.16.1" +__version__ = "0.16.2" from . import errors, factory # noqa from .factory import MosaicTilerFactory # noqa From 993af6cc8971fbc5dab4c292a5b4776f43b7915a Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Wed, 17 Jan 2024 10:15:52 +0100 Subject: [PATCH 15/32] update rio-tiler version and use new options for better statistics (#754) --- CHANGES.md | 7 +++++++ src/titiler/core/pyproject.toml | 2 +- src/titiler/core/titiler/core/factory.py | 9 ++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1bf050491..8e0ef610b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # Release Notes +## 0.17.0 (2024-01-17) + +### titiler.core + +* update `rio-tiler` version to `>6.3.0` +* use new `align_bounds_with_dataset=True` rio-tiler option in GeoJSON statistics methods for more precise calculation + ## 0.16.2 (2024-01-17) ### titiler.core diff --git a/src/titiler/core/pyproject.toml b/src/titiler/core/pyproject.toml index 745728746..4101793dc 100644 --- a/src/titiler/core/pyproject.toml +++ b/src/titiler/core/pyproject.toml @@ -35,7 +35,7 @@ dependencies = [ "numpy", "pydantic~=2.0", "rasterio", - "rio-tiler>=6.2.5,<7.0", + "rio-tiler>=6.3.0,<7.0", "morecantile>=5.0,<6.0", "simplejson", "typing_extensions>=4.6.1", diff --git a/src/titiler/core/titiler/core/factory.py b/src/titiler/core/titiler/core/factory.py index ccab84b8c..6fcf0b282 100644 --- a/src/titiler/core/titiler/core/factory.py +++ b/src/titiler/core/titiler/core/factory.py @@ -437,7 +437,7 @@ def statistics( response_class=GeoJSONResponse, responses={ 200: { - "content": {"application/json": {}}, + "content": {"application/geo+json": {}}, "description": "Return dataset's statistics from feature or featureCollection.", } }, @@ -472,6 +472,7 @@ def geojson_statistics( shape, shape_crs=coord_crs or WGS84_CRS, dst_crs=dst_crs, + align_bounds_with_dataset=True, **layer_params, **image_params, **dataset_params, @@ -1270,7 +1271,7 @@ def statistics( response_class=GeoJSONResponse, responses={ 200: { - "content": {"application/json": {}}, + "content": {"application/geo+json": {}}, "description": "Return dataset's statistics from feature or featureCollection.", } }, @@ -1308,6 +1309,7 @@ def geojson_statistics( feature.model_dump(exclude_none=True), shape_crs=coord_crs or WGS84_CRS, dst_crs=dst_crs, + align_bounds_with_dataset=True, **layer_params, **image_params, **dataset_params, @@ -1471,7 +1473,7 @@ def statistics( response_class=GeoJSONResponse, responses={ 200: { - "content": {"application/json": {}}, + "content": {"application/geo+json": {}}, "description": "Return dataset's statistics from feature or featureCollection.", } }, @@ -1509,6 +1511,7 @@ def geojson_statistics( feature.model_dump(exclude_none=True), shape_crs=coord_crs or WGS84_CRS, dst_crs=dst_crs, + align_bounds_with_dataset=True, **bands_params, **image_params, **dataset_params, From a6af70307bd29ad5f4b48adc59dab99c5e7391a5 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 17 Jan 2024 11:07:20 +0100 Subject: [PATCH 16/32] fix packaging --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2fbf44780..278fe6567 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,7 @@ exclude = [ ] [build-system] -requires = ["hatchling"] +requires = ["hatchling>=1.12.0"] build-backend = "hatchling.build" [tool.coverage.run] @@ -132,3 +132,6 @@ explicit_package_bases = true filterwarnings = [ "ignore::rasterio.errors.NotGeoreferencedWarning", ] + +[tool.hatch.build.targets.wheel] +bypass-selection = true From 34ff283bb755ac8ed4c12a71311b80cba9724eaf Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 17 Jan 2024 11:27:31 +0100 Subject: [PATCH 17/32] =?UTF-8?q?Bump=20version:=200.16.2=20=E2=86=92=200.?= =?UTF-8?q?17.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- deployment/aws/lambda/Dockerfile | 2 +- deployment/k8s/charts/Chart.yaml | 2 +- pyproject.toml | 10 +++++----- src/titiler/application/pyproject.toml | 6 +++--- .../application/titiler/application/__init__.py | 2 +- src/titiler/core/titiler/core/__init__.py | 2 +- src/titiler/extensions/pyproject.toml | 2 +- src/titiler/extensions/titiler/extensions/__init__.py | 2 +- src/titiler/mosaic/pyproject.toml | 2 +- src/titiler/mosaic/titiler/mosaic/__init__.py | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9fd4fc7f9..d8501cc0f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.16.2 +current_version = 0.17.0 commit = True tag = True tag_name = {new_version} diff --git a/deployment/aws/lambda/Dockerfile b/deployment/aws/lambda/Dockerfile index fff81b40a..98751b851 100644 --- a/deployment/aws/lambda/Dockerfile +++ b/deployment/aws/lambda/Dockerfile @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} WORKDIR /tmp RUN pip install pip -U -RUN pip install "titiler.application==0.16.2" "mangum>=0.10.0" -t /asset --no-binary pydantic +RUN pip install "titiler.application==0.17.0" "mangum>=0.10.0" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; diff --git a/deployment/k8s/charts/Chart.yaml b/deployment/k8s/charts/Chart.yaml index ad7768147..6b5dbe9b6 100644 --- a/deployment/k8s/charts/Chart.yaml +++ b/deployment/k8s/charts/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.16.2 +appVersion: 0.17.0 description: A dynamic Web Map tile server name: titiler version: 1.1.2 diff --git a/pyproject.toml b/pyproject.toml index 278fe6567..0348f988f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: GIS", ] -version="0.16.2" +version="0.17.0" dependencies = [ - "titiler.core==0.16.2", - "titiler.extensions==0.16.2", - "titiler.mosaic==0.16.2", - "titiler.application==0.16.2", + "titiler.core==0.17.0", + "titiler.extensions==0.17.0", + "titiler.mosaic==0.17.0", + "titiler.application==0.17.0", ] [project.optional-dependencies] diff --git a/src/titiler/application/pyproject.toml b/src/titiler/application/pyproject.toml index 3206e11e7..0bc96a660 100644 --- a/src/titiler/application/pyproject.toml +++ b/src/titiler/application/pyproject.toml @@ -29,9 +29,9 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.2", - "titiler.extensions[cogeo,stac]==0.16.2", - "titiler.mosaic==0.16.2", + "titiler.core==0.17.0", + "titiler.extensions[cogeo,stac]==0.17.0", + "titiler.mosaic==0.17.0", "starlette-cramjam>=0.3,<0.4", "pydantic-settings~=2.0", ] diff --git a/src/titiler/application/titiler/application/__init__.py b/src/titiler/application/titiler/application/__init__.py index a3aabef7f..dd13b697c 100644 --- a/src/titiler/application/titiler/application/__init__.py +++ b/src/titiler/application/titiler/application/__init__.py @@ -1,3 +1,3 @@ """titiler.application""" -__version__ = "0.16.2" +__version__ = "0.17.0" diff --git a/src/titiler/core/titiler/core/__init__.py b/src/titiler/core/titiler/core/__init__.py index c3d53b140..add491ed5 100644 --- a/src/titiler/core/titiler/core/__init__.py +++ b/src/titiler/core/titiler/core/__init__.py @@ -1,6 +1,6 @@ """titiler.core""" -__version__ = "0.16.2" +__version__ = "0.17.0" from . import dependencies, errors, factory, routing # noqa from .factory import ( # noqa diff --git a/src/titiler/extensions/pyproject.toml b/src/titiler/extensions/pyproject.toml index 2da99a3fc..0794f458a 100644 --- a/src/titiler/extensions/pyproject.toml +++ b/src/titiler/extensions/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.2" + "titiler.core==0.17.0" ] [project.optional-dependencies] diff --git a/src/titiler/extensions/titiler/extensions/__init__.py b/src/titiler/extensions/titiler/extensions/__init__.py index d02184673..34337934b 100644 --- a/src/titiler/extensions/titiler/extensions/__init__.py +++ b/src/titiler/extensions/titiler/extensions/__init__.py @@ -1,6 +1,6 @@ """titiler.extensions""" -__version__ = "0.16.2" +__version__ = "0.17.0" from .cogeo import cogValidateExtension # noqa from .stac import stacExtension # noqa diff --git a/src/titiler/mosaic/pyproject.toml b/src/titiler/mosaic/pyproject.toml index ceddc53c9..82d3b26d3 100644 --- a/src/titiler/mosaic/pyproject.toml +++ b/src/titiler/mosaic/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "titiler.core==0.16.2", + "titiler.core==0.17.0", "cogeo-mosaic>=7.0,<8.0", ] diff --git a/src/titiler/mosaic/titiler/mosaic/__init__.py b/src/titiler/mosaic/titiler/mosaic/__init__.py index 23fb3e83c..4391812ed 100644 --- a/src/titiler/mosaic/titiler/mosaic/__init__.py +++ b/src/titiler/mosaic/titiler/mosaic/__init__.py @@ -1,6 +1,6 @@ """titiler.mosaic""" -__version__ = "0.16.2" +__version__ = "0.17.0" from . import errors, factory # noqa from .factory import MosaicTilerFactory # noqa From 70c18b344ef4a8c6e3e83a5bf225cb4047c1bd30 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Fri, 19 Jan 2024 18:47:51 +0100 Subject: [PATCH 18/32] better handle URL path when app if proxied --- CHANGES.md | 6 ++++++ src/titiler/application/titiler/application/main.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 8e0ef610b..9c588574e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Release Notes +## Unreleased + +### titiler.application + +* fix invalid url parsing in HTML responses + ## 0.17.0 (2024-01-17) ### titiler.core diff --git a/src/titiler/application/titiler/application/main.py b/src/titiler/application/titiler/application/main.py index e85fdf180..522088c63 100644 --- a/src/titiler/application/titiler/application/main.py +++ b/src/titiler/application/titiler/application/main.py @@ -1,6 +1,7 @@ """titiler app.""" import logging +import re import jinja2 from fastapi import Depends, FastAPI, HTTPException, Security @@ -245,6 +246,8 @@ 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("/") From b43bb84453ee06321c49d41c169a3083a6ab95e2 Mon Sep 17 00:00:00 2001 From: Chris Bateman Date: Tue, 30 Jan 2024 19:03:16 +1100 Subject: [PATCH 19/32] Update Checkout to v4 (#761) --- .github/workflows/benchmark.yml | 2 +- .github/workflows/check_charts.yaml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/deploy_mkdocs.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b92311196..902c3394e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install siege run: | diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index e79f20937..a95db7e07 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d44a4ef80..7a3e7328f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -77,7 +77,7 @@ jobs: runs-on: ubuntu-latest if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v1 with: @@ -112,7 +112,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -201,7 +201,7 @@ jobs: working-directory: deployment/aws steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Let's wait a bit to make sure Pypi is up to date - name: Sleep for 120 seconds diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index 0781cc394..e0393c26a 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout main - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python 3.8 uses: actions/setup-python@v2 From 4bbc753a1daba1f1b006f44d011dd271da8bc515 Mon Sep 17 00:00:00 2001 From: Chris Bateman Date: Wed, 31 Jan 2024 22:39:51 +1100 Subject: [PATCH 20/32] add dependabot (#764) --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..dfd0e3086 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# Set update schedule for GitHub Actions + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" From c66dff2fb34f189f168fbbb489f69b51bf7b8b14 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 31 Jan 2024 12:50:55 +0100 Subject: [PATCH 21/32] group dependabots --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dfd0e3086..4fa1bd99b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,7 @@ updates: schedule: # Check for updates to GitHub Actions every week interval: "weekly" + groups: + all: + patterns: + - "*" From db8af9d268473d26984dc39b690e8320e9c653aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:56:08 +0100 Subject: [PATCH 22/32] Bump the all group with 11 updates (#770) Bumps the all group with 11 updates: | Package | From | To | | --- | --- | --- | | [azure/setup-helm](https://github.com/azure/setup-helm) | `1` | `3` | | [actions/setup-python](https://github.com/actions/setup-python) | `1` | `5` | | [helm/chart-testing-action](https://github.com/helm/chart-testing-action) | `2.2.1` | `2.6.1` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `2` | `5` | | [helm/kind-action](https://github.com/helm/kind-action) | `1.2.0` | `1.8.0` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `1` | `3` | | [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `1` | `3` | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `1` | `3` | | [docker/login-action](https://github.com/docker/login-action) | `1` | `3` | | [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `1` | `4` | | [actions/setup-node](https://github.com/actions/setup-node) | `1` | `4` | Updates `azure/setup-helm` from 1 to 3 - [Release notes](https://github.com/azure/setup-helm/releases) - [Commits](https://github.com/azure/setup-helm/compare/v1...v3) Updates `actions/setup-python` from 1 to 5 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v1...v5) Updates `helm/chart-testing-action` from 2.2.1 to 2.6.1 - [Release notes](https://github.com/helm/chart-testing-action/releases) - [Commits](https://github.com/helm/chart-testing-action/compare/v2.2.1...v2.6.1) Updates `docker/build-push-action` from 2 to 5 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v2...v5) Updates `helm/kind-action` from 1.2.0 to 1.8.0 - [Release notes](https://github.com/helm/kind-action/releases) - [Commits](https://github.com/helm/kind-action/compare/v1.2.0...v1.8.0) Updates `codecov/codecov-action` from 1 to 3 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v1...v3) Updates `docker/setup-qemu-action` from 1 to 3 - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](https://github.com/docker/setup-qemu-action/compare/v1...v3) Updates `docker/setup-buildx-action` from 1 to 3 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v3) Updates `docker/login-action` from 1 to 3 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v1...v3) Updates `aws-actions/configure-aws-credentials` from 1 to 4 - [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases) - [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws-actions/configure-aws-credentials/compare/v1...v4) Updates `actions/setup-node` from 1 to 4 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v1...v4) --- updated-dependencies: - dependency-name: azure/setup-helm dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: helm/chart-testing-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: helm/kind-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: aws-actions/configure-aws-credentials dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_charts.yaml | 10 +++++----- .github/workflows/ci.yml | 28 ++++++++++++++-------------- .github/workflows/deploy_mkdocs.yml | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index a95db7e07..3024d130f 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -33,16 +33,16 @@ jobs: fi - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v3 with: version: v3.9.2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: python-version: 3.7 - name: Set up chart-testing - uses: helm/chart-testing-action@v2.2.1 + uses: helm/chart-testing-action@v2.6.1 - name: Run chart-testing (list-changed) id: list-changed @@ -56,7 +56,7 @@ jobs: run: ct lint --chart-dirs deployment/k8s --target-branch ${{ github.event.repository.default_branch }} - name: Build container - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 if: steps.list-changed.outputs.changed == 'true' with: # See https://github.com/developmentseed/titiler/discussions/387 @@ -67,7 +67,7 @@ jobs: tags: "titiler:dev" - name: Create kind cluster - uses: helm/kind-action@v1.2.0 + uses: helm/kind-action@v1.8.0 if: steps.list-changed.outputs.changed == 'true' - name: Load container image in kind cluster diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a3e7328f..009f5b6d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -65,7 +65,7 @@ jobs: - name: Upload Results if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: file: ./coverage.xml flags: unittests @@ -79,7 +79,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ env.LATEST_PY_VERSION }} @@ -115,19 +115,19 @@ jobs: uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to Github - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -141,7 +141,7 @@ jobs: # Push `latest` when commiting to main - name: Build and push uvicorn if: github.ref == 'refs/heads/main' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: # See https://github.com/developmentseed/titiler/discussions/387 platforms: linux/amd64 @@ -154,7 +154,7 @@ jobs: # Push `{VERSION}` when pushing a new tag - name: Build and push uvicorn if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: # See https://github.com/developmentseed/titiler/discussions/387 platforms: linux/amd64 @@ -168,7 +168,7 @@ jobs: # Push `latest` when commiting to main - name: Build and push if: github.ref == 'refs/heads/main' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: # See https://github.com/developmentseed/titiler/discussions/387 platforms: linux/amd64 @@ -181,7 +181,7 @@ jobs: # Push `{VERSION}` when pushing a new tag - name: Build and push if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: # See https://github.com/developmentseed/titiler/discussions/387 platforms: linux/amd64 @@ -209,14 +209,14 @@ jobs: shell: bash - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Set up Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: '14.x' @@ -224,7 +224,7 @@ jobs: run: npm install -g - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index e0393c26a..5a8928a04 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.8 From 8adc1ce23903e0e39103d1e9e0cee6265e7f73c9 Mon Sep 17 00:00:00 2001 From: Will Roper Date: Thu, 1 Feb 2024 22:05:38 +0000 Subject: [PATCH 23/32] Update custom tms code example (#771) --- docs/src/examples/code/tiler_with_custom_tms.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/src/examples/code/tiler_with_custom_tms.md b/docs/src/examples/code/tiler_with_custom_tms.md index eb4edacc1..0813dee9c 100644 --- a/docs/src/examples/code/tiler_with_custom_tms.md +++ b/docs/src/examples/code/tiler_with_custom_tms.md @@ -20,15 +20,14 @@ from pyproj import CRS EPSG6933 = TileMatrixSet.custom( (-17357881.81713629, -7324184.56362408, 17357881.81713629, 7324184.56362408), CRS.from_epsg(6933), - identifier="EPSG6933", + id="EPSG6933", matrix_scale=[1, 1], ) - # 2. Register TMS -tms = tms.register([EPSG6933]) +tms = tms.register({EPSG6933.id:EPSG6933}) -tms = TMSFactory(supported_tms=tms) -cog = TilerFactory(supported_tms=tms) +tms_factory = TMSFactory(supported_tms=tms) +cog_factory = TilerFactory(supported_tms=tms) ``` 2 - Create app and register our custom endpoints @@ -44,11 +43,11 @@ from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers from fastapi import FastAPI -from .routes import cog, tms +from .routes import cog_factory, tms_factory app = FastAPI(title="My simple app with custom TMS") -app.include_router(cog.router, tags=["Cloud Optimized GeoTIFF"]) -app.include_router(tms.router, tags=["Tiling Schemes"]) +app.include_router(cog_factory.router, tags=["Cloud Optimized GeoTIFF"]) +app.include_router(tms_factory.router, tags=["Tiling Schemes"]) add_exception_handlers(app, DEFAULT_STATUS_CODES) ``` From 60eabaa489b9d479fe713c6b173f1b069afac718 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:24:25 +0100 Subject: [PATCH 24/32] Bump the all group with 1 update (#774) Bumps the all group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action). Updates `codecov/codecov-action` from 3 to 4 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 009f5b6d1..cda4a1d6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - name: Upload Results if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml flags: unittests From 391fac366eca3c636dd9e67acc2e26f12aac66bd Mon Sep 17 00:00:00 2001 From: Leonid <44239176+robert-werner@users.noreply.github.com> Date: Thu, 15 Feb 2024 06:02:18 -0800 Subject: [PATCH 25/32] Update mosaic_from_urls.md (#779) --- docs/src/examples/code/mosaic_from_urls.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/examples/code/mosaic_from_urls.md b/docs/src/examples/code/mosaic_from_urls.md index 28f9e5913..211ed43b8 100644 --- a/docs/src/examples/code/mosaic_from_urls.md +++ b/docs/src/examples/code/mosaic_from_urls.md @@ -105,7 +105,7 @@ class MultiFilesBackend(BaseBackend): ```python """routes. -app/router.py +app/routers.py """ From cec144a299be1cff676878c30919a0c4cf528039 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:02:47 +0100 Subject: [PATCH 26/32] Bump the all group with 1 update (#778) Bumps the all group with 1 update: [helm/kind-action](https://github.com/helm/kind-action). Updates `helm/kind-action` from 1.8.0 to 1.9.0 - [Release notes](https://github.com/helm/kind-action/releases) - [Commits](https://github.com/helm/kind-action/compare/v1.8.0...v1.9.0) --- updated-dependencies: - dependency-name: helm/kind-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_charts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index 3024d130f..6c1a399f5 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -67,7 +67,7 @@ jobs: tags: "titiler:dev" - name: Create kind cluster - uses: helm/kind-action@v1.8.0 + uses: helm/kind-action@v1.9.0 if: steps.list-changed.outputs.changed == 'true' - name: Load container image in kind cluster From 3e1832a271d24c9c3197105bb9968c662864aef0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:58:34 +0100 Subject: [PATCH 27/32] Bump the all group with 1 update (#789) Bumps the all group with 1 update: [azure/setup-helm](https://github.com/azure/setup-helm). Updates `azure/setup-helm` from 3 to 4 - [Release notes](https://github.com/azure/setup-helm/releases) - [Changelog](https://github.com/Azure/setup-helm/blob/main/CHANGELOG.md) - [Commits](https://github.com/azure/setup-helm/compare/v3...v4) --- updated-dependencies: - dependency-name: azure/setup-helm dependency-type: direct:production update-type: version-update:semver-major dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_charts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index 6c1a399f5..0e42664b9 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -33,7 +33,7 @@ jobs: fi - name: Set up Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4 with: version: v3.9.2 From 6aeedbd8ed4e355a37680be103c3b63f7f3e37c8 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Wed, 6 Mar 2024 01:50:32 -0700 Subject: [PATCH 28/32] Add `use_epsg` parameter to WMTS endpoint (#782) * feat: add use_epsg param to wmts This enables ArcMap compatability. * fix: escape urls in wmts template Without the escapes, you can only have one query parameter --- src/titiler/application/tests/routes/test_cog.py | 11 +++++++++++ src/titiler/core/titiler/core/factory.py | 16 +++++++++++++++- src/titiler/core/titiler/core/templates/wmts.xml | 8 ++++---- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/titiler/application/tests/routes/test_cog.py b/src/titiler/application/tests/routes/test_cog.py index e69a0b501..0bcb751b8 100644 --- a/src/titiler/application/tests/routes/test_cog.py +++ b/src/titiler/application/tests/routes/test_cog.py @@ -67,6 +67,10 @@ def test_wmts(rio, app): "http://testserver/cog/tiles/WebMercatorQuad/{TileMatrix}/{TileCol}/{TileRow}@1x.png?url=https" in response.content.decode() ) + assert ( + "http://www.opengis.net/def/crs/EPSG/0/3857" + in response.content.decode() + ) response = app.get( "/cog/WMTSCapabilities.xml?url=https://myurl.com/cog.tif&tile_scale=2&tile_format=jpg" @@ -78,6 +82,13 @@ def test_wmts(rio, app): in response.content.decode() ) + response = app.get( + "/cog/WMTSCapabilities.xml?url=https://myurl.com/cog.tif&use_epsg=true" + ) + assert response.status_code == 200 + assert response.headers["content-type"] == "application/xml" + assert "EPSG:3857" in response.content.decode() + @patch("rio_tiler.io.rasterio.rasterio") def test_tile(rio, app): diff --git a/src/titiler/core/titiler/core/factory.py b/src/titiler/core/titiler/core/factory.py index 6fcf0b282..7cb9b7fd4 100644 --- a/src/titiler/core/titiler/core/factory.py +++ b/src/titiler/core/titiler/core/factory.py @@ -238,7 +238,8 @@ def add_route_dependencies( route.dependant.dependencies.insert( # type: ignore 0, get_parameterless_sub_dependant( - depends=depends, path=route.path_format # type: ignore + depends=depends, + path=route.path_format, # type: ignore ), ) @@ -778,6 +779,12 @@ def wmts( Optional[int], Query(description="Overwrite default maxzoom."), ] = None, + use_epsg: Annotated[ + bool, + Query( + description="Use EPSG code, not opengis.net, for the ows:SupportedCRS in the TileMatrixSet (set to True to enable ArcMap compatability)" + ), + ] = False, layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), tile_params=Depends(self.tile_dependency), @@ -807,6 +814,7 @@ def wmts( "minzoom", "maxzoom", "service", + "use_epsg", "request", ] qs = [ @@ -839,6 +847,11 @@ def wmts( """ tileMatrix.append(tm) + if use_epsg: + supported_crs = f"EPSG:{tms.crs.to_epsg()}" + else: + supported_crs = tms.crs.srs + return self.templates.TemplateResponse( "wmts.xml", { @@ -847,6 +860,7 @@ def wmts( "bounds": bounds, "tileMatrix": tileMatrix, "tms": tms, + "supported_crs": supported_crs, "title": "Cloud Optimized GeoTIFF", "layer_name": "cogeo", "media_type": tile_format.mediatype, diff --git a/src/titiler/core/titiler/core/templates/wmts.xml b/src/titiler/core/titiler/core/templates/wmts.xml index 8305851ce..897d0acbd 100644 --- a/src/titiler/core/titiler/core/templates/wmts.xml +++ b/src/titiler/core/titiler/core/templates/wmts.xml @@ -8,7 +8,7 @@ - + RESTful @@ -21,7 +21,7 @@ - + RESTful @@ -52,11 +52,11 @@ {{ tms.id }} - {{ tms.crs.srs }} + {{ supported_crs }} {% for item in tileMatrix %} {{ item | safe }} {% endfor %} - + From 6b43ea39123050fd414ceb33bd5ceba1746589f5 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 6 Mar 2024 09:52:42 +0100 Subject: [PATCH 29/32] update changelog --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 9c588574e..b44844794 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ## Unreleased +### titiler.core + +* Add `use_epsg` parameter to WMTS endpoint to resolve ArcMAP issues and fix XML formating (author @gadomski, https://github.com/developmentseed/titiler/pull/782) + ### titiler.application * fix invalid url parsing in HTML responses From 49d5f8e1717d77c3591431d20744656875b47bfa Mon Sep 17 00:00:00 2001 From: Christian Gass Date: Wed, 6 Mar 2024 09:30:18 +0000 Subject: [PATCH 30/32] Update Azure deployment example (#680) * update imports per #537; reenable middleware * updated docs * updated extensionBundle * lint --------- Co-authored-by: vincentsarago --- deployment/azure/README.md | 14 +++++------ deployment/azure/app/__init__.py | 41 +++++++++++++++----------------- deployment/azure/host.json | 2 +- 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/deployment/azure/README.md b/deployment/azure/README.md index 7516cde29..b7d395f69 100644 --- a/deployment/azure/README.md +++ b/deployment/azure/README.md @@ -1,13 +1,13 @@ ### Function -TiTiler is built on top of [FastAPI](https://github.com/tiangolo/fastapi), a modern, fast, Python web framework for building APIs. As for AWS Lambda we can make our FastAPI application work on Azure Function by wrapping it within the [Azure Function Python worker](https://github.com/Azure/azure-functions-python-worker). +TiTiler is built on top of [FastAPI](https://github.com/tiangolo/fastapi), a modern, fast, Python web framework for building APIs. We can make our FastAPI application work as an Azure Function by wrapping it within the [Azure Function Python worker](https://github.com/Azure/azure-functions-python-worker). If you are not familiar with **Azure functions** we recommend checking https://docs.microsoft.com/en-us/azure/azure-functions/ first. Minimal TiTiler Azure function code: ```python import azure.functions as func -from titiler.application.routers import cog, mosaic, stac, tms +from titiler.application.main import cog, mosaic, stac, tms from fastapi import FastAPI @@ -20,14 +20,12 @@ app.include_router(mosaic.router, prefix="/mosaicjson", tags=["MosaicJSON"]) app.include_router(tms.router, tags=["TileMatrixSets"]) -def main( +async def main( req: func.HttpRequest, context: func.Context, ) -> func.HttpResponse: - return func.AsgiMiddleware(app).handle(req, context) + return await func.AsgiMiddleware(app).handle_async(req, context) ``` -Note: there is a `bug` in `azure.functions.AsgiMiddleware` which prevent using `starlette.BaseHTTPMiddleware` middlewares (see: https://github.com/Azure/azure-functions-python-worker/issues/903). - #### Requirements - Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli - Azure Function Tool: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local @@ -42,8 +40,8 @@ $ cd titiler/deployment/azure $ az login $ az group create --name AzureFunctionsTiTiler-rg --location eastus -$ az storage account create --name TiTilerStorage --sku Standard_LRS -$ az functionapp create --consumption-plan-location eastus --runtime python --runtime-version 3.8 --functions-version 3 --name titiler --os-type linux +$ az storage account create --name titilerstorage --sku Standard_LRS -g AzureFunctionsTiTiler-rg +$ az functionapp create --consumption-plan-location eastus --runtime python --runtime-version 3.8 --functions-version 3 --name titiler --os-type linux -g AzureFunctionsTiTiler-rg -s titilerstorage $ func azure functionapp publish titiler ``` diff --git a/deployment/azure/app/__init__.py b/deployment/azure/app/__init__.py index 5aab2727d..33e1d2939 100644 --- a/deployment/azure/app/__init__.py +++ b/deployment/azure/app/__init__.py @@ -8,17 +8,15 @@ from starlette_cramjam.middleware import CompressionMiddleware from titiler.application import __version__ as titiler_version -from titiler.application.custom import templates -from titiler.application.routers import cog, mosaic, stac, tms +from titiler.application.main import cog, mosaic, stac, templates, tms from titiler.application.settings import ApiSettings from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers - -# from titiler.core.middleware import ( -# CacheControlMiddleware, -# LoggerMiddleware, -# LowerCaseQueryStringMiddleware, -# TotalTimeMiddleware, -# ) +from titiler.core.middleware import ( + CacheControlMiddleware, + LoggerMiddleware, + LowerCaseQueryStringMiddleware, + TotalTimeMiddleware, +) from titiler.mosaic.errors import MOSAIC_STATUS_CODES api_settings = ApiSettings() @@ -68,19 +66,18 @@ }, ) -# see https://github.com/encode/starlette/issues/1320 -# app.add_middleware( -# CacheControlMiddleware, -# cachecontrol=api_settings.cachecontrol, -# exclude_path={r"/healthz"}, -# ) +app.add_middleware( + CacheControlMiddleware, + cachecontrol=api_settings.cachecontrol, + exclude_path={r"/healthz"}, +) -# if api_settings.debug: -# app.add_middleware(LoggerMiddleware, headers=True, querystrings=True) -# app.add_middleware(TotalTimeMiddleware) +if api_settings.debug: + app.add_middleware(LoggerMiddleware, headers=True, querystrings=True) + app.add_middleware(TotalTimeMiddleware) -# if api_settings.lower_case_query_parameters: -# app.add_middleware(LowerCaseQueryStringMiddleware) +if api_settings.lower_case_query_parameters: + app.add_middleware(LowerCaseQueryStringMiddleware) @app.get("/healthz", description="Health Check", tags=["Health Check"]) @@ -99,9 +96,9 @@ def landing(request: Request): ) -def main( +async def main( req: func.HttpRequest, context: func.Context, ) -> func.HttpResponse: """Run App in AsgiMiddleware.""" - return func.AsgiMiddleware(app).handle(req, context) + return await func.AsgiMiddleware(app).handle_async(req, context) diff --git a/deployment/azure/host.json b/deployment/azure/host.json index 8e588272b..6e86c559b 100644 --- a/deployment/azure/host.json +++ b/deployment/azure/host.json @@ -10,7 +10,7 @@ }, "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[2.*, 3.0.0)" + "version": "[3.*, 4.0.0)" }, "extensions": { "http": { From 247da5dc40c0b521f2cb65f720f0a44409baf7d1 Mon Sep 17 00:00:00 2001 From: Jin Igarashi Date: Wed, 6 Mar 2024 13:25:06 +0000 Subject: [PATCH 31/32] feat: added min and max value to algorithms (#783) * feat: added min and max value to algorithms * feat: add title and description to algorithm metadata * lint * update changelog --------- Co-authored-by: vincentsarago --- CHANGES.md | 1 + .../core/titiler/core/algorithm/base.py | 3 ++ .../core/titiler/core/algorithm/dem.py | 31 +++++++++++++------ .../core/titiler/core/algorithm/index.py | 3 ++ src/titiler/core/titiler/core/factory.py | 22 +++++++++++-- 5 files changed, 49 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b44844794..cbe3508fc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ ### titiler.core * Add `use_epsg` parameter to WMTS endpoint to resolve ArcMAP issues and fix XML formating (author @gadomski, https://github.com/developmentseed/titiler/pull/782) +* Add more OpenAPI metadata for algorithm (author @JinIgarashi, https://github.com/developmentseed/titiler/pull/783) ### titiler.application diff --git a/src/titiler/core/titiler/core/algorithm/base.py b/src/titiler/core/titiler/core/algorithm/base.py index cc2855622..33ee9c370 100644 --- a/src/titiler/core/titiler/core/algorithm/base.py +++ b/src/titiler/core/titiler/core/algorithm/base.py @@ -32,6 +32,9 @@ def __call__(self, img: ImageData) -> ImageData: class AlgorithmMetadata(BaseModel): """Algorithm metadata.""" + title: Optional[str] = None + description: Optional[str] = None + inputs: Dict outputs: Dict parameters: Dict diff --git a/src/titiler/core/titiler/core/algorithm/dem.py b/src/titiler/core/titiler/core/algorithm/dem.py index 882049e3b..2976c4898 100644 --- a/src/titiler/core/titiler/core/algorithm/dem.py +++ b/src/titiler/core/titiler/core/algorithm/dem.py @@ -1,6 +1,7 @@ """titiler.core.algorithm DEM.""" import numpy +from pydantic import Field from rasterio import windows from rio_tiler.colormap import apply_cmap, cmap from rio_tiler.models import ImageData @@ -12,10 +13,13 @@ class HillShade(BaseAlgorithm): """Hillshade.""" + title: str = "Hillshade" + description: str = "Create hillshade from DEM dataset." + # parameters - azimuth: int = 90 - angle_altitude: float = 90.0 - buffer: int = 3 + azimuth: int = Field(90, ge=0, lt=360) + angle_altitude: float = Field(90.0, ge=-90.0, lt=90.0) + buffer: int = Field(3, ge=0, lt=99) # metadata input_nbands: int = 1 @@ -61,11 +65,14 @@ class Contours(BaseAlgorithm): Original idea from https://custom-scripts.sentinel-hub.com/dem/contour-lines/ """ + title: str = "Contours" + description: str = "Create contours from DEM dataset." + # parameters - increment: int = 35 - thickness: int = 1 - minz: int = -12000 - maxz: int = 8000 + increment: int = Field(35, ge=0, lt=999) + thickness: int = Field(1, ge=0, lt=10) + minz: int = Field(-12000, ge=-99999, lt=99999) + maxz: int = Field(8000, ge=-99999, lt=99999) # metadata input_nbands: int = 1 @@ -99,6 +106,9 @@ def __call__(self, img: ImageData) -> ImageData: class Terrarium(BaseAlgorithm): """Encode DEM into RGB (Mapzen Terrarium).""" + title: str = "Terrarium" + description: str = "Encode DEM into RGB (Mapzen Terrarium)." + # metadata input_nbands: int = 1 output_nbands: int = 3 @@ -122,9 +132,12 @@ def __call__(self, img: ImageData) -> ImageData: class TerrainRGB(BaseAlgorithm): """Encode DEM into RGB (Mapbox Terrain RGB).""" + title: str = "Terrarium" + description: str = "Encode DEM into RGB (Mapbox Terrain RGB)." + # parameters - interval: float = 0.1 - baseval: float = -10000.0 + interval: float = Field(0.1, ge=0.0, lt=1.0) + baseval: float = Field(-10000.0, ge=-99999.0, lt=99999.0) # metadata input_nbands: int = 1 diff --git a/src/titiler/core/titiler/core/algorithm/index.py b/src/titiler/core/titiler/core/algorithm/index.py index 2d47c4a71..e0351d77e 100644 --- a/src/titiler/core/titiler/core/algorithm/index.py +++ b/src/titiler/core/titiler/core/algorithm/index.py @@ -11,6 +11,9 @@ class NormalizedIndex(BaseAlgorithm): """Normalized Difference Index.""" + title: str = "Normalized Difference Index" + description: str = "Compute normalized difference index from two bands." + # metadata input_nbands: int = 2 output_nbands: int = 1 diff --git a/src/titiler/core/titiler/core/factory.py b/src/titiler/core/titiler/core/factory.py index 7cb9b7fd4..5fb38772a 100644 --- a/src/titiler/core/titiler/core/factory.py +++ b/src/titiler/core/titiler/core/factory.py @@ -1667,6 +1667,15 @@ def metadata(algorithm: BaseAlgorithm) -> AlgorithmMetadata: """Algorithm Metadata""" props = algorithm.model_json_schema()["properties"] + # title and description + info = { + k: v["default"] + for k, v in props.items() + if k == "title" or k == "description" + } + title = info.get("title", None) + description = info.get("description", None) + # Inputs Metadata ins = { k.replace("input_", ""): v["default"] @@ -1685,9 +1694,18 @@ def metadata(algorithm: BaseAlgorithm) -> AlgorithmMetadata: params = { k: v for k, v in props.items() - if not k.startswith("input_") and not k.startswith("output_") + if not k.startswith("input_") + and not k.startswith("output_") + and k != "title" + and k != "description" } - return AlgorithmMetadata(inputs=ins, outputs=outs, parameters=params) + return AlgorithmMetadata( + title=title, + description=description, + inputs=ins, + outputs=outs, + parameters=params, + ) @self.router.get( "/algorithms", From 02617ac5af5e6ab995a6873420213ac945fd65a6 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 6 Mar 2024 14:39:21 +0100 Subject: [PATCH 32/32] update rendering docs --- docs/src/advanced/rendering.md | 85 +++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 33 deletions(-) diff --git a/docs/src/advanced/rendering.md b/docs/src/advanced/rendering.md index ea31bfd3a..fa131ff4d 100644 --- a/docs/src/advanced/rendering.md +++ b/docs/src/advanced/rendering.md @@ -16,19 +16,22 @@ Titiler supports both default colormaps (each with a name) and custom color maps ### Default Colormaps -Default colormaps pre-made, each with a given name. These maps come from the `rio-tiler` library, which has taken colormaps packaged with Matplotlib and has added others that are commonly used with raster data. +Default colormaps pre-made, each with a given name. These maps come from the `rio-tiler` library, which has taken colormaps packaged with Matplotlib and has added others that are commonly used with raster data. A list of available color maps can be found in Titiler's Swagger docs, or in the [rio-tiler documentation](https://cogeotiff.github.io/rio-tiler/colormap/#default-rio-tilers-colormaps). To use a default colormap, simply use the parameter `colormap_name`: -```python3 -import requests +```python +import httpx -resp = requests.get("titiler.xyz/cog/preview", params={ - "url": "", - "colormap_name": "" # e.g. autumn_r -}) +resp = httpx.get( + "https://titiler.xyz/cog/preview", + params={ + "url": "", + "colormap_name": "" # e.g. autumn_r + } +) ``` You can take any of the colormaps listed on `rio-tiler`, and add `_r` to reverse it. @@ -37,19 +40,19 @@ You can take any of the colormaps listed on `rio-tiler`, and add `_r` to reverse If you'd like to specify your own colormap, you can specify your own using an encoded JSON: -```python3 -import requests +```python +import httpx -response = requests.get( - f"titiler.xyz/cog/preview", +response = httpx.get( + "https://titiler.xyz/cog/preview", params={ - "url": "", + "url": "", "bidx": "1", - "colormap": { - "0": "#e5f5f9", - "10": "#99d8c9", - "255": "#2ca25f", - } + "colormap": json.dumps({ + "0": "#e5f5f9", + "10": "#99d8c9", + "255": "#2ca25f", + }) } ) ``` @@ -75,13 +78,13 @@ Titiler supports color formulae as defined in [Mapbox's `rio-color` plugin](http In Titiler, color_formulae are applied through the `color_formula` parameter as a string. An example of this option in action: -```python3 -import requests +```python +import httpx -response = requests.get( - f"titiler.xyz/cog/preview", +response = httpx.get( + "https://titiler.xyz/cog/preview", params={ - "url": "", + "url": "", "color_formula": "gamma rg 1.3, sigmoidal rgb 22 0.1, saturation 1.5" } ) @@ -91,25 +94,41 @@ response = requests.get( Rescaling is the act of adjusting the minimum and maximum values when rendering an image. In an image with a single band, the rescaled minimum value will be set to black, and the rescaled maximum value will be set to white. This is useful if you want to accentuate features that only appear at a certain pixel value (e.g. you have a DEM, but you want to highlight how the terrain changes between sea level and 100m). -Titiler supports rescaling on a per-band basis, using the `rescaling` parameter. The input is a list of comma-delimited min-max ranges (e.g. ["0,100", "100,200", "0,1000]). +All titiler endpoinds returning *image* support `rescale` parameter. The parameter should be in form of `"rescale={min},{max}"`. -```python3 -import requests +```python +import httpx -response = requests.get( - f"titiler.xyz/cog/preview", +response = httpx.get( + "https;//titiler.xyz/cog/preview", params={ - "url": "", - "rescaling": ["0,100", "0,1000", "0,10000"] - } + "url": "", + "rescale": "0,100", + }, +) +``` + +Titiler supports rescaling on a per-band basis, using multiple `rescale` parameters. + +```python +import httpx + +response = httpx.get( + "https;//titiler.xyz/cog/preview", + params=( + ("url", ""), + ("rescale", "0,100"), + ("rescale", "0,1000"), + ("rescale", "0,10000"), + ), ) ``` By default, Titiler will rescale the bands using the min/max values of the input datatype. For example, PNG images 8- or 16-bit unsigned pixels, -giving a possible range of 0 to 255 or 0 to 65,536, so Titiler will use these ranges to rescale to the output format. +giving a possible range of 0 to 255 or 0 to 65,536, so Titiler will use these ranges to rescale to the output format. -For certain datasets (e.g. DEMs) this default behaviour can make the image seem washed out (or even entirely one color), +For certain datasets (e.g. DEMs) this default behaviour can make the image seem washed out (or even entirely one color), so if you see this happen look into rescaling your images to something that makes sense for your data. It is also possible to add a [rescaling dependency](../../api/titiler/core/dependencies/#rescalingparams) to automatically apply -a default rescale. \ No newline at end of file +a default rescale.