-
Notifications
You must be signed in to change notification settings - Fork 0
/
creditosfolium.py
56 lines (49 loc) · 1.47 KB
/
creditosfolium.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#Original plugin for Leaflet by GreenInfo-Network
#Port to folium by Carlos Charletti
from branca.element import MacroElement
from jinja2 import Template
from folium.elements import JSCSSMixin
from folium.utilities import parse_options
class Creditos(JSCSSMixin, MacroElement):
_template = Template(
"""
{% macro script(this, kwargs) %}
L.controlCredits(
{{ this.options|tojson }}
).addTo({{this._parent.get_name()}});
{% endmacro %}
"""
) # noqa
default_js = [
(
"leaflet-control-credits.js",
"https://cdn.jsdelivr.net/gh/carlosign/Folium.ControlCredits-Plugin@main/js/leaflet-control-credits.js",
)
]
default_css = [
(
"leaflet-control-credits.css",
"https://cdn.jsdelivr.net/gh/carlosign/Folium.ControlCredits-Plugin@main/js/leaflet-control-credits.css",
)
]
def __init__(
self,
imageurl="",
imagealt="",
tooltip="",
width="45px",
height="45px",
expandcontent= "",
**kwargs
):
super().__init__()
self._name = "Creditos"
self.options = parse_options(
imageurl=imageurl,
imagealt=imagealt,
tooltip=tooltip,
width=width,
height=height,
expandcontent=expandcontent,
**kwargs
)