map = Map()
mapipyleaflet module
Map
Map
Map (*args, **kwargs)
An interactive map class for Jupyter clients.
Attributes: layers_control: a boolean indicating whether to display a layers control.
TileLayerEE
TileLayerEE (ee_object:ee.image.Image, *args, **kwargs)
Class for a tile layer generated by Earth Engine.
Attributes: ee_object: An Earth Engine object.
| Type | Details | |
|---|---|---|
| ee_object | Image | An Earth Engine Image object |
| args | ||
| kwargs |
Display the default interactive map.
Display an Earth Engine raster layer.
ee.Initialize()dem = ee.Image('USGS/SRTMGL1_003')
sample_image = dem.updateMask(dem.gt(0))
map2 = Map()
map2.addLayer(sample_image, {'min':0, 'max':4000}, name="My layer", shown=True)
map2Map Inspector
The following defines a StructureTree class, which builds a tree structure corresponding to data structure provided as input. The tree branches are lazily populated as the tree is expanded, so that large data structures can be efficiently rendered.
StructureTree
StructureTree (data, **kwargs)
The base Tree widget
Here is a StructureTree object that demonstrates how lists, dictionaries, and nested objects are rendered:
st = StructureTree({'none': None,
'number': 1,
'string': 'hello!',
'list': [1, 'item1'],
'dictionary': {'a key': 'a value'},
'nesting': [
['nested', 'list'],
{'a nested': 'dictionary'}
]})
stThe following defines an Inspector class, which is used to display information obtained from querying a Map object.
Inspector
Inspector (map_object=None, *args, **kwargs)
Class representing an inspector tool that responds to map events.
| Type | Default | Details | |
|---|---|---|---|
| map_object | NoneType | None | An Earth Engine Image object |
| args | |||
| kwargs |
# Testing it out...
map1 = Map()
map1.addLayer(ee.Image.pixelLonLat(), {'min':-90, 'max':90, 'opacity':0.5}, 'pixelLatLon')
# map1.addLayer(ee.Image("CGIAR/SRTM90_V4"), {'opacity':0.5}, 'SRTM')
inspector1 = Inspector(map_object = map1)
zoom_slider = widgets.IntSlider(description='Zoom level:', min=0, max=15, value=7)
widget_control1 = ipyleaflet.WidgetControl(widget=inspector1,
position='bottomright',
layout=widgets.Layout(overflow='scroll'))
map1.add_control(widget_control1)
map1Examples
Inspector object only
inspector1 = Inspector()
inspector1Inspector with a Map
ee.Initialize()map = Map()
inspector2 = Inspector(map_object=map)
display(
widgets.HBox([
map,
inspector2
],
layout=widgets.Layout(border='1px solid black')))
map.addLayer(ee.Image.pixelLonLat(), {'min':-90, 'max':90, 'opacity':0.5}, 'LonLat')
map.addLayer(
ee.Image('LANDSAT/LC09/C02/T1_L2/LC09_187058_20220105'),
{'min':0, 'max':90, 'opacity':0.5},
'Landsat')