Image
Add an add_image() method to the Map class of your package for adding a static image (e.g., a logo) to the map¶
In [ ]:
Copied!
# Uncomment the following line to install rastvectpy in Colab:
# %pip install git+https://github.com/lukmanfash/rastvectpy.git
# Uncomment the following line to install rastvectpy in Colab:
# %pip install git+https://github.com/lukmanfash/rastvectpy.git
In [1]:
Copied!
import rastvectpy
from ipyleaflet import WidgetControl
import ipywidgets as widgets
import rastvectpy
from ipyleaflet import WidgetControl
import ipywidgets as widgets
In [2]:
Copied!
m = rastvectpy.Map(center =[40, -100], zoom = 4)
m
m = rastvectpy.Map(center =[40, -100], zoom = 4)
m
Map(center=[40, -100], controls=(LayersControl(options=['position'], position='topright'), ZoomControl(options…
In [3]:
Copied!
url = 'https://www.nasa.gov/sites/all/themes/custom/nasatwo/images/nasa-logo.svg'
url = 'https://www.nasa.gov/sites/all/themes/custom/nasatwo/images/nasa-logo.svg'
In [4]:
Copied!
widget = widgets.HTML(
value=f'<img src="{url}" width="100" height="100">'
)
widget
widget = widgets.HTML(
value=f'
'
)
widget
HTML(value='<img src="https://www.nasa.gov/sites/all/themes/custom/nasatwo/images/nasa-logo.svg" width="100" h…
In [5]:
Copied!
control = WidgetControl(widget=widget, position='bottomright')
m.add(control)
control = WidgetControl(widget=widget, position='bottomright')
m.add(control)
Map(bottom=1801.0, center=[40, -100], controls=(LayersControl(options=['position'], position='topright'), Zoom…
Last update:
2023-05-11