The following is an example of using Google Earth Engine API Documentation via the Google Earth Engine plugin for QGIS for monitoring and tracking wildfires in QGIS. This script adapts examples for the use of GEE in QGIS from the Google Earth Engine plugin, qgis-earthengine-examples and Earth Engine API repositories. In addition, it also makes use of the UN-SPIDER Recommended Practice on burn severity mapping.
To use the script for monitoring wildfires provided below, you will need a Google Earth Engine account and a QGIS installation.
To connect to Google Earth Engine from within QGIS, install the Google Earth Engine Plugin for QGIS. To do this, go to the top menu of QGIS and click on Add-ons> Manage and install add-ons .... In the search box, search for "Google Earth", select the plugin and install it. Once installed, the plugin will verify whether you are authenticated to use GEE. If that is not the case yet, you will be asked to authenticate with your credentials.
GEE PluginIt can be helpful to have additional basemaps available for working with QGIS. To add basemaps, you can make use of scripts developed by the QGIS community. For instance:
- Open the Python Console in QGIS and import this Python script.
- Click the Run script button on the Python Console to execute the script. This will add many basesmaps as XYZ tiles to QGIS. Select and double-click any basemap under XYZ tiles to add it to the QGIS canvas. See the screenshot below. Alternatively, you can install the QGIS QuickMapServices plugin. After installing the plugin, go to QGIS -- Web --QuickMapServices -- Settings -- More services -- Get contributed pack -- Save.
Once installed and authenticated, you can access the Google Earth Engine plugin for QGIS from the QGIS Python Console to write and run scripts that make use of Google Earth Engine. To test if the plugin is installed and authenticated correctly, type the following in the QGIS Python Console:
Note that QGIS projects that contain Earth Engine layers can be saved. In this case, the code required to connect to Google Earth Engine is stored in a QGIS project and used to reinitialize these layers when the project is loaded again. Currently, this only works when the plugin is installed in the QGIS installation where these layers are loaded.
Demo:
The above code asks Google Earth Engine for an image and adds it as an XYZ tile layer to the QGIS canvas.
The following script uses Earth observation data products available in the Google Earth Engine Data Catalog to identify fire locations and assess the burn severity of an area after a fire.
- Active fire detection product: FIRMS: Fire Information for Resource Management System
- Burned area products:
In addition, the script processes Sentinel-2 imagery to identify burn severity. For more details, please see the UN-SPIDER Recommended Practice on burn severity mapping.
Running the script To import the Python script in QGIS, download it to your hard drive, open the QGIS Python Console and then select it there. Click the "run script" button to execute the script. You can now inspect the results on the QGIS canvas.
The script is also available as a Jupyter Notebook.
The compilation has been created to support the UN-SPIDER Knowledge Portal.