From 75d5644a6132a50576a9f27ed6782e3361331bd0 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Mon, 9 Sep 2024 09:36:05 -0500 Subject: [PATCH] Fix d2s_tile bug (#887) --- leafmap/common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/leafmap/common.py b/leafmap/common.py index d208dab582..79a1bbf3b8 100644 --- a/leafmap/common.py +++ b/leafmap/common.py @@ -14104,9 +14104,7 @@ def ee_tile_url( return None -def d2s_tile( - url: str, titiler_endpoint: str = "https://tt.d2s.org", **kwargs: Any -) -> str: +def d2s_tile(url: str, titiler_endpoint: str = None, **kwargs: Any) -> str: """Generate a D2S tile URL with optional API key. Args: @@ -14122,6 +14120,9 @@ def d2s_tile( ValueError: If the API key is required but not set in the environment variables. """ + if titiler_endpoint is None: + titiler_endpoint = os.environ.get("TITILER_ENDPOINT", "https://titiler.xyz") + stats = cog_stats(url, titiler_endpoint=titiler_endpoint, **kwargs) if "detail" in stats: api_key = get_api_key("D2S_API_KEY")