Saturday 4 August 2018

Effectively Visualising Rainfall Data

There are two methods of data visualisation (for rainfall) I found quite useful while working on my project at Biome: Contour Maps (QGIS) and Interactive feature and heat maps (Google Fusion Tables). This post is a step-by-step tutorial on making both these types of maps.

Creating Contour Maps (Isohyetal Maps) in QGIS

  1. First import the shapefile containing rain gauge locations using the   button. Next, check if you have installed the openlayers plugin in the Plugins>Manage and Install Plugins option and then access the Web>OpenLayers plugin>Google maps>Google Streets option.
  2. If everything worked out correctly, the rain gauge ‘dots’ should be exactly over their location in the labelled google map. You can check this by right clicking on the imported shapefile in the layers panel and selecting the Open Attribute Table option followed by selecting a specific record (rain gauge) in the attribute table to see it highlighted in the google map (dot turns yellow). If the yellow dot’s location in the map matches the location given in the table then the overlay has been successful (ignore the CRS)
  3. Now install a plugin called MMQGIS so that it shows up in the list of menus available. Go to MMQGIS>Combine>Attributes Join from CSV file. Input the CSV file address and select the correct file field to join (the matching name - in this case, the hobli name). Choose a location to save the output shapefile and “Not found” output list. We are using this plugin as it works far more reliably than the default ‘Joins’ feature present in QGIS.
  4. A new layer would now be present with the joined field (in my case, yearly rainfall). However, one problem that exists is that QGIS imports all CSV fields as String data type  (and cannot therefore differentiate Rainfall as an integer value). To solve this issue, go to Processing>Toolbox to open up the toolbox window and then search up ‘Refactor fields’. Using this algorithm, you can change the datatype of the required field. In my case, I changed yearly rainfall to a double data type (with the joined shapefile being the input layer)  and saved the output to another layer.
  5. Finally, this refactored layer can be used to make a raster interpolation. For this, confirm that you have the Raster plugin installed and navigate to the Raster>Interpolation>Interpolation option. Choose the refactored layer as the input file and choose the required attribute you want the contour map to show (in my case, yearly rainfall) and hit Add. Leave all other settings the same and set the output file address before hitting OK.
  6. You now have the raster interpolation which can be used to produce the Contour Map! Navigate to Raster>Extraction>Contour and select the raster image as the input. Give the location of where you want to store the contour lines output and select the contour interval (distance between the lines). My ‘Attribute Name’ was rainfall with the contour interval for ordinary contours set at 10 and index contours (seperate layer) set at 40.
  7. You can turn on labels by right clicking on the index contour layer and selecting the properties followed by the labels option. The style (colours, line thickness, etc) can be altered in the style option.

Creating Interactive Maps in Google Fusion Tables

  1. Go to shpescape.com* and click on the ‘shp 2 fusion tables’ option. On the next page, hit continue and login to your google account (if you already aren’t) and grant access to your Fusion Tables.
  2. Make sure that you have a zipped version of the folder that contains the prj, shp, shx, and dbf files for the specific shapefile layer (in my case, the joined and refactored shapefile made in QGIS) and then upload that zip archive to the website.
  3. Do not select any of the advanced options and click upload. In a few seconds, a link should be produced that takes you to a Fusion Table with your shapefile when clicked.
  4. Go to the map’s tab and choose whether you want a feature map (in my case, rain gauge locations) or a heat map (in my case, weighted for annual rainfall).
  5. For the heatmap you can adjust the radius (radius of influence in pixels) and the opacity of the colours. My map was set to a radius of 31 and an opacity of 60%.
  6. For each type of map, go to Tools>Publish and with the appropriate visibility settings (ex - anyone with the link can see this) share the link under ‘Send a link in email or IM’.
  7. This link offers access to a fully interactive map. For instance, the rain gauges in my feature map can be clicked to reveal their name and yearly rainfall value (mm).
*Please note that the shpescape website is very unreliable and must be refreshed several times (usually at each stage) to get through the entire process successfully

- Vikhyath Mondreti, Summer Intern at Biome Environmental Solutions

No comments:

Post a Comment