Skip to content

Commit

Permalink
fix: Update source filter formatting with API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Feb 5, 2025
1 parent e71623d commit 52352cf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions jupyter/uvdat_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ def get_frame_path_and_metadata(self, frame):
metadata = vector.get('metadata')
return path, metadata

def get_flat_filters(self, filters):
flat = {}
for key, value in filters.items():
if isinstance(value, dict):
for k, v in self.get_flat_filters(value).items():
flat[f'{key}.{k}'] = v
else:
flat[key] = value
return flat

def update_frame(self, event):
with self.output:
if event.get('name') == 'value':
Expand All @@ -92,15 +102,15 @@ def update_frame(self, event):
query = dict(token=self.token)
source_filters = frame.get('source_filters')
if source_filters is not None and source_filters != dict(band=1):
query.update(source_filters)
query.update(self.get_flat_filters(source_filters))
self.frame_name_label.value = str(query)

if 'raster' in url_path:
url_suffix += '.png'
layer_class = TileLayer
query.update(projection='EPSG:3857')
elif 'vector' in url_path:
layer_class = VectorTileLayer
source_filters = frame.get('source_filters')
if layer_class is not None:
query_string = urlencode(query)
map_layer = layer_class(
Expand Down

0 comments on commit 52352cf

Please sign in to comment.