giswqs commited on
Commit
55b2b6f
·
1 Parent(s): 8d01510

Fix duplicate layer bug

Browse files
Files changed (3) hide show
  1. pages/01_morocco.py +3 -2
  2. pages/02_libya.py +3 -2
  3. pages/03_maui.py +3 -2
pages/01_morocco.py CHANGED
@@ -108,8 +108,9 @@ def add_widgets(m):
108
 
109
  def change_image(change):
110
  if change.new:
111
- mosaic = f'{url}/datasets/{dataset.value}/{image.value}.json'
112
- m.add_stac_layer(mosaic, name=image.value, fit_bounds=m.zoom_to_layer)
 
113
 
114
  image.observe(change_image, names='value')
115
 
 
108
 
109
  def change_image(change):
110
  if change.new:
111
+ if change.new not in m.get_layer_names():
112
+ mosaic = f'{url}/datasets/{dataset.value}/{image.value}.json'
113
+ m.add_stac_layer(mosaic, name=image.value, fit_bounds=m.zoom_to_layer)
114
 
115
  image.observe(change_image, names='value')
116
 
pages/02_libya.py CHANGED
@@ -108,8 +108,9 @@ def add_widgets(m):
108
 
109
  def change_image(change):
110
  if change.new:
111
- mosaic = f'{url}/datasets/{dataset.value}/{image.value}.json'
112
- m.add_stac_layer(mosaic, name=image.value, fit_bounds=m.zoom_to_layer)
 
113
 
114
  image.observe(change_image, names='value')
115
 
 
108
 
109
  def change_image(change):
110
  if change.new:
111
+ if change.new not in m.get_layer_names():
112
+ mosaic = f'{url}/datasets/{dataset.value}/{image.value}.json'
113
+ m.add_stac_layer(mosaic, name=image.value, fit_bounds=m.zoom_to_layer)
114
 
115
  image.observe(change_image, names='value')
116
 
pages/03_maui.py CHANGED
@@ -108,8 +108,9 @@ def add_widgets(m):
108
 
109
  def change_image(change):
110
  if change.new:
111
- mosaic = f'{url}/datasets/{dataset.value}/{image.value}.json'
112
- m.add_stac_layer(mosaic, name=image.value, fit_bounds=m.zoom_to_layer)
 
113
 
114
  image.observe(change_image, names='value')
115
 
 
108
 
109
  def change_image(change):
110
  if change.new:
111
+ if change.new not in m.get_layer_names():
112
+ mosaic = f'{url}/datasets/{dataset.value}/{image.value}.json'
113
+ m.add_stac_layer(mosaic, name=image.value, fit_bounds=m.zoom_to_layer)
114
 
115
  image.observe(change_image, names='value')
116