Map
Creating Dropdown List for Basemap Selection
In [1]:
Copied!
import geojp
import geojp
In [2]:
Copied!
import ipywidgets as widgets
from ipyleaflet import WidgetControl
import ipywidgets as widgets
from ipyleaflet import WidgetControl
In [3]:
Copied!
import geojp
import geojp
In [12]:
Copied!
m= geojp.Map()
m.add_basemap_gui()
m
m= geojp.Map()
m.add_basemap_gui()
m
Out[12]:
Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…
In [5]:
Copied!
def handle_interaction(**kwargs):
latlon = kwargs.get("coordinates")
# latlon = [round(x, 2) for x in latlon]
if kwargs.get("type") == "click":
with output:
output.clear_output()
print("You clicked at: {}".format(latlon))
m.on_interaction(handle_interaction)
def handle_interaction(**kwargs):
latlon = kwargs.get("coordinates")
# latlon = [round(x, 2) for x in latlon]
if kwargs.get("type") == "click":
with output:
output.clear_output()
print("You clicked at: {}".format(latlon))
m.on_interaction(handle_interaction)
In [6]:
Copied!
button = widgets.Button(
icon="times",
button_style="primary"
)
button.layout.width = "35px"
button
button = widgets.Button(
icon="times",
button_style="primary"
)
button.layout.width = "35px"
button
Out[6]:
Button(button_style='primary', icon='times', layout=Layout(width='35px'), style=ButtonStyle())
In [7]:
Copied!
dropdown = widgets.Dropdown(
options=["OpenStreetMap", "OpenTopoMap", "Esri.WorldImagery", "Esri.NatGeoWorldMap","CartoDB.DarkMatter"],
value="OpenStreetMap",
)
dropdown.layout.width = "150px"
dropdown
dropdown = widgets.Dropdown(
options=["OpenStreetMap", "OpenTopoMap", "Esri.WorldImagery", "Esri.NatGeoWorldMap","CartoDB.DarkMatter"],
value="OpenStreetMap",
)
dropdown.layout.width = "150px"
dropdown
Out[7]:
Dropdown(layout=Layout(width='150px'), options=('OpenStreetMap', 'OpenTopoMap', 'Esri.WorldImagery', 'Esri.Nat…
In [8]:
Copied!
box = widgets.HBox([dropdown, button])
box
box = widgets.HBox([dropdown, button])
box
Out[8]:
HBox(children=(Dropdown(layout=Layout(width='150px'), options=('OpenStreetMap', 'OpenTopoMap', 'Esri.WorldImag…
In [9]:
Copied!
m= geojp.Map()
m
m= geojp.Map()
m
Out[9]:
Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…
In [10]:
Copied!
m.add_widget(box)
m.add_widget(box)
In [11]:
Copied!
#m.controls = m.controls[:-1]
#m.controls = m.controls[:-1]