This project will create a 3D point cloud visualization model of the COVID-19 pandemic. The model will focus on modeling the global spatial patterns along with the statistics of different types of live cases for each country by thousands or even millions of georeferenced points.
Check python module/package installation. Uncomment the pip statement to install first if any error occurs through import step.
You do not need to run
step 1again because the locallandmask.geojsonhas already created. But you are welcomed to uncomment these code cells to run again if needed.
-
Use numpy to populate 2 1-D arrays for Longitude and Latitude respectively. Then use Cartesian Product to create a 2D array representing the Longitude and Latitude pairs of grid points.
-
Convert the 2D array to a temporary dictionary and then load it to Pandas Dataframe.
-
Convert the Pandas Dataframe to GeoPandas Dataframe by creating geometry from the
lonandlatvalues. -
Load the shapefile of World Boundaries and create a GeoPandas Dataframe.
-
Perform a
spatial joinbetween the grid points and the world polygons, and make each point have the values forCountry Name,ISOand location information. -
Write the spatial join result to a GeoJSON file and save locally.
You do not need to run
step 2again because the localiso_coords.jsonhas already created. But you are welcomed to uncomment these code cells to run again if needed.
-
Read the local
landmask.geojsonfile, and extract theISOand correspondinggeometry. (There are 172 countries covered in the file.) -
Request the available countries that have been kept tracking from the COVID-19 API. (There are 248 countries kept tracking on the API.)
-
COVID-19 data are stored individually by country with different
slugmentioned in the request url. Thus, extract theslugfor the 172 countries and store iniso_slugsvariable. -
Loop
iso_slugsdict and request each country url. Modify the response data by removing usless keys and adding other keys. Store the modified data in local folderdata_by_countryindividually. Also provide the request date on the filename.
-
Read local COVID-19 data and store in
covid_coordslist. The list involves the coordinates(lon/lat) and case(e.g. latest active cases) for each georeforenced point. -
Convert the coordinates from Geodetic WGS84(lon/lat) to 3-dimensional Geocentric Cartesian Coordinates(x/y/z). Points are set on the surface of the globe.
-
Use colormap to visualize the
latest active casesdata. In order to have more obvious color distributions, find the minimum and maximum observation values after leaving out the dirty data. -
Construct the formatted 3D Polygon File Format(PLY) with coordinates and colors for each georeferenced point.