Open Earth Engine extension (OEEex)

The unofficial Chrome extension for Google Earth Engine

How to use the extension?

To use the extension, you can now use either Google Chrome or Firefox. To add it to Google Chrome, follow this link and simply add it to your Chrome. Refresh any open Google Earth Engine code editor page and it's ready to use! If you prefer to use Firefox, follow this link to add it to your browser. Simple enough?

The extension is provided with some basic setup. Set it up as you like in the options page. You can select the options you want to use or not. Some features require some extra setup (e.g., the Planet module).

For more information about each feature, check the feature documentation!

Code editor shortcuts

Description

This functionality permits the overriding of some shortcuts within the code editor. If you're using a Mac, a selection has been pre-configured for your convenience (⌘+S, ⌘+Enter ...). Please feel free to modify these in the extension options page.

How to Use It?

Set the shortcuts in the extension options and use them.

How Was It Implemented?

This feature was implemented by modifying the shortcut configurations in the code editor

Run All!

Description

A single button that starts all the tasks present in the task manager.

How to Use It

To use it, run a set of tasks and the button will appear. Simply press it and the tasks will start running.

Implementation

The extension simulates a ctl/cmd+click on all tasks.

Night Mode

Description

This extension introduces a dark theme.

How to Use It

To use it, simply select the mode you want with the logo in the upper right corner. For automatic mode based on your browser or system, double-click the logo or select the mode in the options page.
All Earth Engine tabs open in the same browser are linked. Changing the mode in one tab will change it in the others. Popups are designed for immediate interaction and therefore require your full attention. They have a white background to keep you alert 😆.

Implementation

The dark mode was implemented by using a standard dark theme for the ACE code editor and by changing the color of the rest of the interface. A new "dark" class was added that makes some CSS modifications. The extension background manages communication between each open tab using a communication port and message exchange. This allows the mode to be synced and your preferences to be stored.

OEEL Caching

Description

OEEL caching provides a 1-hour cache for files from the Open Earth Engine Library. This reduces the execution time when using the library and cannot be disabled.

How to Use It?

If you use the OEEL library, you don't need to do anything as it will automatically use the cache.

How Was It Implemented?

This feature was implemented through a redirection of specific OEEL files. Requests are redirected to proxy-oeel-code.open-geocomputing.org, which responds with the file and the appropriate cache header.

Manifest Upload

Description

Manifest upload allows you to drag and drop one or more GeoTIFFs with their manifest and have it ingested directly.

How to Use It?

To use this feature, begin by creating a manifest using the guidelines found here, with the key difference being the use of a local relative Unix-style file path instead of a gs:// address, ensuring it does not include ".." for parent directory navigation. Store the manifest.json file in a designated folder, such as myUploadFolder, with your GeoTIFFs (or zip for tables), which can be organized into subfolders. Drag and drop this folder onto the upload icon in the asset tab to initiate the upload, where you can monitor its progress in the task tab. If your data originates from URLs, it will be processed through your computer. For table uploads, incorporate table:true into your manifest to indicate vector data. From version 1.8.0 onwards, uploads will be associated with the currently active cloud project.

How Was It Implemented?

The extension requests a GS upload link from Google, then the files are uploaded and the addresses in the manifest are replaced with the newly-obtained gs:// addresses. Finally, the manifest is submitted to GEE. For remotely available data (http(s)://), the data is first downloaded in the browser, temporarily stored, and uploaded following the same approach as for local files. The server must allow requests from https://code.earthengine.google.com or else the browser protection will cancel the request.

Automatic Export

Deprecated

This feature was extremely complex to keep stable and it was challenging to manage all the required scenarios for export. It is recommended to use the "Run All" task as the primary alternative.

Description

This feature allows you to export an image, image collection, table, or video without having to press any buttons in the asset tab. However, to save our planet, always double-check that you really need to export a complete collection.

How to Use It

This is an in-built Open Earth Engine Library (OEEL) feature. Simply use the appropriate oeel.Export.ImageCollection.* function. You can find an example here.

Implementation

This was a challenging feature to implement! A communication was established between the running code and the extension through console printing. If the functionality is disabled or the extension is not installed, weird messages may appear in the console, but the code can still be executed. This communication instructs the extension on what to do.

Assets Availability

Description

It checks if assets are publicly available when sharing a script. This is only a check and does NOT change assets or repository permissions.

How to Use It?

To use it, simply click "Get Link" or "Copy Script Path." If you choose "Copy Script Path," it will also check if the repository is public to allow another user to view the content.

How Was It Implemented?

The script and environment header are statically checked to detect all used assets, and the list of these assets is sent to an external service that checks their public availability.
Limitation: Assets with dynamically-created names cannot be checked.

Insert Function Signature

Description

This feature allows you to add a function signature from the documentation to the code script with a single click.

How to Use It

To use it, go to the documentation tab, search for the function that interests you, and click on the arrow. The function will be imported with the dictionary styling. Optional arguments are commented, and the default value is added as the default value 😄.

Implementation

This function requests two files from Earth Engine that contain the function signature. Upon clicking, the signature is generated and imported into the editor.

Open Script in New Tab

Description

This feature allows you to open a selected script in a separate browser tab.

How to Use It

To use it, simply double-click on the script.

Implementation

This feature intercepts clicks on a script. If a second click is close enough in time, it will open the script in a separate tab. Otherwise, it will emulate the default behavior.

Plotly Figures

Description

This feature allows you to use Plotly figures directly in the code editor as a widget, in the console or in the map. If you plan to use this feature in a deployed EEApp, keep in mind that your users will need to use the extension, or you will need to make a custom deployment and self-host your app.

How to Use It

The easiest way is to use the Open Earth Engine Library interface. This interface allows for interactivity between the plot and Earth Engine as well. Any Plotly figure can be used, even 3D graphs, but it requires some extra work.

Some examples:

Implementation

When a plot is needed, an input box (ui.Textbox()) with specific properties is created and detected by the extension, which then hides it and adds the expected Plotly plot. The input box is used to communicate between the plot and the EE code.

Editor Font Settings

Description

This feature allows you to customize the font used in the code editor.

How to Use It

Go to the extension options page and set the font according to your preference. Then reload the code editor page.

Implementation

The default settings are simply overwritten based on your choice.

Copy JSON from the console

Description

This feature allows you to directly copy a computed JSON from the console

How to Use It

Simply double click on the JSON display button in the console.

Implementation

This feature adds an event listener to the JSON display button and subsequently copies the displayed JSON data to the clipboard.

Error in console header

Description

Have you ever found yourself losing precious time troubleshooting in the "Inspector" mode because the console's error messages weren't visible? This issue is now resolved! This feature enhances user experience by changing the color of the console button in the header to red whenever an error is fired. Thus, even when you're using the Inspector, you're promptly alerted to errors, preventing unnecessary delays in debugging.

How to Use It

Nothing just to keep activated in the options.

Implementation

Every message displayed in the console is analyzed to determine if it's an error, and if necessary, the header color is adjusted accordingly.

Python

This feature is presently only functional with version 1.7.5 or later of the Chrome extension (please update if necessary). Furthermore, it requires manual activation in the extension options.

Description

This feature allows to use and import Python code.

How to Use It

You can use Python, simply start a file with a #. You can run a Python code using oeel.Python.run(sourceCode[,{variableDictionary}[,extraPackageList]]) You can import a Python script using oeel.Python.require(path[,extraPackageList]) in much the same way you would with the standard require(path). Any function declared in the Python file can be accessed. Each call to oeel.Python.require and each run exists within its own separate Python pseudo-environment, ensuring that any coding errors or exceptions do not propagate. Nonetheless, cross-communication between these isolated environments is not possible.
It's worth noting that there's no need to import ee or oeel.

Functionality

  • You can import a single Python file in JavaScript with oeel.Python.require.
  • You can run Python code (provided as a string) from JavaScript with oeel.Python.run.
  • You can directly run Python code from the code editor. It needs to start with #.
  • You can select extra packages to install using the pks parameter from JavaScript, or request it with a special comment like # requirements: firstPackage, secondPackage or the shorter version # req: thirdPackage. These comments can be placed anywhere in the code. ⚠️ Packages are cached between runs, but if a package needs to be installed, the code execution will restart after installation.
    You can add packages stored on Earth Engine simply using their EE path, like for the JavaScript require, users/userName/repoName:filePath/inTheRepo. They can be used with Python import using a dot separator, e.g., import users.userName.repoName.filePath.inTheRepo. If you forget to import the package, a synchronous download will occur. (This is significantly slower.)
  • You can use JavaScript code in Python with oeel.requireJS(path).
  • You can use all pure Python libraries, and all those supported by Pyodide, such as numpy, matplotlib, pyproj, or scikit-learn. Matplotlib will display the figure in the console.
  • You can run Export tasks as you could in JavaScript.
  • You can interact with the Map to add layers etc., as you would do in JavaScript. However, UI elements are not present due to the absence of use cases.

Limitaion

  • Upon first invoking Python, a few seconds (typically 5-7 seconds) are required to initialize the associated environment. This initialization can only be conducted asynchronously, thereby necessitating a fresh execution of the code. Although it's feasible to trigger Python's loading automatically upon opening the code editor, this would result in a temporary freeze of the browser for those 5 to 7 seconds.
  • A Python function cannot be transferred to JavaScript, implying that a function itself cannot be returned as a result of another function if called from JavaScript. Similarly, while a JavaScript function can be used as an input to a Python function without any issues, this Python function cannot accept another Python function as one of its inputs.
  • Export.* functions are mapped directly to the code editor and thus, they cannot be a task cannot be invoked from Python. Consequently, functions like start() or status() cannot be called from Python.
  • The ui.* functions are not mapped to Python. In fact, the use of Python requires this specific extension. Therefore, employing Python for application development is not recommended.
  • Matplotlib can only result in static figures. If you need some interactivity rely on Plotly.
  • Imported files are cached and therefore are not reloaded for new runs. Consequently, any changes made between new runs will not take effect. Although reloading the page resolves this issue, it is suboptimal for the development of such packages. We are currently considering potential solutions.

Example

Python script example
JS calling script

Implementation

The current approach is a result of multiple trials and is possibly the best solution identified so far. It utilizes Pyodide, a Python interpreter compiled in WebAssembly for browser usage.
A modified version of the earthengine-api package, which doesn't require initialization, enables all Earth Engine operations. In addition, functions like print(), Map.*, Export.*, and the JavaScript version of require() (which can be accessed as oeel.requireJS()) along with some more exotic ee.data.* functions, are forwarded to the Code Editor.

PlanetLab Image Management

Description

This feature allows you to search, order, and transfer PlanetLab imagery directly from GEE.

How to Use It?

To use it, activate the feature in the extension options page, set up your account (if you log in, the API key will be retrieved automatically for you), set the path to your Planet imagery collection (this is required to remove already-available assets from the results list), and select the API version you want to use.

  • APIv1 is available to everyone but will not be maintained anymore and may be removed in the future. It requires the data to be transmitted through your computer. A good internet connection is critical, and the computer with the page must remain open. When you search, images that have already been ingested are automatically removed from the result list. To download, select the image and press "Download" or double-click on the image. Once an image is set for download, it will take up to 20 minutes for activation (computation of the image on the Planet side) before the download can start. If you select multiple images, they will all be activated in parallel.
  • APIv2 is available if you have paid quota, but it is unclear who can use it🤔. With APIv2, Planet will manage the ingestion in GEE for you once the order is placed👏. Normally, already ingested data are not displayed in the results, but ordered and not yet ingested data will be displayed. Be careful not to order the same data twice.
Check this example to get started.

Advice

Once you've finished setting up, start with a single image to make sure everything works as expected before moving on to more downloads.

How Was It Implemented?

A very long story for a day when I am motivated.

Goals and Principles

The Open Earth Engine Extension (OEEex) is part of the open geocomputing initiative. Its goal is to provide Google Earth Engine (GEE) users with free and open extensions that offer missing features. Some of the code required many hours of design and debugging.

Origins

The project originates from an extension developed by Mathieu Gravey during his PhD for use by the Institute of Earth Surface Dynamics at the University of Lausanne. It started as a way to search for and automatically transfer Planet images to Google Earth Engine and became the platform for many small added features. After the Geo for Good 2021 event, it became clear that the extension should be shared with the community. The extension was redesigned and improved during the time at Utrecht University. Now it's maintained by the Digital Landscape group at the Institute For Interdisciplinary Mountain Research from the Austrian Academy Of Sciences in Innsbruck. Special thanks to Dr. Raphaël Nussbaumer, who was responsible for designing this website, and Pauline Ahumada for the animated logo.

Privacy Policy

No sensitive data is transmitted to any external service. The only sensitive information stored is your Planet API key, which is stored locally in your browser and is only used for requests to the Planet API. Your login and password are not stored, only the key.