Skip to content

DrawingPanel

Rodrigo E. Principe edited this page Mar 20, 2019 · 2 revisions

DrawingPanel(options)

Sometimes you need to access new drawn geometries to do some process within an app, but you cannot access the geometries scope.

Options:

  • width: panel width
  • height: panel height
  • border: panel border (example: '1px solid black')
  • position: panel position (example: 'top-center')
  • layout: panel layout (example: ui.Panel.Layout.flow('vertical'))
  • drawings: the type of drawings to include in dropdown, currently only 'polygon' is available
  • map: the map instance. Defaults to Map
  • map_callback: if the map has already a callback for onClick, must be provided here to recover it
  • map_callback_id: if the map has already a callback for onClick, must be provided its ID here to recover it
  • title: a title for the panel

Methods:

  • start(): starts the drawing
  • stop(): stops the drawing
  • addTo(widget): adds the panel to the parsed widget
  • insertTo(widget, position): inserts the panel to the parsed widget in the parsed position
  • onStart(callback): registers a callback that's fired when the drawing starts. The argument for the callback is the DrawingPanel widget
  • onStop(callback): registers a callback that's fired when the drawing stops. The argument for the callback is first the DrawingPanel widget and second the actual drawing (geometry).

example: https://code.earthengine.google.com/eea12e7b2bdcc153ec6420d3cc893b98

Clone this wiki locally