Skip to content

Commit

Permalink
Fix terrain style api key bug (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs authored Jun 21, 2024
1 parent 7d320c4 commit 6bcc81d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions leafmap/maplibregl.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ 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":
style = "https://demotiles.maplibre.org/style.json"
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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6bcc81d

Please sign in to comment.