# Google Environment APIs

This extension provides powerful Google Environment APIs integration for spatial analysis.

It includes components for integrating usage of Google Solar API, Air Quality API and Pollen API into geospatial analytics pipelines created with Workflows.

{% hint style="info" %}
These component make use of cloud functions deployed and maintained by CARTO on a GCP project.

Usage of these functions is limited to 1000 rows/day per connection.

These functions are available for the US BigQuery region.

Please get in touch with us at [**support@carto.com**](mailto:support@carto.com) if you need to deploy your own version of the functions.
{% endhint %}

## Solar API Building Insights

**Description**

This component retrieves data from the Building Insights endpoint in Google Solar API for a set of points in a table. It will return data from buildings that intersects with the points in the input table. Find more information about Solar API [here](https://developers.google.com/maps/documentation/solar).

**Inputs**

* **Source table:** A table that contains points that will be used to get data from Solar API

**Settings**

* **Geography column:** A column in the the input table that contains the points to be used to get data from Solar API.
* **Google Maps Platform API Key:** A [Google Maps Platform API Key](https://console.cloud.google.com/google/maps-apis/credentials) with access to Solar API
* **Required quality:** The minimum quality level allowed in the results. No result with lower quality than this will be returned. Not specifying this is equivalent to restricting to HIGH quality only.
* **Fields from response:** A list of fields to be included in the JSON response. Each field should follow the JSON path of the [full response object](https://developers.google.com/maps/documentation/solar/reference/rest/v1/buildingInsights/findClosest#response-body), and the result will preserve the same structure. Find a complete reference of available values [here](https://developers.google.com/maps/documentation/solar/reference/rest/v1/buildingInsights/findClosest#response-body). Example: `imageryDate, solarPotential.panelCapacityWatts, solarPotential.buildingStats.areaMeters2`

**Output**

* **Result table:** A table with the same columns as the source table plus a column that contains a JSON object with the requested properties.

## Air Quality API Current Conditions

**Description**

This component retrieves data from the Current Conditions endpoint in Google Air Quality API for a set of points in a table. Find more information about Air Quality API [here](https://developers.google.com/maps/documentation/air-quality/).

**Inputs**

* **Source table:** A table that contains points that will be used to get data from Air Quality API

**Settings**

* **Geography column:** A column in the the input table that contains the points to be used to get data from Solar API.
* **Google Maps Platform API Key:** A [Google Maps Platform API Key](https://console.cloud.google.com/google/maps-apis/credentials) with access to Air Quality API
* **Universal Air Quality Index:** Optional. Check this option to include the Universal Air Quality Index in the response.
* **Local Air Quality Index:** Optional. Check this option to include a Local Air Quality Index in the response, based on each point location. Checking this option automatically adds the `LOCAL_AQI` extra computation.
* **Additional computations:** Optional. Add a list of [additional computations](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/ExtraComputation) to be added to the result. Example: `HEALTH_RECOMMENDATIONS, DOMINANT_POLLUTANT_CONCENTRATION`
* **Language Code:** Optiona&#x6C;**.** Type a [IETF standard language code](https://en.wikipedia.org/wiki/IETF_language_tag) to be used in the response. Example: `es` for Spanish.
* **Universal AQI color palette:** Optional. Select a color palette for the Universal Air Quality Index. Only applies if Universal AQI is requested.
* **Custom Local AQI:** Optional. Type a JSON object that defines a custom local AQI. Only applies if Local AQI is requested. Find a complete reference of custom local AQIs [here](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/CustomLocalAqi). Example: `{"regionCode": "us", "aqi": "usa_epa_nowcast"}`\\

**Output**

* **Result table:** A table with the same columns as the source table plus a column that contains a JSON object with the response. Find a reference of the expected response [here](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/currentConditions/lookup#response-body).\\

## Air Quality API Forecast

**Description**

This component retrieves data from the Forecast endpoint in Google Air Quality API for a set of points in a table. Find more information about Air Quality API [here](https://developers.google.com/maps/documentation/air-quality/).

**Inputs**

* **Source table:** A table that contains points that will be used to get data from Air Quality API

**Settings**

* **Geography column:** A column in the the input table that contains the points to be used to get data from Solar API.
* **Google Maps Platform API Key:** A [Google Maps Platform API Key](https://console.cloud.google.com/google/maps-apis/credentials) with access to Air Quality API.
* **Range** **Type**: Select 'Period' or 'Date time' to define the type of forecast to be obtained from the API.
* **Start Time:** Defines a start time. Only applies if 'Period' is selected.
* **End Time:** Defines an end time. Only applies if 'Period' is selected.
* **Date Time:** Defines a specific timestamp to be used for the forescast. Only applies if 'Date time' is selected.
* **Universal Air Quality Index:** Optional. Check this option to include the Universal Air Quality Index in the response.
* **Local Air Quality Index:** Optional. Check this option to include a Local Air Quality Index in the response, based on each point location. Checking this option automatically adds the `LOCAL_AQI` extra computation.
* **Additional computations:** Optional. Add a list of [additional computations](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/ExtraComputation) to be added to the result. Example: `HEALTH_RECOMMENDATIONS, DOMINANT_POLLUTANT_CONCENTRATION`
* **Language Code:** Optiona&#x6C;**.** Type a [IETF standard language code](https://en.wikipedia.org/wiki/IETF_language_tag) to be used in the response. Example: `es` for Spanish.
* **Universal AQI color palette:** Optional. Select a color palette for the Universal Air Quality Index. Only applies if Universal AQI is requested.
* **Custom Local AQI:** Optional. Type a JSON object that defines a custom local AQI. Only applies if Local AQI is requested. Find a complete reference of custom local AQIs [here](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/CustomLocalAqi). Example: `{"regionCode": "us", "aqi": "usa_epa_nowcast"}`

**Output**

* **Result table:** A table with the same columns as the source table plus a column that contains a JSON object with the response. Find a reference of the expected response [here](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/forecast/lookup#response-body).\\

## Air Quality API History

**Description**

This component retrieves data from the History endpoint in Google Air Quality API for a set of points in a table. Find more information about Air Quality API [here](https://developers.google.com/maps/documentation/air-quality/).

**Inputs**

* **Source table:** A table that contains points that will be used to get data from Air Quality API

**Settings**

* **Geography column:** A column in the the input table that contains the points to be used to get data from Solar API.
* **Google Maps Platform API Key:** A [Google Maps Platform API Key](https://console.cloud.google.com/google/maps-apis/credentials) with access to Air Quality API
* **Range** **Type**: Select 'Period', 'Date time', or 'Hours' to define the type of forecast to be obtained from the API.
* **Start Time:** Defines a start time. Only applies if 'Period' is selected.
* **End Time:** Defines an end time. Only applies if 'Period' is selected.
* **Date Time:** Defines a specific timestamp to be used for the forescast. Only applies if 'Date time' is selected.
* **Hours:** Defines a number of hours starting from the current time to the get the forecast. Only applies if 'Hours' is selected.
* **Universal Air Quality Index:** Optional. Check this option to include the Universal Air Quality Index in the response.
* **Local Air Quality Index:** Optional. Check this option to include a Local Air Quality Index in the response, based on each point location. Checking this option automatically adds the `LOCAL_AQI` extra computation.
* **Additional computations:** Optional. Add a list of [additional computations](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/ExtraComputation) to be added to the result. Example: `HEALTH_RECOMMENDATIONS, DOMINANT_POLLUTANT_CONCENTRATION`
* **Language Code:** Optiona&#x6C;**.** Type a [IETF standard language code](https://en.wikipedia.org/wiki/IETF_language_tag) to be used in the response. Example: `es` for Spanish.
* **Universal AQI color palette:** Optional. Select a color palette for the Universal Air Quality Index. Only applies if Universal AQI is requested.
* **Custom Local AQI:** Optional. Type a JSON object that defines a custom local AQI. Only applies if Local AQI is requested. Find a complete reference of custom local AQIs [here](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/CustomLocalAqi). Example: `{"regionCode": "us", "aqi": "usa_epa_nowcast"}`

**Output**

* **Result table:** A table with the same columns as the source table plus a column that contains a JSON object with the response. Find a reference of the expected response [here](https://developers.google.com/maps/documentation/air-quality/reference/rest/v1/history/lookup#response-body).

## Pollen API Forecast

**Description**

This component retrieves data from the Forecast endpoint in Google Pollen API for a set of points in a table.

**Inputs**

* **Source table:** A table that contains points that will be used to get data from Pollen API

**Settings**

* **Geography column:** A column in the the input table that contains the points to be used to get data from Solar API.
* **Google Maps Platform API Key:** A [Google Maps Platform API Key](https://console.cloud.google.com/google/maps-apis/credentials) with access to Pollen API
* **Days:** Set a number of days (up to 4) to get a Pollen forecast.
* **Language Code:** Optiona&#x6C;**.** Type a [IETF standard language code](https://en.wikipedia.org/wiki/IETF_language_tag) to be used in the response. Example: `es` for Spanish.
* **Include Plants Description:** Check this option to include a [plant's description](https://developers.google.com/maps/documentation/pollen/reference/rest/v1/forecast/lookup#PlantDescription) in the response.

**Output**

* **Result table:** A table with the same columns as the source table plus a column that contains a JSON object with the response. Find a reference of the expected response [here](https://developers.google.com/maps/documentation/pollen/reference/rest/v1/forecast/lookup#response-body).\\
