geeViz.foliumView

View GEE objects using Folium.

geeViz.foliumView facilitates viewing GEE objects in Folium. Layers can be added to the map using Map.addLayer and then viewed using the Map.view method.

Example:

from geeViz.foliumView import foliumMapper

# Initialize the mapper
mapper = foliumMapper()

# Set the map center
mapper.setCenter(-122.4194, 37.7749, 10)

# Add a layer (example assumes you have an ee.Image object)
mapper.addLayer(
    ee.Image("LANDSAT/LC08/C01/T1_SR/LC08_044034_20140318"),
    {"bands": ["B4", "B3", "B2"], "min": 0, "max": 3000},
    "Landsat Image",
)

# View the map
mapper.view()

Functions

add_ee_layer(self, ee_object, vis_params, ...)

Adds an Earth Engine object as a layer to a Folium map.

Classes

foliumMapper([port])

A class for managing and visualizing Earth Engine objects using Folium.

geeViz.foliumView.add_ee_layer(self, ee_object, vis_params, name, visible)[source]

Adds an Earth Engine object as a layer to a Folium map.

Parameters:
  • ee_object (ee.Image | ee.ImageCollection | ee.FeatureCollection | ee.Feature | ee.Geometry) – The Earth Engine object to add.

  • vis_params (dict) – Visualization parameters for the layer.

  • name (str) – Name of the layer.

  • visible (bool) – Whether the layer is visible by default.

Example

>>> map = folium.Map(location=[37.7749, -122.4194], zoom_start=10)
>>> map.add_ee_layer(ee.Image("LANDSAT/LC08/C01/T1_SR/LC08_044034_20140318"),
...                  {"bands": ["B4", "B3", "B2"], "min": 0, "max": 3000},
...                  "Landsat Image", True)
class geeViz.foliumView.foliumMapper(port=8001)[source]

Bases: object

A class for managing and visualizing Earth Engine objects using Folium.

Example

>>> mapper = foliumMapper()
>>> mapper.setCenter(-122.4194, 37.7749, 10)
>>> mapper.addLayer(ee.Image("LANDSAT/LC08/C01/T1_SR/LC08_044034_20140318"),
...                 {"bands": ["B4", "B3", "B2"], "min": 0, "max": 3000},
...                 "Landsat Image")
>>> mapper.view()

Initializes the foliumMapper.

Parameters:

port (int) – The port for the local web server. Default is 8001.

Example

>>> mapper = foliumMapper(port=8001)
clearMap()[source]

Clears all layers and resets the map state.

Example

>>> mapper.clearMap()
setMapArg(key, value)[source]

Sets a map argument.

Parameters:
  • key (str) – The argument key.

  • value – The argument value.

Example

>>> mapper.setMapArg("zoom_start", 10)
turnOnInspector()[source]

Prints a message indicating that only GEE map objects are supported.

Example

>>> mapper.turnOnInspector()
setCenter(lon, lat, zoom=None)[source]

Sets the center of the map.

Parameters:
  • lon (float) – Longitude of the center.

  • lat (float) – Latitude of the center.

  • zoom (int, optional) – Zoom level. Default is None.

Example

>>> mapper.setCenter(-122.4194, 37.7749, 10)
centerObject(ee_object)[source]

Centers the map on an Earth Engine object.

Parameters:

ee_object (ee.FeatureCollection | ee.Feature | ee.Geometry) – The object to center on.

Example

>>> mapper.centerObject(ee.FeatureCollection("FAO/GAUL/2015/level1"))
addLayer(eeObject, viz={}, name=None, visible=True)[source]

Adds a layer to the map.

Parameters:
  • eeObject – The Earth Engine object to add.

  • viz (dict) – Visualization parameters.

  • name (str, optional) – Name of the layer. Default is None.

  • visible (bool) – Whether the layer is visible by default.

Example

>>> mapper.addLayer(ee.Image("LANDSAT/LC08/C01/T1_SR/LC08_044034_20140318"),
...                {"bands": ["B4", "B3", "B2"], "min": 0, "max": 3000},
...                "Landsat Image")
turnOffAllLayers()[source]

Turns off visibility for all layers.

Example

>>> mapper.turnOffAllLayers()
turnOnAllLayers()[source]

Turns on visibility for all layers.

Example

>>> mapper.turnOnAllLayers()
view(open_browser=True, open_iframe=False, iframe_height=525)[source]

Displays the map.

Parameters:
  • open_browser (bool) – Whether to open the map in a browser. Default is True.

  • open_iframe (bool) – Whether to display the map in an iframe. Default is False.

  • iframe_height (int) – Height of the iframe. Default is 525.

Example

>>> mapper.view()