From 6bcc81d119a7dec29cdb8bc1bc99d582a6b48b93 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Fri, 21 Jun 2024 10:51:34 -0400 Subject: [PATCH] Fix terrain style api key bug (#780) --- leafmap/maplibregl.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/leafmap/maplibregl.py b/leafmap/maplibregl.py index 1c6a52e68d..d72a9ad8d7 100644 --- a/leafmap/maplibregl.py +++ b/leafmap/maplibregl.py @@ -85,6 +85,9 @@ def __init__( if response.status_code != 200: style = "dark-matter" + if style == "3d-terrain": + style = self._get_3d_terrain_style() + if style.lower() in carto_basemaps: style = construct_carto_basemap_url(style.lower()) elif style == "demotiles": @@ -92,8 +95,6 @@ def __init__( elif "background-" in style: color = style.split("-")[1] style = background(color) - elif style == "3d-terrain": - style = self._get_3d_terrain_style() if style is not None: kwargs["style"] = style @@ -1643,7 +1644,8 @@ def _get_3d_terrain_style( api_key = get_api_key(token) if api_key is None: - raise ValueError("An API key is required to use the 3D terrain feature.") + print("An API key is required to use the 3D terrain feature.") + return "dark-matter" style = { "version": 8,