from branca.element import MacroElement
from folium.template import Template
class FloatImage(MacroElement):
"""Adds a floating image in HTML canvas on top of the map.
Parameters
----------
image: str
Url to image location. Can also be an inline image using a data URI
or a local file using `file://`.
bottom: int, default 75
Vertical position from the bottom, as a percentage of screen height.
left: int, default 75
Horizontal position from the left, as a percentage of screen width.
**kwargs
Additional keyword arguments are applied as CSS properties.
For example: `width='300px'`.
"""
_template = Template(
"""
{% macro header(this,kwargs) %}
{% endmacro %}
{% macro html(this,kwargs) %}
{% endmacro %}
"""
)
def __init__(self, image, bottom=75, left=75, **kwargs):
super().__init__()
self._name = "FloatImage"
self.image = image
self.bottom = bottom
self.left = left
self.css = kwargs