Hi,

I want to run a different script to show some more charts for the plot (Evotranspiration) on the Google Earth Engine Playground window that opens up when the user clicks on the Google Earth plot.

Is this possible? Thanks!

asked 14 Sep '15, 12:04

collector's gravatar image

collector
2671627
accept rate: 0%

edited 14 Sep '15, 12:05


This is an update with the explanation as of Collect Earth 1.8 :

If you want to create you own script then you basically need to add a file to your survey ( in the Collect Survey Designer ) of type "GEE Playground script". (Sorry about the confusing names, as Playground is a very old concept, the previous name of the Code Editor)

alt text

This file should be derived from this original one : http://www.openforis.org/newwebsite//fileadmin/installer/eeCodeEditorScript.fmt

This script loads another one that does the heavy lifting, passing the plot geometry and the dates as arguments.

The easiest solution would be to create your own script (based on one like this or like this) and substitute the reference in line number 4 . You can find examples of scripts here : https://code.earthengine.google.com/?accept_repo=users/collectearth/ce_scripts

permanent link

answered 20 May '19, 14:53

Open%20Foris's gravatar image

Open Foris ♦♦
1.0k5714
accept rate: 10%

This has been possible for a while although badly documented...

If one wants to customize a project to use different code on the Google Earth Engine Playground window than the one provided by Collect Earth it is possible to replace the default template with your own Playground code by adding a file called eePlaygroundScript.fmt in the CEP file that contains the project files. Thus this new code would be specific to the project yuou are working on.

The process if as follows. Take the Collect Earth Project (CEP) file and open it with you compression software of choice ( WinRAR, WinZIP, 7Zip ...)

Create new file called eePlaygroundScript.fmt. This file should be located in the root of the CEP file. This file must follow the same structure than the file used by default (see here).

So for instance if you wanted to use a different chart you would just add those lines to the code.

In the original file, there are a few lines where the Freemarker templating language is used. We recommend the advanced users to keep this code and just replace the other parts of the script.

The lines in question are:

  • Today’s date so that the charts are drawn from 2000-01-01 until today

    var endTime = '${todayDate}';

  • The definition of the geometry of the plot ( there is an array variable called placemark.shape that contains the coordinates of the corners of the rectangle)

    var plot = ee.Geometry.Polygon([ <#list placemark.shape as coord>

          [${coord.longitude}, ${coord.latitude}],
    


    ]);

  • At the end of the script an instruction for zooming into the location of the top-left corner of the plot on the Playground map

Map.setCenter( ${placemark.shape[0].longitude},${placemark.shape[0].latitude}, 15);

The rest of the script is free from Freemarker instructions so it can be edited. Of course the plot variable will be handy for using in the analysis.

For help on how to create your own Playground script see the documentation from Google Earth Engine.

permanent link

answered 14 Sep '15, 14:44

collectearth's gravatar image

collectearth ♦
1.0k16
accept rate: 17%

This is an example of a eePlaygroundScript.fmt file where the SAVI indices for Landsat 7 and Landsat 8 have been added!

Download the file : HERE (right click and choose "Save file as..." and follow the instructions from the first answer on this thread so that you add it to your CEP file.

permanent link

answered 30 Sep '15, 16:57

collector's gravatar image

collector
2671627
accept rate: 0%

edited 30 Sep '15, 17:08

Dear Alfonso,

Thank you for the detailed explanation. I would like to add that this procedure only works with the latest version of Collect Earth (v. 1.2.4).

Best, Marcelo

permanent link

answered 30 Sep '15, 17:27

Marcelo's gravatar image

Marcelo
807918
accept rate: 18%

edited 30 Sep '15, 17:33

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×284

question asked: 14 Sep '15, 12:04

question was seen: 20,969 times

last updated: 20 May '19, 14:53