map = Map()
map
ipyleaflet 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()
= ee.Image('USGS/SRTMGL1_003')
dem = dem.updateMask(dem.gt(0))
sample_image
= Map()
map2 'min':0, 'max':4000}, name="My layer", shown=True)
map2.addLayer(sample_image, { map2
Map 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:
= StructureTree({'none': None,
st 'number': 1,
'string': 'hello!',
'list': [1, 'item1'],
'dictionary': {'a key': 'a value'},
'nesting': [
'nested', 'list'],
['a nested': 'dictionary'}
{
]}) st
The 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...
= Map()
map1 'min':-90, 'max':90, 'opacity':0.5}, 'pixelLatLon')
map1.addLayer(ee.Image.pixelLonLat(), {# map1.addLayer(ee.Image("CGIAR/SRTM90_V4"), {'opacity':0.5}, 'SRTM')
= Inspector(map_object = map1)
inspector1
= widgets.IntSlider(description='Zoom level:', min=0, max=15, value=7)
zoom_slider = ipyleaflet.WidgetControl(widget=inspector1,
widget_control1 ='bottomright',
position=widgets.Layout(overflow='scroll'))
layout
map1.add_control(widget_control1) map1
Examples
Inspector object only
= Inspector()
inspector1 inspector1
Inspector with a Map
ee.Initialize()
map = Map()
= Inspector(map_object=map)
inspector2
display(
widgets.HBox([map,
inspector2
],=widgets.Layout(border='1px solid black')))
layout
map.addLayer(ee.Image.pixelLonLat(), {'min':-90, 'max':90, 'opacity':0.5}, 'LonLat')
map.addLayer(
'LANDSAT/LC09/C02/T1_L2/LC09_187058_20220105'),
ee.Image('min':0, 'max':90, 'opacity':0.5},
{'Landsat')