top of page

11. Remote Sensing with Google Earth Engine



Recently in this blog, we have focused on data visualization to learn how to graph plots, maps and networks using several software. We are discussing remote sensing here.


Many researchers analyzing geographical data use software ArcGIS or its open source equivalent QGIS. I used ArcMap in my doctoral study to produce a map of Airbnb usage in all zip codes of San Francisco, California. Since these apps are so versatile and useful for many kinds of tasks, however, you might need to spend some time to familiarize yourself with their unique interface.


For working with remote sensing data quickly, you may prefer apps that are solely dedicated for that purpose. If that is the case, Google Earth Engine would be a good choice for you. Let's see how it works. In order to use it, first, you need to sign up for free. If you have your Google account already, the signing up process is very simple.


For this demonstration, I originally thought about studying the land use change on palm tree plantations (those who read my previous posts can see why). But soon I realized that there is a more timely case study that can be carried out here: the 2019 wildfire in Australia.


While bush fire has broken out pretty much everywhere in the country, New South Whales has attracted the closest attention by reporters. I thought it would be better to study areas that are not as well reported and looked for a clue. Then I landed on the map below in this web page of Australian Bureau of Meteorology, highlighting the severity of recent droughts:


There is a spot in middle western part that recorded the lowest rainfall ever. That seems like a sign that wild fire, once ignited, could spread violently to annihilate vegetation. Let's see whether that actually happened.


How do we detect vegetation loss if that has taken place? Geographers use what is called Normalized Difference Vegetation Index (-1.0 ≤ NDVI ≤ 1.0) a simple function of the ratio between near-infrared light and red visible light in earth images captured by satellites, commonly used for estimating changes in the volume of plants over time. We are going to check how NDVI has changed in the past 2 years. Usually, the value fluctuates due to seasonal shifts but shows the same pattern across years; a consistent decrease in NDVI indicates vegetation loss.


Now, we are going to generate a NDVI chart for our area of interest with Google Earth Engine. In the app, the code is written in JavaScript, a programming language that hasn't been used yet in this blog. Fortunately, we can modify the code published in this study by Mr. Jan Niklas Schmid for our case study:

// setting the Area of Interest (AOI)
var Australia_AOI = geometry;

// defining function
var addNDVI = function(image){
    var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
    return image.addBands(ndvi);
};

var collection = ee.ImageCollection(('LANDSAT/LC08/C01/T1_SR'))
 .filterBounds(Australia_AOI)
 .filterDate('2018-01-01','2020-12-31')
 .select(['B4', 'B5'])
 .map(addNDVI).select('NDVI');
 
var image = ui.Chart.image.seriesByRegion(
    collection, Australia_AOI, ee.Reducer.mean(), 'NDVI', 30, 'system:time_start', 'label')
     .setChartType('ScatterChart')
     .setOptions({
         title: 'L8_Australia_2018-01-01_2020-12-31',
         vAxis: {title: 'NDVI'},
         lineWidth: 1,
         pointSize: 4});

Map.addLayer(Australia_AOI, {color: 'FF0000'});
print(image);
var palette = {min: -1, max: 1, palette: ['blue', 'white', 'green']};
Map.addLayer(collection,palette);

Now, let's open Google Earth Engine Code Editor, then copy and paste the code above to the script section at the center of the page. We can use the buttons in the map to draw a polygon over the area of interest, which is referred to as "geometry" in the code:


You can see that I marked an area with very low precipitation according to the map above. After defining the area of interest, run the code. You will see a chart of NDVI in the "Console" section on the right hand side of the screen. Click on the button on the right to open the chart in a new tab and download a CSV data table or chart image files there. The following image is a PNG file thus downloaded:

Here, you can see that the NDVI in the area has gone down by well over 20% (extremely low values on some days are due to clouds). I'm not going farther to estimate the number of lost trees from this result, but the change is significant (I have tried the same method over some other areas in the country, but the NDVI chart looked almost identical across years). We found a piece of evidence that a significant amount of vegetation was lost in the area that had been faced with a fierce drought. Unless there were other considerable causes of the loss, we can assume it is a result of the drought, and possibly, wildfire.

Ok, we've got the result... but the plot above looks very generic while we could draw one that is more indicative of vegetation loss. Let's download the CSV file and re-plot the data using Plotly with Python (check this post for Plotly installation).


First, open the downloaded CSV file and change the column names in the cells A1 and B1 to "Date" and "NDVI" (I inserted an ID column as well, believing that is a good habit). Then run this code. You'll have generated the interactive plot below (check this post for how to embed interactive plots like this one in web pages):

Indicating the value of NDVI not only by the extent in the Y-axis but also by the color scale, it's easier to see the change. And yes, it is very unfortunate that we can see such a clear image of vegetation loss. I hope they regrow soon... Anyway, the result shows that remote sensing is such a useful tool to study the current state of our planet and identify important issues to be addressed.


As mentioned at the top of this page, the blog has been focused on data visualization recently. Having covered so much, I think it's time to shift our attention to data analysis. From the next post, I'm going to address some principles of statistics using case studies. Due to the major shift of the topics, I'm not sure how quickly I can post the next article. I will as soon as possible though. Until then, keep up with the metrics!

bottom of page