-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Added SideBySide plugin basic funcionality #1032
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
Added SideBySide plugin basic funcionality #1032
Conversation
folium/plugins/side_by_side.py
Outdated
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F401 'json' imported but unused
from jinja2 import Template | ||
from folium.raster_layers import TileLayer, WmsTileLayer | ||
|
||
class SideBySide(MacroElement): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E302 expected 2 blank lines, found 1
folium/plugins/side_by_side.py
Outdated
Parameters | ||
---------- | ||
left_layer : folium TileLayer or WMSTileLayer | ||
A layer to show on the left side of the map. Any layer added to the map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
folium/plugins/side_by_side.py
Outdated
A layer to show on the left side of the map. Any layer added to the map | ||
that is here will be shown on the left. | ||
right_layer : folium TileLayer or WMSTileLayer | ||
A layer to show on the right side of the map. Any layer added to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
folium/plugins/side_by_side.py
Outdated
that is here will be shown on the left. | ||
right_layer : folium TileLayer or WMSTileLayer | ||
A layer to show on the right side of the map. Any layer added to the | ||
map that is here will be shown on the right. This should not be the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
out = m._parent.render() | ||
# Verify that a new side-by-side control is getting created. | ||
assert 'new L.Control.SideBySide' in out | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
with pytest.raises(TypeError): | ||
sbs = SideBySide(tile, marker) | ||
sbs = SideBySide(marker, tile) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
overlay=False, control=True).add_to(m) | ||
url = 'http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi' | ||
wms = WmsTileLayer(url=url, name='test', fmt='image/png', | ||
layers='nexrad-n0r-900913', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
url = 'http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi' | ||
wms = WmsTileLayer(url=url, name='test', fmt='image/png', | ||
layers='nexrad-n0r-900913', | ||
attr=u'Weather data © 2012 IEM Nexrad', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
transparent=True, overlay=True, control=True).add_to(m) | ||
with pytest.raises(ValueError): | ||
sbs = SideBySide(tile, wms, version="whatever") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
W391 blank line at end of file
I've solved the |
Hi, thanks for submitting this PR! I was working on something similar in #933, based on another Leaflet plugin. No reason to have two split map type of plugins, so which Leaflet plugin do you think is better? |
Hi @Conengmo Sorry, I didn't see your PR. Well, maybe there is room for both. I think the functionality is not exactly the same. |
Can you tell a bit about what's the difference? |
Well, using the With the So, with I think both plugins are useful. I don't know if this answer your question. |
53546b8
to
9f2299a
Compare
This functionality got merged in #1292. Thank you for your effort @kikocorreoso and apologies this PR didn't work out. |
Thanks for adding the functionality 🗺️ !!!!! |
This PR adds basic functionality provided by this Leaflet plugin similar to the ipyleaflet's SplitMap control.
I've added a notebook in the
examples/
directory.Please, let me know if there is something wrong or if the plugin is not an interesting plugin for folium.