Skip to content
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

Search Refactor #995

Merged
merged 253 commits into from
Dec 23, 2018
Merged
Changes from 2 commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
fda9729
Further linting.
jtbaker Jun 15, 2018
bde7a2b
Hopefully last linting.
jtbaker Jun 15, 2018
b5f9282
Update features.py
jtbaker Jun 15, 2018
8e5168c
Update features.py
jtbaker Jun 16, 2018
73b1f4d
Update features.py
jtbaker Jun 16, 2018
d03bf2f
lint
jtbaker Jun 16, 2018
8ce80a6
lint
jtbaker Jun 16, 2018
bb325f4
lint
jtbaker Jun 16, 2018
bd2a12f
lint
jtbaker Jun 16, 2018
c73686e
lint
jtbaker Jun 16, 2018
5b9cb8b
lint
jtbaker Jun 16, 2018
5525df0
Update features.py
jtbaker Jun 16, 2018
cc89971
Update features.py
jtbaker Jun 16, 2018
bb825f0
Update features.py
jtbaker Jun 19, 2018
5c9c425
More lint checking.
jtbaker Jun 19, 2018
16d44f0
Update features.py
jtbaker Jun 19, 2018
2fb3437
Update features.py
jtbaker Jun 19, 2018
9933f58
Update features.py
jtbaker Jun 19, 2018
c8d404d
Update features.py
jtbaker Jun 19, 2018
90d7de9
Update features.py
jtbaker Jun 19, 2018
bfd277b
Merge pull request #1 from python-visualization/master
jtbaker Jun 23, 2018
84811a0
PC-2018.1.2 <[email protected] Overwrite remote https://github.co…
jtbaker Jun 23, 2018
76c9622
PC-2018.1.2 <[email protected] Create baseRefactoring.xml, Intell…
jtbaker Jun 23, 2018
f69bb30
Revert "PC-2018.1.2 <[email protected] Create baseRefactoring.xml…
jtbaker Jun 23, 2018
cf116fe
Revert "PC-2018.1.2 <[email protected] Overwrite remote https://g…
jtbaker Jun 23, 2018
f9e3eb8
PC-2018.1.2 <[email protected] Update vcs.xml
jtbaker Jun 24, 2018
d9f4109
PC-2018.1.2 <[email protected] Merge branch 'master'
jtbaker Jun 24, 2018
ac3e03e
PC-2018.1.2 <[email protected] Create code.style.schemes, laf.xml…
jtbaker Jun 24, 2018
3dc30cb
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
25e80a1
Merge pull request #2 from jtbaker/New-Tooltip
jtbaker Jun 24, 2018
405245c
Merge branch 'patch-2' into master
jtbaker Jun 24, 2018
ee8c427
Merge pull request #3 from jtbaker/master
jtbaker Jun 24, 2018
12e04f8
Missed a line remove when resolving conflicts.
jtbaker Jun 24, 2018
5a00b8b
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
f40d145
Merge pull request #4 from jtbaker/New-Tooltip
jtbaker Jun 24, 2018
e1431a2
PC-2018.1.2 <[email protected] Update Default.xml
jtbaker Jun 24, 2018
86b29df
PC-2018.1.2 <[email protected] Create editor.xml
jtbaker Jun 24, 2018
844ec5b
PC-2018.1.2 <[email protected] Merge branch 'master'
jtbaker Jun 24, 2018
9364c3f
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
b95f840
Merge branch 'patch-2' into New-Tooltip
jtbaker Jun 24, 2018
856aa80
Merge pull request #5 from jtbaker/New-Tooltip
jtbaker Jun 24, 2018
7eaa85e
Merge pull request #6 from jtbaker/patch-2
jtbaker Jun 24, 2018
e4978be
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
1e5242f
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
de5606a
PC-2018.1.2 <[email protected] Create laf.xml, filetypes.xml, key…
jtbaker Jun 28, 2018
76af841
PC-2018.1.2 <[email protected] Create github_settings.xml, Defaul…
jtbaker Jun 29, 2018
31a7685
PC-2018.1.2 <[email protected] Create git.xml
jtbaker Jun 29, 2018
c0ea0b5
PC-2018.1.2 <[email protected] Create ui.lnf.xml, Default.xml
jtbaker Jul 10, 2018
8fa9122
PC-2018.1.2 <[email protected] Update Default.xml
jtbaker Jul 10, 2018
2478531
PC-2018.1.2 <[email protected] Create diff.xml
jtbaker Jul 15, 2018
eac16da
PC-2018.1.2 <[email protected] Update github_settings.xml
jtbaker Jul 17, 2018
0725b4b
Update features.py
jtbaker Jun 15, 2018
99db68d
Cleaned up code linting for this commit.
jtbaker Jun 15, 2018
200155b
Update features.py
jtbaker Jun 15, 2018
f7cee1b
Further linting.
jtbaker Jun 15, 2018
9b5ecc8
Hopefully last linting.
jtbaker Jun 15, 2018
4e54b19
Update features.py
jtbaker Jun 15, 2018
6ef92db
Update features.py
jtbaker Jun 16, 2018
1f3c402
Update features.py
jtbaker Jun 16, 2018
f860855
lint
jtbaker Jun 16, 2018
292d54d
lint
jtbaker Jun 16, 2018
7a7ee05
lint
jtbaker Jun 16, 2018
cdda09d
lint
jtbaker Jun 16, 2018
bbfbb49
lint
jtbaker Jun 16, 2018
98e7f45
lint
jtbaker Jun 16, 2018
461bf11
Update features.py
jtbaker Jun 16, 2018
875c6ba
Update features.py
jtbaker Jun 16, 2018
3eb8816
Update features.py
jtbaker Jun 19, 2018
c2fa01e
More lint checking.
jtbaker Jun 19, 2018
9226117
Update features.py
jtbaker Jun 19, 2018
e5e3e48
Update features.py
jtbaker Jun 19, 2018
9d00638
Update features.py
jtbaker Jun 19, 2018
46a8f05
Update features.py
jtbaker Jun 19, 2018
a530153
Update features.py
jtbaker Jun 19, 2018
f8eea8a
PC-2018.1.2 <[email protected] Overwrite remote https://github.co…
jtbaker Jun 23, 2018
3f9ebab
PC-2018.1.2 <[email protected] Create baseRefactoring.xml, Intell…
jtbaker Jun 23, 2018
812ec07
Revert "PC-2018.1.2 <[email protected] Create baseRefactoring.xml…
jtbaker Jun 23, 2018
f3e66a4
Revert "PC-2018.1.2 <[email protected] Overwrite remote https://g…
jtbaker Jun 23, 2018
a3d9af2
PC-2018.1.2 <[email protected] Create code.style.schemes, laf.xml…
jtbaker Jun 24, 2018
4c5f94a
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
1774c1b
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
aad6580
PC-2018.1.2 <[email protected] Update Default.xml
jtbaker Jun 24, 2018
2d536db
PC-2018.1.2 <[email protected] Create editor.xml
jtbaker Jun 24, 2018
9098a75
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
0be87d5
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
919f7d9
Merge branch 'master' of https://github.com/jtbaker/folium
jtbaker Jul 17, 2018
cc74c27
Rebasing my master.
jtbaker Jul 17, 2018
cba08d6
PC-2018.1.2 <[email protected] Create vcs.xml
jtbaker Jul 19, 2018
bd51b9e
PC-2018.1.2 <[email protected] Merge branch 'master'
jtbaker Jul 27, 2018
09b410a
PC-2018.1.2 <[email protected] Create ide.general.xml
jtbaker Jul 31, 2018
742d5e3
PC-2018.1.2 <[email protected] Update ide.general.xml
jtbaker Jul 31, 2018
888096c
Merge pull request #20 from python-visualization/master
jtbaker Jul 31, 2018
6ae615b
PC-2018.1.2 <[email protected] Merge branch 'master'
jtbaker Aug 11, 2018
8493787
PC-2018.1.2 <[email protected] Update Default.xml Create code.sty…
jtbaker Aug 19, 2018
a2d4206
PC-2018.1.2 <[email protected] Update filetypes.xml
jtbaker Sep 1, 2018
61e61e6
PC-2018.1.2 <[email protected] Create ignore.xml
jtbaker Sep 5, 2018
6824b32
Merge pull request #24 from python-visualization/master
jtbaker Sep 6, 2018
7a3ffb5
PC-2018.1.2 <[email protected] Merge branch 'master'
jtbaker Sep 8, 2018
49970a2
PC-2018.1.2 <[email protected] Update vcs.xml
jtbaker Sep 11, 2018
28ddf28
PC-2018.1.2 <[email protected] Update vcs.xml
jtbaker Sep 29, 2018
7ebceb8
PC-2018.1.2 <[email protected] Update ignore.xml
jtbaker Sep 29, 2018
04bbcc4
Merge pull request #25 from python-visualization/master
jtbaker Oct 14, 2018
7fc0593
Update Docstring.
jtbaker Oct 17, 2018
4978f4e
Import new dependencies.
jtbaker Oct 17, 2018
7e7462a
Rework Search Zoom logic to let user specify a search zoom, or let
jtbaker Oct 17, 2018
3e45942
Rework styling logic to revert back to feature style properties.
jtbaker Oct 17, 2018
feeb3e3
Have to go one _parent layer higher to get to map object, since Search
jtbaker Oct 17, 2018
b8db977
Rework constructor argument assignment to match order in __init__.
jtbaker Oct 17, 2018
800495f
Call test_keys() on object keys during render method.
jtbaker Oct 17, 2018
56edbe2
Make sure parent object is folium.features.GeoJson
jtbaker Oct 17, 2018
3047aea
Delete filetypes.xml
jtbaker Oct 17, 2018
4a37dd1
Delete git.xml
jtbaker Oct 17, 2018
390e392
Delete keymap.xml
jtbaker Oct 17, 2018
05baf5f
Delete laf.xml
jtbaker Oct 17, 2018
f928969
Delete code.style.schemes
jtbaker Oct 17, 2018
2b845bb
Delete Default.xml
jtbaker Oct 17, 2018
0cb245d
Delete debugger.xml
jtbaker Oct 17, 2018
3507c9e
Delete diff.xml
jtbaker Oct 17, 2018
b37546d
Delete search.py
jtbaker Oct 17, 2018
1740133
Delete github_settings.xml
jtbaker Oct 17, 2018
a19d390
Delete ide.general.xml
jtbaker Oct 17, 2018
a603027
Delete ignore.xml
jtbaker Oct 17, 2018
7652706
Delete Default.xml
jtbaker Oct 17, 2018
abf72e4
Delete ui.lnf.xml
jtbaker Oct 17, 2018
921a24a
Delete vcs.xml
jtbaker Oct 17, 2018
945e46e
Make sure parent object is folium.features.GeoJson
jtbaker Oct 17, 2018
ddc9216
Add recursive method to get parent map object of a folium object.
jtbaker Oct 30, 2018
7f3c559
Change variable name test to python type test.
jtbaker Oct 30, 2018
c5c4ade
Fix folium import for type checking.
jtbaker Oct 30, 2018
91319e5
Add recursive method to get parent
jtbaker Oct 30, 2018
687d1f3
Switch template logic from geometry "Polygon" check to {% else %} Jinja
jtbaker Oct 30, 2018
8e7febd
Update Docstring.
jtbaker Oct 31, 2018
0759d4f
Update `get_parent_map` function to be more descriptive, raise Value …
jtbaker Nov 13, 2018
8ca7423
Update notebook example.
jtbaker Nov 13, 2018
066081a
Update references from `self._parent` to `layer` kwarg.
jtbaker Nov 13, 2018
c42e84c
Update notebook example.
jtbaker Nov 13, 2018
23301ea
Refactor variable naming to unique IDs for resources, in case of mult…
jtbaker Nov 13, 2018
59292dc
Lint fix for operator spacing.
jtbaker Nov 13, 2018
62f2019
Merge branch 'master' into SearchRefactor
ocefpaf Nov 15, 2018
e0982b4
Imports.
jtbaker Nov 16, 2018
b5e4b40
Docstring updates.
jtbaker Nov 16, 2018
5dda5c3
Template changes.
jtbaker Nov 16, 2018
e9d1c6a
Update Constructor.
jtbaker Nov 16, 2018
a6c6135
Key checking logic for GeoJson and TopoJson (borrowed from GeoJsonToo…
jtbaker Nov 16, 2018
29ba418
Remove `get_parent_map` import.
jtbaker Nov 16, 2018
9b5cbab
Remove `get_parent_map` function due to circular import and no longer…
jtbaker Nov 16, 2018
4bce024
Update Search Plugin notebook with choropleth example.
jtbaker Nov 16, 2018
9c83b52
Merge remote-tracking branch 'origin/SearchRefactor' into SearchRefactor
jtbaker Nov 16, 2018
8250d81
Remove get_parent_map function.
jtbaker Nov 16, 2018
b08ad6d
Merge remote-tracking branch 'remotes/upstream/master' into SearchRef…
Conengmo Nov 25, 2018
ceadd9e
Merge remote-tracking branch 'upstream/master' into SearchRefactor
jtbaker Nov 27, 2018
8498e08
Remove `_parent` references as it is no longer necessary.
jtbaker Nov 27, 2018
9880f7d
Docstring fixes.
jtbaker Nov 27, 2018
915936c
Update notebook example.
jtbaker Nov 27, 2018
33ac210
Template indent fixes.
jtbaker Nov 27, 2018
012145a
Unindent zoom one level so it is inline with other properties.
jtbaker Nov 27, 2018
89ab1de
Line length fixes.
jtbaker Nov 27, 2018
2e13e8c
A few more line length fixes.
jtbaker Nov 27, 2018
3b980b6
Add a # noqa comment for line length on this line. I think it's ok to
jtbaker Nov 27, 2018
0fd605e
PC-2018.1.2 <[email protected] Overwrite remote https://github.co…
jtbaker Jun 23, 2018
f5a9e57
PC-2018.1.2 <[email protected] Create baseRefactoring.xml, Intell…
jtbaker Jun 23, 2018
8cb9300
Revert "PC-2018.1.2 <[email protected] Create baseRefactoring.xml…
jtbaker Jun 23, 2018
d88f83d
Revert "PC-2018.1.2 <[email protected] Overwrite remote https://g…
jtbaker Jun 23, 2018
c96f431
PC-2018.1.2 <[email protected] Create code.style.schemes, laf.xml…
jtbaker Jun 24, 2018
468b0ea
PC-2018.1.2 <[email protected] Update Default.xml
jtbaker Jun 24, 2018
fdcb370
PC-2018.1.2 <[email protected] Create editor.xml
jtbaker Jun 24, 2018
8c7005f
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
76e63d3
PC-2018.1.2 <[email protected] Create laf.xml, filetypes.xml, key…
jtbaker Jun 28, 2018
1e7527d
PC-2018.1.2 <[email protected] Create github_settings.xml, Defaul…
jtbaker Jun 29, 2018
7e430df
PC-2018.1.2 <[email protected] Create git.xml
jtbaker Jun 29, 2018
a0e0bd6
PC-2018.1.2 <[email protected] Create ui.lnf.xml, Default.xml
jtbaker Jul 10, 2018
3b66e5a
PC-2018.1.2 <[email protected] Update Default.xml
jtbaker Jul 10, 2018
1fc9f76
PC-2018.1.2 <[email protected] Create diff.xml
jtbaker Jul 15, 2018
2f65b90
PC-2018.1.2 <[email protected] Update github_settings.xml
jtbaker Jul 17, 2018
b61d055
PC-2018.1.2 <[email protected] Overwrite remote https://github.co…
jtbaker Jun 23, 2018
df4f206
PC-2018.1.2 <[email protected] Create baseRefactoring.xml, Intell…
jtbaker Jun 23, 2018
03fe216
Revert "PC-2018.1.2 <[email protected] Create baseRefactoring.xml…
jtbaker Jun 23, 2018
557e5a5
Revert "PC-2018.1.2 <[email protected] Overwrite remote https://g…
jtbaker Jun 23, 2018
bcaee94
PC-2018.1.2 <[email protected] Create code.style.schemes, laf.xml…
jtbaker Jun 24, 2018
3b5f568
PC-2018.1.2 <[email protected] Create editor.xml
jtbaker Jun 24, 2018
95eca8e
Updated code for line length limitation, verbiage, and indentations.
jtbaker Jun 24, 2018
922baad
PC-2018.1.2 <[email protected] Create vcs.xml
jtbaker Jul 19, 2018
66e3443
PC-2018.1.2 <[email protected] Create ide.general.xml
jtbaker Jul 31, 2018
1b93d10
PC-2018.1.2 <[email protected] Update ide.general.xml
jtbaker Jul 31, 2018
ce17694
PC-2018.1.2 <[email protected] Update Default.xml Create code.sty…
jtbaker Aug 19, 2018
9a9e398
PC-2018.1.2 <[email protected] Create ignore.xml
jtbaker Sep 5, 2018
e144d41
PC-2018.1.2 <[email protected] Update vcs.xml
jtbaker Sep 11, 2018
5f28de2
PC-2018.1.2 <[email protected] Update vcs.xml
jtbaker Sep 29, 2018
8702500
PC-2018.1.2 <[email protected] Update ignore.xml
jtbaker Sep 29, 2018
b42718c
Update Docstring.
jtbaker Oct 17, 2018
16e831c
Import new dependencies.
jtbaker Oct 17, 2018
f018336
Rework Search Zoom logic to let user specify a search zoom, or let
jtbaker Oct 17, 2018
7f0f531
Rework styling logic to revert back to feature style properties.
jtbaker Oct 17, 2018
5e9e6a4
Have to go one _parent layer higher to get to map object, since Search
jtbaker Oct 17, 2018
38ca1bf
Rework constructor argument assignment to match order in __init__.
jtbaker Oct 17, 2018
a4ad98f
Call test_keys() on object keys during render method.
jtbaker Oct 17, 2018
62767eb
Make sure parent object is folium.features.GeoJson
jtbaker Oct 17, 2018
845545b
Delete code.style.schemes
jtbaker Oct 17, 2018
4913e0f
Delete diff.xml
jtbaker Oct 17, 2018
d6362e3
Delete search.py
jtbaker Oct 17, 2018
c7ef34c
Delete github_settings.xml
jtbaker Oct 17, 2018
7c47ee1
Delete ide.general.xml
jtbaker Oct 17, 2018
f21fd50
Delete ignore.xml
jtbaker Oct 17, 2018
24dcdc4
Delete ui.lnf.xml
jtbaker Oct 17, 2018
d869f2a
Delete vcs.xml
jtbaker Oct 17, 2018
6815a60
Make sure parent object is folium.features.GeoJson
jtbaker Oct 17, 2018
0a5d5c4
Add recursive method to get parent map object of a folium object.
jtbaker Oct 30, 2018
99bc6a7
Add recursive method to get parent
jtbaker Oct 30, 2018
db0a4f4
Switch template logic from geometry "Polygon" check to {% else %} Jinja
jtbaker Oct 30, 2018
bd85ca7
Update Docstring.
jtbaker Oct 31, 2018
93cb296
Update references from `self._parent` to `layer` kwarg.
jtbaker Nov 13, 2018
10eefda
Update notebook example.
jtbaker Nov 13, 2018
9306a33
Refactor variable naming to unique IDs for resources, in case of mult…
jtbaker Nov 13, 2018
a794022
Lint fix for operator spacing.
jtbaker Nov 13, 2018
43ac0ff
use firefox headless
ocefpaf Nov 7, 2018
4e10200
minor fixes
ocefpaf Nov 15, 2018
15317e6
gitignore geckodriver logs
Conengmo Nov 16, 2018
0c8bc02
review actions
ocefpaf Nov 16, 2018
63db356
guide on installing requirements, running flake8
Conengmo Nov 16, 2018
be3cb90
fix tests for latest pytest
ocefpaf Nov 16, 2018
8c2e4f0
fix lints
ocefpaf Nov 16, 2018
bb9ba9e
Imports.
jtbaker Nov 16, 2018
a20e50f
Docstring updates.
jtbaker Nov 16, 2018
856aeae
Template changes.
jtbaker Nov 16, 2018
aeb4c8c
Update Constructor.
jtbaker Nov 16, 2018
e80faac
Key checking logic for GeoJson and TopoJson (borrowed from GeoJsonToo…
jtbaker Nov 16, 2018
1f5a941
Remove `get_parent_map` import.
jtbaker Nov 16, 2018
88d41d9
Update Search Plugin notebook with choropleth example.
jtbaker Nov 16, 2018
0a7f2a5
update changelog
ocefpaf Nov 20, 2018
0292c17
Fix missing and redundand imports in __init__
Conengmo Nov 25, 2018
c63e1e1
Fix publication (CI changes, notebooks PEP8) (#1026)
ocefpaf Nov 26, 2018
736c76d
Fix for a typo I noticed in the `GeoJsonTooltip` docstring that could be
jtbaker Nov 27, 2018
21cf524
Remove `_parent` references as it is no longer necessary.
jtbaker Nov 27, 2018
986d0f9
Docstring fixes.
jtbaker Nov 27, 2018
d0d8ade
Update notebook example.
jtbaker Nov 27, 2018
ac5019e
Template indent fixes.
jtbaker Nov 27, 2018
ba88103
Unindent zoom one level so it is inline with other properties.
jtbaker Nov 27, 2018
1e81323
Line length fixes.
jtbaker Nov 27, 2018
e652966
A few more line length fixes.
jtbaker Nov 27, 2018
ab74c47
Add a # noqa comment for line length on this line. I think it's ok to
jtbaker Nov 27, 2018
d0d2f13
Update Search Plugin notebook.
jtbaker Dec 12, 2018
280bcbd
Merge remote-tracking branch 'origin/SearchRefactor' into SearchRefactor
jtbaker Dec 12, 2018
2518416
Merge upstream changes.
jtbaker Dec 20, 2018
0874493
Merge remote-tracking branch 'upstream/master' into SearchRefactor
jtbaker Dec 20, 2018
d9f0e09
Merge upstream changes.
jtbaker Dec 20, 2018
c177cbb
Remove empty cells, and re-execute notebook.
jtbaker Dec 20, 2018
1ac4177
Remove empty cells, and re-execute notebook.
jtbaker Dec 20, 2018
a64a5d5
Remove empty cells, and re-execute notebook.
jtbaker Dec 20, 2018
eb90e06
Remove the empty cell.
jtbaker Dec 20, 2018
e26d044
Rerun cells.
jtbaker Dec 20, 2018
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
107 changes: 106 additions & 1 deletion folium/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,31 @@ class GeoJson(Layer):
}
{% endif %}
)
{% if this.tooltip %}.bindTooltip("{{this.tooltip.__str__()}}"){% endif %}
{% if this.tooltip %}
.bindTooltip(function(layer){
{% if this.tooltip.fields %}
let fields = {{ this.tooltip.fields }};
{% if this.tooltip.aliases %}
let aliases = {{ this.tooltip.aliases }};
{% endif %}
return String(
fields.map(
columnname=>
`{% if this.tooltip.labels %}
<strong>{% if this.tooltip.aliases %}${aliases[fields.indexOf(columnname)]
{% if this.tooltip.toLocaleString %}.toLocaleString(){% endif %}}
{% else %}
${ columnname{% if this.tooltip.toLocaleString %}.toLocaleString(){% endif %}}
{% endif %}</strong>:
{% endif %}
${ layer.feature.properties[columnname]
{% if this.tooltip.toLocaleString %}.toLocaleString(){% endif %} }`
).join('<br>'))
{% else %}
return String(`{{ this.tooltip.text.__str__() }}`)
{% endif %}
},{sticky: {{ this.tooltip.sticky.__str__().lower() }}})
{% endif %}
.addTo({{this._parent.get_name()}});
{{this.get_name()}}.setStyle(function(feature) {return feature.properties.style;});

Expand Down Expand Up @@ -417,6 +441,14 @@ def __init__(self, data, style_function=None, name=None,

self.highlight_function = highlight_function or (lambda x: {})

self.tooltip = tooltip
if bool(self.tooltip) & bool(self.tooltip.fields):
keys = self.data['features'][0]['properties'].keys()
for value in list(self.tooltip.fields):
assert value in keys, "The value "+value.__str__() + \
" is not available in " + \
"the values " + keys.__str__()

self.smooth_factor = smooth_factor

def style_data(self):
Expand Down Expand Up @@ -652,6 +684,79 @@ def __init__(self, html=None, icon_size=None, icon_anchor=None,
self.className = class_name


class Tooltip():
"""
Creates a Tooltip object for adding to features to display text as a
property by executing a javascript function when hovering the cursor over
each feature.

Parameters
----------
fields: list or tuple.
Labels of the GeoJson 'properties' or GeoPandas GeodataFrame columns
you'd like to display.
aliases: list or tuple of strings, the same legnth as fields.
Optional 'aliases' you'd like to display the each field name as, to
describe the data in the tooltip.
text: str, may not be passed if fields is not None.
Pass the same string as a tooltip for every value in the GeoJson
object, I.e. "Click for more info."
labels: boolean, defaults True.
Boolean value indicating if you'd like the the field names or
aliases to display to the left of the value in bold.
sticky: boolean, defaults True.
Boolean value indicating if you'd like the tooltip to 'sticky' with
the mouse cursor as it moves.
*If False, the tooltip will place statically at the centroid of the
feature.
toLocaleString: boolean, defaults False.
This will use JavaScript's .toLocaleString() to format 'clean' values
as strings for the user's location; i.e. 1,000,000.00 comma separators,
float truncation for the US, etc.
*Available for most of JavaScript's primitive types (any data you'll
serve into the template).

Examples
--------
# Provide fields and aliases
>>> Tooltip(fields=['CNTY_NM','census-pop-2015','census-md-income-2015'],
aliases=['County','2015 Census Population',
'2015 Median Income'],
labels=True,
sticky=False,
toLocaleString=True)
# Provide fields, with labels off, and sticky True.
>>> Tooltip(fields=('CNTY_NM',), labels=False, sticky=True)
# Provide only text.
>>> Tooltip(text="Click for more info.", sticky=True)
"""
def __init__(self, fields=None, text=None, aliases=None, labels=True,
sticky=True, toLocaleString=False):
if fields:
assert isinstance(fields, (list, tuple)), "Please pass a list or " \
"tuple to Fields."
if bool(fields) & bool(aliases):
assert isinstance(aliases, (list, tuple))
assert len(fields) == len(aliases), "Fields and Aliases must have" \
" the same length."
assert isinstance(labels, bool), "This field requires a boolean value."
assert isinstance(sticky, bool), "This field requires a boolean value."
assert not all((fields, text)), "Please choose either fields or text."
assert any((fields, text)), "Please choose either fields or text."
assert isinstance(toLocaleString, bool), "toLocaleString must be " \
"boolean."
self.fields = fields
self.aliases = aliases
self.text = text
self.labels = labels
self.sticky = sticky
self.toLocaleString = toLocaleString
if self.fields:
self.result = self.fields
else:
self.result = self.text


class LatLngPopup(MacroElement):
"""
When one clicks on a Map that contains a LatLngPopup,
Expand Down