Widgets
Add a toolbox widget to the map that allows you to select a basemap from a dropdown menu:
In [1]:
Copied!
#pip install maplab
#pip install maplab
In [2]:
Copied!
import maplab
import maplab
In [3]:
Copied!
m = maplab.Map()
m
m = maplab.Map()
m
Out[3]:
In [4]:
Copied!
m.add_toolbar()
m.add_toolbar()
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[4], line 1 ----> 1 m.add_toolbar() File ~/.local/lib/python3.9/site-packages/maplab/maplab.py:380, in Map.add_toolbar(self, position) 377 basemap.observe(change_basemap, names='value') 379 ### Marker info --> 380 import ipyfilechooser 382 marker = ipyfilechooser.FileChooser('/Users/') 384 marker_ctrl = ipyleaflet.WidgetControl(widget=marker, position='topright') ModuleNotFoundError: No module named 'ipyfilechooser'
Adding an image or logo to the map:
In [5]:
Copied!
from maplab import Map
import ipywidgets as w
from ipyleaflet import WidgetControl
m = Map()
m.add_basemap('CartoDB.Positron')
path = 'data/utk.png'
m.add_image(path)
m
from maplab import Map
import ipywidgets as w
from ipyleaflet import WidgetControl
m = Map()
m.add_basemap('CartoDB.Positron')
path = 'data/utk.png'
m.add_image(path)
m
Out[5]:
Last update:
2023-05-11