Skip to content

Fix WMS layer control #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions folium/folium.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,17 @@ def add_wms_layer(self, wms_name=None, wms_url=None, wms_format=None,
def add_layers_to_map(self):
"""
Required function to actually add the layers to the HTML packet.
"""
layers_temp = self.env.get_template('add_layers.js')

data_string = ''
for i, layer in enumerate(self.added_layers):
"""
data_layers = ''
for k, layer in enumerate(self.added_layers):
name = list(layer.keys())[0]
if i < len(self.added_layers)-1:
term_string = ",\n"
data_layers += '\"{}\": {}'.format(name, name)
if k < len(self.added_layers)-1:
data_layers += ",\n"
else:
term_string += "\n"
data_string += '\"{}\": {}'.format(name, name, term_string)
data_layers += "\n"

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

@iter_obj('simple')
Expand Down Expand Up @@ -1042,7 +1040,9 @@ def image_overlay(self, data, image_opacity=1, min_lat=-90.0, max_lat=90.0,
'image_opacity': image_opacity})

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

def _build_map(self, html_templ=None, templ_type='string'):
self._auto_bounds()
Expand Down