Skip to content

Commit 610b42d

Browse files
committed
Merge pull request #200 from ocefpaf/fix_wms_layer
Fix WMS layer control
2 parents 7003dc5 + 1e59cfa commit 610b42d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

folium/folium.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,19 +261,17 @@ def add_wms_layer(self, wms_name=None, wms_url=None, wms_format=None,
261261
def add_layers_to_map(self):
262262
"""
263263
Required function to actually add the layers to the HTML packet.
264-
"""
265-
layers_temp = self.env.get_template('add_layers.js')
266264
267-
data_string = ''
268-
for i, layer in enumerate(self.added_layers):
265+
"""
266+
data_layers = ''
267+
for k, layer in enumerate(self.added_layers):
269268
name = list(layer.keys())[0]
270-
if i < len(self.added_layers)-1:
271-
term_string = ",\n"
269+
data_layers += '\"{}\": {}'.format(name, name)
270+
if k < len(self.added_layers)-1:
271+
data_layers += ",\n"
272272
else:
273-
term_string += "\n"
274-
data_string += '\"{}\": {}'.format(name, name, term_string)
273+
data_layers += "\n"
275274

276-
data_layers = layers_temp.render({'layers': data_string})
277275
self.template_vars.setdefault('data_layers', []).append((data_layers))
278276

279277
@iter_obj('simple')
@@ -1058,7 +1056,9 @@ def image_overlay(self, data, image_opacity=1, min_lat=-90.0, max_lat=90.0,
10581056
'image_opacity': image_opacity})
10591057

10601058
self.template_vars['image_layers'].append(image)
1061-
self.added_layers.append(image_name)
1059+
# FIXME: I am excluding the image_overlay from the layer
1060+
# control for now. There is a bug and I cannot find it.
1061+
# self.added_layers.append({image_name: image_url})
10621062

10631063
def _build_map(self, html_templ=None, templ_type='string'):
10641064
self._auto_bounds()

0 commit comments

Comments
 (0)