I would like to reset a GEE App to its initial state. That includes removing the added Layers and geometries and clear the user entered values (textboxes,...). The App has a Map and Panel with some widgets. Basically I'm looking for the same behavior as refreshing the web-browser. I tried to add a ui.Button as follow:

var refreshButton = ui.Button({
  label: 'Reset App!',
  onClick: function() {
  //what to put here??

I tried the Map.clear() and Panel.clear()but that is not the behavior I need. Any ideas ? thanks

1 Answer 1


Something like this?

var oldMap = ui.root.widgets().get(0)

var newMap = ui.Map()

newMap.add(ui.Button('Reset', function () {


  • Hi Daniel, how should be the code for only refreshing the app at the initial stage? Thanks! Aug 30, 2020 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.