> For the complete documentation index, see [llms.txt](https://docs.carto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carto.com/carto-user-manual/workflows/components/google-earth-engine.md). Agents can also search and read this documentation through its [MCP server](https://docs.carto.com/~gitbook/mcp).

# Google Earth Engine

Extension Package provided by CARTO

This extension package brings [Google Earth Engine](https://earthengine.google.com/) into CARTO Workflows. Its components take polygons from a BigQuery table, summarize the pixels of an Earth Engine image that fall inside each polygon, and return the result as a new column. You can use them to enrich your own areas with elevation, vegetation, precipitation or any other raster dataset in the [Earth Engine Data Catalog](https://developers.google.com/earth-engine/datasets), without leaving your workflow.

| To do this                                           | Use                                     |
| ---------------------------------------------------- | --------------------------------------- |
| Summarize any Earth Engine image over a few polygons | [Summary Region](#summary-region)       |
| Summarize any Earth Engine image over a large table  | [Summary Table](#summary-table)         |
| Get terrain elevation for a few polygons             | [Get Elevation](#get-elevation)         |
| Get a vegetation index (NDVI) for a few polygons     | [Get NDVI](#get-ndvi)                   |
| Get precipitation for a few polygons                 | [Get Precipitation](#get-precipitation) |

## Requirements and availability

This extension package is available for **BigQuery** connections only. It doesn't appear in the extension catalog of workflows that use other data warehouses.

The components use functions deployed and maintained by CARTO, so you don't need your own Earth Engine project or credentials. They are available across BigQuery regions, including the US and EU multi-regions and single regions such as `europe-west2`.

{% hint style="info" %}
If your connection uses an Analytics Toolbox that you installed yourself, or you want the components to run on your own Earth Engine project, get in touch with us at [**support@carto.com**](mailto:support@carto.com) to deploy your own version of the functions.
{% endhint %}

## How your data is processed

To compute a result, the geometries of your polygons are sent from BigQuery to Google Earth Engine, which is a global Google service.

[Summary Region](#summary-region), [Get Elevation](#get-elevation), [Get NDVI](#get-ndvi) and [Get Precipitation](#get-precipitation) send only the geometry of each row. [Summary Table](#summary-table) works differently: it uploads a copy of the whole input table, with all of its columns, to Earth Engine. If the table has columns you don't want to share, remove them before the component, for example with [Drop Columns](https://docs.carto.com/carto-user-manual/workflows/components/data-preparation.md#drop-columns).

## Usage limits

Summary Region, Get Elevation, Get NDVI and Get Precipitation process polygons one by one. They work best with a small number of polygons, such as the ones you draw with [Draw Custom Features](https://docs.carto.com/carto-user-manual/workflows/components/parsers.md#draw-custom-features), and they get slow or fail with large inputs. For large tables use [Summary Table](#summary-table), which processes all rows in a single Earth Engine job. Very large tables can still exceed the time Earth Engine allows for a job.

Contact your CARTO representative if your use case exceeds any of these limitations.

## Choosing an image

Summary Region and Summary Table work with any image you can reach in Earth Engine. You can point to it in two ways, and you must set exactly one of them:

* **GEE Image ID:** the ID of a single Earth Engine image, for example `USGS/SRTMGL1_003`. The ID must refer to an image, not to an image collection.
* **GEE Image expression:** a single line of Earth Engine Python code that assigns an image to a variable named `image`. Use it when the dataset is an image collection that you need to filter or combine, for example `image = ee.ImageCollection('projects/sat-io/open-datasets/GLO-30').mosaic()`.

In both cases, **Band** is the name of the band to read, such as `elevation` for the first example and `b1` for the second. You can find image IDs and band names in the [Earth Engine Data Catalog](https://developers.google.com/earth-engine/datasets).

**Reducer** is the function that turns all the pixels inside a polygon into one number. The available [reducers](https://developers.google.com/earth-engine/guides/reducers_intro) are `MEAN`, `SUM`, `MIN`, `MAX`, `MEDIAN`, `STD_DEV`, `VARIANCE`, `COUNT`, `FIRST`, `LAST`, `PROD`, `ALL` and `ANY`.

## Summary Region

**Description**

Summarizes an Earth Engine image over each polygon of a small table. You choose the image, the band and the reducer. See [Choosing an image](#choosing-an-image).

**Inputs**

* **Input table:** A table that contains polygons. Polygons are processed one by one, so keep the table small. It's typically used along with a [Draw Custom Features](https://docs.carto.com/carto-user-manual/workflows/components/parsers.md#draw-custom-features) component to define the regions to summarize.

**Settings**

* **Geometry column:** Select the column from the input table that contains the polygons.
* **GEE Image ID:** (Optional) The ID of a single Earth Engine image. Provide either this or a GEE Image expression, but not both.
* **GEE Image expression:** (Optional) Earth Engine code that assigns a single image to a variable named `image`. Provide either this or a GEE Image ID, but not both.
* **Band:** The band of the image to summarize.
* **Reducer:** The [reducer](https://developers.google.com/earth-engine/guides/reducers_intro) function applied to the pixels inside each polygon. The default is `MEAN`.
* **Scale in meters:** The pixel size, in meters, at which the image is read. It accepts values from 1 to 1000 and the default is 100. For large polygons Earth Engine may use a coarser scale to complete the request.

**Outputs**

* **Output table:** A table with the same columns as the input table, plus one named `ee_summary_<reducer>` (for example `ee_summary_mean`) with the result for each polygon.

## Summary Table

**Description**

Summarizes an Earth Engine image over the polygons of a BigQuery table of any size. The table is processed in Earth Engine in a single job, and the result is written back to BigQuery. You choose the image, the band and the reducer. See [Choosing an image](#choosing-an-image).

**Inputs**

* **Vector table:** A table with one geography column that contains polygons. There is no setting to choose the geometry column. All columns of the table are uploaded to Earth Engine. See [How your data is processed](#how-your-data-is-processed).

**Settings**

* **Earth Engine Image ID:** (Optional) The ID of a single Earth Engine image. Provide either this or an Earth Engine Image expression, but not both.
* **Earth Engine Image expression:** (Optional) Earth Engine code that assigns a single image to a variable named `image`. Provide either this or an Earth Engine Image ID, but not both.
* **Band:** The band of the image to summarize.
* **Reducer Function:** The [reducer](https://developers.google.com/earth-engine/guides/reducers_intro) function applied to the pixels inside each polygon. The default is `MEAN`.
* **Scale in meters:** The pixel size, in meters, at which the image is read. It accepts values from 1 to 1000 and the default is 100.

**Outputs**

* **Output table:** A table with the columns of the input table and the result in a column named `ee_<reducer>` (for example `ee_mean`). The geography column is always returned with the name `geo`, whatever it was called in the input table. The table also includes a `system:index` column with the identifier that Earth Engine assigns to each row.

## Get Elevation

**Description**

Returns the terrain elevation, in meters, of each polygon. It reads the [Copernicus GLO-30 Digital Elevation Model](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_DEM_GLO30), a global model with a resolution of 30 meters.

The image is read at a scale of 30 meters. For polygons larger than 100 hectares the scale is 100 meters, and for polygons larger than 500 hectares it is 500 meters.

**Inputs**

* **Input table:** A table that contains polygons. Polygons are processed one by one, so keep the table small. It's typically used along with a [Draw Custom Features](https://docs.carto.com/carto-user-manual/workflows/components/parsers.md#draw-custom-features) component to define the regions to summarize.

**Settings**

* **Geometry column:** Select the column from the input table that contains the polygons.
* **Reducer:** The [reducer](https://developers.google.com/earth-engine/guides/reducers_intro) function applied to the elevation values inside each polygon. The default is `MEAN`.

**Outputs**

* **Output table:** A table with the same columns as the input table, plus one named `ee_<reducer>_elevation` (for example `ee_mean_elevation`) with the result for each polygon.

## Get NDVI

**Description**

Returns the mean Normalized Difference Vegetation Index (NDVI) of each polygon for a date range. NDVI is computed from the near-infrared (B8) and red (B4) bands of [Sentinel-2 imagery](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2). It ranges from -1 to 1, and higher values indicate denser, healthier vegetation.

The images captured in the date range are combined into a single mosaic in which the most recent image takes precedence. No cloud masking is applied, so clouds in the most recent images lower the result. Short date ranges with clear skies give the most reliable values.

The image is read at a scale of 10 meters. For polygons larger than 100 hectares the scale is 100 meters, and for polygons larger than 500 hectares it is 500 meters.

**Inputs**

* **Input table:** A table that contains polygons. Polygons are processed one by one, so keep the table small. It's typically used along with a [Draw Custom Features](https://docs.carto.com/carto-user-manual/workflows/components/parsers.md#draw-custom-features) component to define the regions to summarize.

**Settings**

* **Geometry column:** Select the column from the input table that contains the polygons.
* **Start date:** The first day of the date range, in `YYYY-MM-DD` format.
* **End date:** The day after the last day of the date range, in `YYYY-MM-DD` format. Images captured on the end date are not included.

**Outputs**

* **Output table:** A table with the same columns as the input table, plus one named `ee_ndvi` with the mean NDVI of each polygon.

## Get Precipitation

**Description**

Returns precipitation values for each polygon and a date range. It reads the `total_precipitation` band of [ERA5-Land Hourly](https://developers.google.com/earth-engine/datasets/catalog/ECMWF_ERA5_LAND_HOURLY), a global climate reanalysis dataset. Values are expressed in meters of water.

The hourly images in the date range are combined into a single mosaic in which the most recent image takes precedence, and the reducer then summarizes the pixels inside each polygon. The reducer works across space, not across time, so it doesn't add up the precipitation of every hour in the range. To analyze precipitation accumulated over a period, use [Summary Region](#summary-region) with an image expression that aggregates the collection, for example `image = ee.ImageCollection('ECMWF/ERA5_LAND/DAILY_AGGR').filterDate('2024-01-01', '2024-02-01').select('total_precipitation_sum').sum()` with the band `total_precipitation_sum`.

The image is read at a scale of 100 meters. For polygons larger than 500 hectares the scale is 500 meters.

**Inputs**

* **Input table:** A table that contains polygons. Polygons are processed one by one, so keep the table small. It's typically used along with a [Draw Custom Features](https://docs.carto.com/carto-user-manual/workflows/components/parsers.md#draw-custom-features) component to define the regions to summarize.

**Settings**

* **Geometry column:** Select the column from the input table that contains the polygons.
* **Reducer:** The [reducer](https://developers.google.com/earth-engine/guides/reducers_intro) function applied to the pixels inside each polygon. The default is `SUM`.
* **Start date:** The first day of the date range, in `YYYY-MM-DD` format.
* **End date:** The day after the last day of the date range, in `YYYY-MM-DD` format. Images from the end date are not included.

**Outputs**

* **Output table:** A table with the same columns as the input table, plus one named `ee_<reducer>_precipitation` (for example `ee_sum_precipitation`) with the result for each polygon.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.carto.com/carto-user-manual/workflows/components/google-earth-engine.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
