I would like to have a refresh button on a GEE app that reruns my whole script. I want the user to be able to set a rectangle on the map that holds all of the analysis (the app is basically a classifier that's bound to the rectangle), refresh the script to run it, then be able to move the rectangle to another spot and refresh the script again. So far this is what I have, and the map does refresh but the analysis within the rectangle does not move from its initial state.

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

var refresh = ui.Button({
  label: 'Run', 
  onClick: function () {


Users can't cause the script to be re-run. Instead, use the Drawing tools widget. There's a full example script in the community tutorials:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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