The following is a Python example of the Google Earth Engine plugin for QGIS, for monitoring and tracking wildfires on the Google Earth Engine API Documentation. This script were adapted from Google Earth Engine plugin and the Earth Engine API examples. In addition, it includes some examples adapted from the examples developed as recommended practices of the UNSPIDER (oficina de Bonn -Alemania) program.
- Step 1: Sign up for Google Earth Engine.
- Step 2: Install QGIS.
- Step 3: Install the Google Earth Engine Plugin for QGIS and authenticate Google Earth Engine.
- Step 4: Git clone or download this repository.
- Step 5: Open the Python console in QGIS and load any downloaded Python script into the QGIS Python Editor.
- Step 6: Click the Run script button on the Python Editor to execute the script.
- Step 7: Zoom in/out the QGIS Canvas to inspect the results.
We install the Google Earth Engine plugin for QGIS. To do this we must go to the top menu of QGIS and click on Add-ons> Manage and install add-ons ... In the search box we type "Google Earth", select the plugin and install it.
GEE Plugin- Open the Python console in QGIS and load the Python script (Basemaps/qgis_basemaps.py) into the QGIS Python Editor.
- Click the Run script button on the Python Editor to execute the script. This will add many basesmaps as XYZ tiles to QGIS. Select and double click any basemap under XYZ Ttiles to be added to 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, we can access the plugin from the python console to write and run the scripts. To test if the plugin is installed and authenticated properly - type the following in the QGIS Python Console:
We should note that QGIS projects that contain Earth Engine layers can be saved, in this case the code required to connect to Earth Engine is stored in a QGIS project and used to reinitialize these layers when loaded again the project. Currently, this only works we have the plugin installed in the QGIS in which these layers are loaded.
Demo:
The above code will ask Earth Engine for an image and add it as an XYZ tile layer to the QGIS canvas.
The compilation has been created to support the UN-SPIDER Knowledge Portal.