COVID-19 cleared our Earth Air: How to Visualize

Hiroya Kato
6 min readJul 12, 2020

Introduction

I visualized the areas in Japan where air pollutants (NO2) decreased during the period of movement restriction by COVID-19.

DEMO page

The process for visualization is as follows.

  1. Acquire and analyze satellite data with Google Earth Engine
  2. Visualize with Mapbox

This article will show you how to get to the visualization.

Target audience

This article is intended for the following readers.

  • Want to analyze satellite data easily
  • Want to use Google Earth Engine or will use it
  • Want to expand the type of data format that post to Mapbox

(Read the article in Japanese)

COVID-19 cleared our Earth Air?

Recently, various media outlets have reported on the improvement in air pollution due to the COVID-19.

For example, the following BBC and Earth Observatory articles show that the urban lockdowns have improved air pollution.

Even in Japan, although the lockdown was not enforced, there was a period of nationwide movement restrictions.
So, air pollution may have improved in Japan.

And then, NASA recently released a dashboard to monitor the impacts of the COVID-19.

This dashboard monitors the following environments in some cities of the world.

  • Water quality (chlorophyll)
  • Atmosphere (NO2, CO2)
  • Nighttime light
  • Airport/Parking congestion

However, the monitored region in Japan is only Tokyo. (As of July 11, 2020)

So, I visualized how the air pollution across Japan has changed due to the movement restriction by COVID-19, using Google Earth Engine and Mapbox.
This article show you how to do it.

Visualization targets

In order to see how Japan’s nationwide movement restrictions by COVID-19 has affected air pollution, here’s how to visualize year-over-year comparisons of NO2, one of the air pollutants.

The comparison period is one month from April 16, 2020, when the nationwide movement restrictions were declared, and the same period in the previous year.
(The comparison period should cover multiple years, not just the previous year. However, due to the convenience of the dataset, only the previous year was used.)

What is Google Earth Engine (GEE)

GEE can analyze and output large scale satellite data managed by Google in the cloud Platform.
In general, satellite data is very difficult to search, retrieve and format, and requires a lot of machine power to analyze, but the GEE allows you to do these tasks casually.

Terms of use for GEE

GEE is available free of charge for research/educational/non-commercial use.
For commercial use, a commercial license is provided for a fee.

For more information, please see the Terms of Use and official FAQ etc.

How to use GEE

GEE has several usages, but the most common are the followings.

  • On the web browser (Earth Engine Code Editor)
  • Via API (Earth Engine Python API)

Earth Engine Code Editor is loved by developers as a tool that allows interactive analysis with a map viewer that works with the code.

And Earth Engine Python API is in demand by researchers as a tool that can be called from Jupyter or Google Colab and combine satellite data with other domain models (e.g., image processing or NLP).

Now, let’s take a look at the visualization steps.

1. Get, analyze and output satellite data with GEE

First of all, let’s process the satellite data in GEE.

For this step, you use Earth Engine Code Editor.
(If this is your first time using it, you need to sign up here)

1–1. Get Satellite Data

For starters, access satellite data and display it with Code Editor.
Try running the following code.

After run, two periods (2019/2020) data from the NO2 dataset from Sentinel-5 will be displayed.

1–2. Analyze the satellite data

Take the difference between the two periods of satellite data gotten in 1–1.

If you run the above code, you can see the difference in the data between the two periods (2020–2019).

1–3. Output the analyzed satellite data

Convert and output the results of the analysis in 1–2 into a format that can be uploaded to Mapbox.
In this case, the data is converted and output into the following two data formats.

  • MBTiles (→ 1–3A)
  • GeoJSON (→ 1–3B)

You can choose the preferred one between these two formats.

1–3A. Creating MBTiles format data

MBTiles are raster data consisting of square PNG images arranged in a tiled pattern.

This procedure converts the GeoTIFF output from GEE to MBTiles in the following order.

GeoTIFF -> Shapefile -> GeoJSON -> MBTiles

First, output the results of 1–2 to GeoTIFF format with the following code.

Please refer to the following article to learn how to convert this GeoTIFF to MBTiles.

1–3B. Creating GeoJSON format data

GeoJSON is a data format for describing geospatial information in JSON format. In short, it is a JSON with a fixed type.
MBTiles is raster data, but GeoJSON is vector data.

In this procedure, we output GeoJSON directly from the Code Editor.

As a brief explanation, the above code consists of removing missing values with a mask, converting the data with a function to convert the raster format to vector format, and outputting the data in GeoJSON format finally.
However, in order to calculate all the pixels of the whole world, even with GEE, there is not enough computing power, so it clipped the data to the shape of the Japanese border to reduce the computational cost.

If you run the code to generate GeoJSON, this step is complete.

(All the code up to this step is here)

2. Visualize satellite data output from GEE with Mapbox

2–1. Design a Mapbox custom map with GEE data

Upload the MBTiles or GeoJSON created in step 1 to Mapbox, and then Design a custom map (Style) in Mapbox Studio.

Refer to the following Mapbox official tutorial video to upload your data.

Then, for example using my custom map below, visualize the data.

2–2. Display the Mapbox custom map on the web

Make the custom map created by Mapbox Studio with Mapbox GL JS loadable on web browsers.

For example, the following code.

If you can view it in your browser, it’s all done. Good work!

▼ FYI: My demo’s source code

Conclusion

In this article, I showed you how to use GEE and Mapbox to visualize areas with reduced air pollutants (NO2) from satellite data.

Both GEE and Mapbox are great tools!

GEE is a fun way to manipulate global data at breakneck speed.
In addition to the NO2 data, GEE has many datasets available, including the latest demographic data and the high-resolution satellite imagery.
And Mapbox supports classification, regression equations, and the use of Tensorflow models, so I recommend using it as a general-purpose satellite analysis platform.

Mapbox is an intuitive tool that allows you to create maps beyond your imagination.
I didn’t focus on Mapbox this time, but it’s the best mapping tool in terms of both practicality and design.
You can search for Mapbox works of Mapbox users around the world via the Twitter hashtag #BuiltWithMapbox, so if you’re interested, take a look!

Reference

--

--