How it works: Context-aware assistance
You can ask a question directly in the Code Editor, and get a response based on context from your workspace, such as:
-
The full text of your active script
-
Your imported assets and geometries
-
Your active session chat history
Because Gemini capabilities in Google Earth Engine automatically understand your work, you don’t have to add code or explain your datasets. It already knows these details, so it can provide more relevant, helpful answers. Additionally, you can automatically view the diff and merge it into your script. No more copy and pasting!
You can also personalize Ask to make responses more comprehensive and suited to your needs:
-
Access the latest Gemini models: Choose the Gemini model that meets your needs — at launch, the available models are Gemini 3 Flash Preview, Gemini 3.1 Pro Preview, and Gemini 3.5 Flash.
-
Docs search: Use AI to search the official documentation for up-to-date syntax and functions.
-
Dataset search: Allow AI to search the Earth Engine Data Catalog to find and reference the exact datasets you need.
-
Google Search: Grounds response in the latest public web results using Grounding with Google Search (mutually exclusive with docs search and dataset search).
Quick-start examples
Not sure where to start? Here are four ways you can use Ask in your workflows:
1. Generate code from natural language
Need to calculate NDVI (“Normalized Difference Vegetation Index”), perform a cloud mask, or build a chart, but can’t remember the exact syntax? Just ask and Earth Engine can generate JavaScript code for you. You can review the code directly in the chat and click Insert to add it to your script, or Copy it to your clipboard. If your editor is not empty, inserting code displays a side-by-side diff view so you can review changes before accepting them.
Prompt example: “Write a script to load Sentinel-2 imagery for 2025 over Boulder, CO, apply a cloud mask, calculate NDVI, and add the median composite to the map.”
2. Explain complex code
If you’re working with a script written by a colleague or adapting an example from the community, you can use Gemini capabilities to explain it. Simply ask, “Explain what this script does,” and receive a step-by-step breakdown of the logic and Earth Engine functions being used.
3. Perform one-click troubleshooting and debugging
Debugging is an inevitable part of coding. When your script throws an error in Google Earth Engine, the Console displays an error message. Now, those messages include a “Troubleshoot” button. Clicking it automatically populates the Ask panel with a prompt that contains the error message and a request for help to diagnose the issue and suggest a fix.




