By Joanna Lin and Michael DeWitt, Software Engineers, Earth Engine
Small changes can make a big difference when you’re running scientific analyses and creating apps in Earth Engine, particularly when those changes make it easier to share and collaborate with your peers. Within Google, we use the Earth Engine Code Editor often, so we’re attuned to the coding and UX issues that can make some workflows difficult. Removing even tiny process-related barriers can have a snowball effect and empower everyone to create more meaningful, impactful results. Toward that end, we have three new features that will help you use Earth Engine more effectively.
A new code package,
ui.url, allows programmatic manipulation of the URL’s fragment identifier via
set methods. This means that Code Editor scripts and Earth Engine Apps can now read and store values in the page’s URL. You can try a demo of the feature here.
Notice the difference? Setting the
debug variable as
true at the end of the URL will change the behavior of the script on initial load in the Code Editor.
The parameterization feature will be useful if you need to customize an Earth Engine app. For example, if you have an app related to forest monitoring and you want to show several different locations embedded in pages, you no longer have to hard code multiple apps for each region. You can now publish one app and define parameters to reconfigure the app to share personalized visualization or data displayed. The URL parameters feature also allows you to empower users to more effectively share apps. In this example, you can zoom in to different locations, and the parameterization feature updates the shareable link to focus on the area of interest.
“Get Link” changes in the Code Editor
This change provides some clarity when you’re trying to highlight and copy links with no additional keystrokes. In the past, the “Get Link” button silently updated the URL bar with an encoded snapshot URL. The “Get Link” button now automatically copies the link to the clipboard for easier sharing.
In addition, the action now presents a dialog box for adding some URL parameters to control the execution of the shared script, along with buttons to copy and visit the generated link. The controls include options to prevent the script from automatically running, and to hide the code pane (so that the map pane takes up most of the screen) when someone opens the shared link. This draggable dialog box can be dismissed via the “Esc” key or a click elsewhere on the page.
Code view in the Code Editor
Have you ever wanted to share your code with peers for feedback and became frustrated that the default view hides the code? We’ve changed the default behavior for “Get Link” URLs so that the code loads by default. Previously, the code would be hidden so you could see more of the map, with the option to click on a “Show Code” button. This was great if you wanted to share a working sample of the app, but not ideal if you wanted to view the source code associated with the app when the page is opened. In cases where viewing the code is distracting, it’s possible to enable the “Hide Code” behavior by selecting the “Hide the code pane” option in the “Get Link” dialog mentioned previously.
As a bonus, for scripts you’ve saved in your Scripts repository, you will now see a direct path to the script in the URL bar. You can also copy the direct script path from the “Get Link” dropdown. Note, unlike the other “Get Link” behavior, which points to a snapshot of your code at this point in time, script paths point to the most recent saved version of the script in your repository. To give others access to scripts in your repository, configure sharing settings using the Configure icon next to the repository name in the Scripts tab.
If you’re a regular Earth Engine user, we hope these changes will make your workflows easier. We value your input — your suggestions and requests help drive future Earth Engine innovations and improvements. If you have more ideas for streamlining development workflows, give us feedback in the Google Earth Engine Developers group, or add a new issue using this bug template.