dea_tools.app.widgetconstructors

Functions for defining widgets for interactive Digital Earth Australia notebooks.

These functions are directly modified from originals developed by Digital Earth Africa: digitalearthafrica/deafrica-sandbox-notebooks

License: The code in this notebook is licensed under the Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth Australia data is licensed under the Creative Commons by Attribution 4.0 license (https://creativecommons.org/licenses/by/4.0/).

Contact: If you need assistance, post a question on the Open Data Cube Slack channel (http://slack.opendatacube.org/) or the GIS Stack Exchange (https://gis.stackexchange.com/questions/ask?tags=open-data-cube) using the open-data-cube tag (you can view previously asked questions here: https://gis.stackexchange.com/questions/tagged/open-data-cube).

If you would like to report an issue with this script, you can file one on Github (GeoscienceAustralia/dea-notebooks#new).

Last modified: June 2022

Functions

create_boundedfloattext(value, min_val, ...)

Create a BoundedFloatText widget

create_checkbox(value[, description, layout])

Create a Checkbox widget

create_datepicker([description, value, layout])

Create a DatePicker widget

create_dea_wms_layer(product, date, **params)

Create a Digital Earth Australia WMS layer to add to a map

create_drawcontrol([draw_controls, ...])

Create a draw control widget to add to ipyleaflet maps

create_dropdown(options, value[, ...])

Create a Dropdown widget

create_html(value)

Create a HTML widget

create_inputtext(value, placeholder[, ...])

Create a Text widget

create_map([map_center, zoom_level, ...])

Create an interactive ipyleaflet map

dea_tools.app.widgetconstructors.create_boundedfloattext(value, min_val, max_val, step_val, description='', layout={'width': '85%'})[source]

Create a BoundedFloatText widget

Last modified: October 2021

Parameters:
  • value (float) – initial value of the widget

  • min_val (float) – minimum allowed value for the float

  • max_val (float) – maximum allowed value for the float

  • step_val (float) – allowed increment for the float

  • description (string) – descirption label to attach

  • layout (dictionary) – any layout commands for the widget

Returns:

float_text

Return type:

ipywidgets.widgets.widget_float.BoundedFloatText

dea_tools.app.widgetconstructors.create_checkbox(value, description='', layout={'width': '85%'})[source]

Create a Checkbox widget

Last modified: January 2022

Parameters:
  • value (string) – initial value of the widget; True or False

  • description (string) – description label to attach

  • layout (dictionary) – any layout commands for the widget

Returns:

dropdown

Return type:

ipywidgets.widgets.widget_selection.Dropdown

dea_tools.app.widgetconstructors.create_datepicker(description='', value=None, layout={'width': '85%'})[source]

Create a DatePicker widget

Last modified: October 2021

Parameters:
  • description (string) – descirption label to attach

  • layout (dictionary) – any layout commands for the widget

Returns:

date_picker

Return type:

ipywidgets.widgets.widget_date.DatePicker

dea_tools.app.widgetconstructors.create_dea_wms_layer(product, date, **params)[source]

Create a Digital Earth Australia WMS layer to add to a map

Last modified: October 2021

Parameters:
  • product (string) – The Digital Earth Australia product to load (e.g. ‘ga_ls8c_nbart_gm_cyear_3’)

  • date (string (yyyy-mm-dd format)) – The date to load the product for

Returns:

time_wms

Return type:

ipyleaflet WMS layer

dea_tools.app.widgetconstructors.create_drawcontrol(draw_controls=['rectangle', 'polygon', 'circle', 'polyline', 'marker', 'circlemarker'], rectangle_options={}, polygon_options={}, circle_options={}, polyline_options={}, marker_options={}, circlemarker_options={})[source]

Create a draw control widget to add to ipyleaflet maps

Last modified: October 2021

Parameters:
  • draw_controls (list) – List of draw controls to add to the map. Defaults to adding all Viable options are ‘rectangle’, ‘polygon’, ‘circle’, ‘polyline’, ‘marker’, ‘circlemarker’.

  • rectangle_options (dict) – Options to customise the appearence of the relevant shape. Leave blank for default styling.

  • polygon_options (dict) – Options to customise the appearence of the relevant shape. Leave blank for default styling.

  • circle_options (dict) – Options to customise the appearence of the relevant shape. Leave blank for default styling.

  • polyline_options (dict) – Options to customise the appearence of the relevant shape. Leave blank for default styling.

  • marker_options (dict) – Options to customise the appearence of the relevant shape. Leave blank for default styling.

  • circlemarker_options (dict) – Options to customise the appearence of the relevant shape. Leave blank for default styling.

Returns:

draw_control

Return type:

ipyleaflet.leaflet.DrawControl

dea_tools.app.widgetconstructors.create_dropdown(options, value, description='', layout={'width': '85%'})[source]

Create a Dropdown widget

Last modified: October 2021

Parameters:
  • options (list) – a list of options for the user to select from

  • value (string) – initial value of the widget

  • description (string) – descirption label to attach

  • layout (dictionary) – any layout commands for the widget

Returns:

dropdown

Return type:

ipywidgets.widgets.widget_selection.Dropdown

dea_tools.app.widgetconstructors.create_html(value)[source]

Create a HTML widget

Last modified: October 2021

Parameters:

value (string) – HTML text to display

Returns:

html

Return type:

ipywidgets.widgets.widget_string.HTML

dea_tools.app.widgetconstructors.create_inputtext(value, placeholder, description='', layout={'width': '85%'})[source]

Create a Text widget

Last modified: October 2021

Parameters:
  • value (string) – initial value of the widget

  • placeholder (string) – placeholder text to display to the user before intput

  • description (string) – descirption label to attach

  • layout (dictionary) – any layout commands for the widget

Returns:

input_text

Return type:

ipywidgets.widgets.widget_string.Text

dea_tools.app.widgetconstructors.create_map(map_center=(-28, 135), zoom_level=4, basemap=ipyleaflet.basemaps.OpenStreetMap.Mapnik, basemap_name='Open Street Map', **kwargs)[source]

Create an interactive ipyleaflet map

Last modified: October 2021

Parameters:
  • map_center (tuple) – A tuple containing the latitude and longitude to focus on. Defaults to center of Australia (-28, 135)

  • zoom_level (integer) – Zoom level for the map Defaults to 4 to view all of Australia

  • basemap (ipyleaflet basemap (dict)) – Basemap to use, can be any from https://ipyleaflet.readthedocs.io/en/latest/api_reference/basemaps.html Defaults to Open Street Map (basemaps.OpenStreetMap.Mapnik)

  • basemap_name (string) – Layer name for the basemap

Returns:

m – interactive ipyleaflet map

Return type:

ipyleaflet.leaflet.Map