From 3dba124f74a0756f4f9c4499c5c3131142f90853 Mon Sep 17 00:00:00 2001 From: Sandra Hoang Date: Mon, 31 Jul 2023 12:00:51 -0400 Subject: [PATCH] get working for STAC layers --- stac_ipyleaflet/core.py | 1 + stac_ipyleaflet/stac_discovery/stac_widget.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stac_ipyleaflet/core.py b/stac_ipyleaflet/core.py index 72c7ff6..30068a5 100644 --- a/stac_ipyleaflet/core.py +++ b/stac_ipyleaflet/core.py @@ -528,6 +528,7 @@ def add_tile_layer( **kwargs, ) self.add_layer(tile_layer) + return tile_layer except Exception as e: logging.error("Failed to add the specified TileLayer.") diff --git a/stac_ipyleaflet/stac_discovery/stac_widget.py b/stac_ipyleaflet/stac_discovery/stac_widget.py index 1de03c6..f61bf19 100644 --- a/stac_ipyleaflet/stac_discovery/stac_widget.py +++ b/stac_ipyleaflet/stac_discovery/stac_widget.py @@ -645,7 +645,7 @@ def query_collection_items(selected_collection): max_items=20, # intersects=geometries[0], datetime=_datetime, - titiler_endpoint=self.titiler_endpoint, + titiler_endpoint=TITILER_ENDPOINT, get_info=True, ) result_items = list(collection_items.values()) @@ -825,11 +825,12 @@ def button_clicked(change): if self.stac_data["layer_added"] == True: self.layers = self.layers[: len(self.layers) - 1] self.stac_data["layer_added"] = False - self.add_tile_layer( + applied_tile_layer = self.add_tile_layer( url=tile_url, name=items_dropdown.value, attribution=items_dropdown.value, ) + self.applied_layers.append(applied_tile_layer) stac_opacity_slider.observe( handle_stac_layer_opacity, names="value" )