I need help creating a map using the QGIS software app
Description: Question 1: In the Intro to QGIS tutorial, we walked through modeling year-round malaria risk in Kenya. In that model, we simply looked at whether malaria was present or absent, but of course even in areas where malaria is found, it isn’t necessarily found in the same amount. You are now being tasked with making a map of malaria risk in Kenya in May, showing areas of high, medium, low, and no risk. You’ll need to use all of the exclusionary factors identified in the introductory tutorial (elevation, humidity, and temperature) to identify areas of no risk. Remember that the mosquitoes that carry malaria:
- Live in areas that are below 1500m in elevationAre active when temperatures are between 21 and 32°C (NOTE: when assessing year-round risk, we only excluded areas that were too hot or too cold all year round. Since we are now looking at a specific month and assessing how active mosquitoes are in that month, we can exclude areas that are too hot or too cold during the month of May using the maximum and minimum May temperatures.)Can reproduce if humidity is above 60%
Because mosquitoes breed faster and thus bite more at higher temperatures (as long as it isn’t too hot!), you’ll then use the following temperature ranges to assess malaria risk:
- High risk: average monthly temp >28Medium risk: average monthly temp 25-27.9Low risk: average monthly temp <24.9
Note: this intentionally requires you to think about how you can use Raster Calculator to create three different risk bands. If you get stuck, feel free to ask for help, but please try to think it through for at least a couple minutes on your own first. You’ll also need to think about how to symbolize your final map as you have a couple of different options depending on how you created your risk bands. Ultimately, it is up to you how you make your map, but you will be assessed on whether the bands are correct and on how clearly your map conveys the information. As you work, make note of the choices you are making to include in your reflection (see below).
Question 2: Another disease that is common in Kenya are intestinal parasites. One type of these parasites, nematodes, move through the soil during parts of their lifecycle so require particular climactic conditions to become endemic in a region. First, they are temperature sensitive and require temperatures between 15 and 25 degrees Celsius to survive (Remember that like mosquitoes, since they have a relatively short lifecycle, there are places where they will be endemic during parts of the year, even if it is too hot or cold during other parts of the year). Second, they require 6% or more soil moisture which is found in places with at least 65% humidity. Given these two constraints, construct a binary (risk / no risk) map of where in Kenya nematode infection is likely to be endemic. Once again, it is up to you how you make your map, but you will be assessed on whether the information it communicates is correct and on how clearly your map conveys the information. As you work, make note of the choices you are making to include in your reflection (see below).
Question 1: In the Intro to QGIS tutorial, we walked through modeling year-round malaria risk in Kenya. In that model, we simply looked at whether malaria was present or absent, but of course even in areas where malaria is found, it isn’t necessarily found in the same amount. You are now being tasked with making a map of malaria risk in Kenya in May, showing areas of high, medium, low, and no risk. You’ll need to use all of the exclusionary factors identified in the introductory tutorial (elevation, humidity, and temperature) to identify areas of no risk. Remember that the mosquitoes that carry malaria:
Live in areas that are below 1500m in elevationAre active when temperatures are between 21 and 32°C (NOTE: when assessing year-round risk, we only excluded areas that were too hot or too cold all year round. Since we are now looking at a specific month and assessing how active mosquitoes are in that month, we can exclude areas that are too hot or too cold during the month of May using the maximum and minimum May temperatures.)Can reproduce if humidity is above 60%Because mosquitoes breed faster and thus bite more at higher temperatures (as long as it isn’t too hot!), you’ll then use the following temperature ranges to assess malaria risk:High risk: average monthly temp >28Medium risk: average monthly temp 25-27.9Low risk: average monthly temp <24.9Note: this intentionally requires you to think about how you can use Raster Calculator to create three different risk bands. If you get stuck, feel free to ask for help, but please try to think it through for at least a couple minutes on your own first. You’ll also need to think about how to symbolize your final map as you have a couple of different options depending on how you created your risk bands. Ultimately, it is up to you how you make your map, but you will be assessed on whether the bands are correct and on how clearly your map conveys the information. As you work, make note of the choices you are making to include in your reflection (see below).Question 2: Another disease that is common in Kenya are intestinal parasites. One type of these parasites, nematodes, move through the soil during parts of their lifecycle so require particular climactic conditions to become endemic in a region. First, they are temperature sensitive and require temperatures between 15 and 25 degrees Celsius to survive (Remember that like mosquitoes, since they have a relatively short lifecycle, there are places where they will be endemic during parts of the year, even if it is too hot or cold during other parts of the year). Second, they require 6% or more soil moisture which is found in places with at least 65% humidity. Given these two constraints, construct a binary (risk / no risk) map of where in Kenya nematode infection is likely to be endemic. Once again, it is up to you how you make your map, but you will be assessed on whether the information it communicates is correct and on how clearly your map conveys the information. As you work, make note of the choices you are making to include in your reflection (see below).Question 1: In the Intro to QGIS tutorial, we walked through modeling year-round malaria risk in Kenya. In that model, we simply looked at whether malaria was present or absent, but of course even in areas where malaria is found, it isn’t necessarily found in the same amount. You are now being tasked with making a map of malaria risk in Kenya in May, showing areas of high, medium, low, and no risk. You’ll need to use all of the exclusionary factors identified in the introductory tutorial (elevation, humidity, and temperature) to identify areas of no risk. Remember that the mosquitoes that carry malaria:Live in areas that are below 1500m in elevationAre active when temperatures are between 21 and 32°C (NOTE: when assessing year-round risk, we only excluded areas that were too hot or too cold all year round. Since we are now looking at a specific month and assessing how active mosquitoes are in that month, we can exclude areas that are too hot or too cold during the month of May using the maximum and minimum May temperatures.)Can reproduce if humidity is above 60%Because mosquitoes breed faster and thus bite more at higher temperatures (as long as it isn't too hot!), you’ll then use the following temperature ranges to assess malaria risk:High risk: average monthly temp >28Medium risk: average monthly temp 25-27.9Low risk: average monthly temp <24.9Note: this intentionally requires you to think about how you can use Raster Calculator to create three different risk bands. If you get stuck, feel free to ask for help, but please try to think it through for at least a couple minutes on your own first. You’ll also need to think about how to symbolize your final map as you have a couple of different options depending on how you created your risk bands. Ultimately, it is up to you how you make your map, but you will be assessed on whether the bands are correct and on how clearly your map conveys the information. As you work, make note of the choices you are making to include in your reflection (see below).Question 2: Another disease that is common in Kenya are intestinal parasites. One type of these parasites, nematodes, move through the soil during parts of their lifecycle so require particular climactic conditions to become endemic in a region. First, they are temperature sensitive and require temperatures between 15 and 25 degrees Celsius to survive (Remember that like mosquitoes, since they have a relatively short lifecycle, there are places where they will be endemic during parts of the year, even if it is too hot or cold during other parts of the year). Second, they require 6% or more soil moisture which is found in places with at least 65% humidity. Given these two constraints, construct a binary (risk / no risk) map of where in Kenya nematode infection is likely to be endemic. Once again, it is up to you how you make your map, but you will be assessed on whether the information it communicates is correct and on how clearly your map conveys the information. As you work, make note of the choices you are making to include in your reflection (see below).
Here are the steps to follow:
STEP 1 (PLEASE COMPLETE BEFORE CLASS)
Go to
qgis.orgLinks to an external site.
and download QGIS.
a. Click the “Download Now” button to see the most recent versions of QGIS available for your device.
b. The website should be able to tell what type of device you are on, but if not, click on the appropriate tab in the download page (Download for Windows, Download for macOS, etc.) that pops up.
c. You will have the option of the “Latest release” (3.30) in a big green button or, underneath, the “Long term release” (3.28). Please download Version 3.28 (the long term release) as it is more stable and should cause less issues than the latest version which is less tested.
NOTE: If you prefer to use the CSDE terminal servers, they already have QGIS installed on them.
d. The download may take a few minutes.
e. Once downloaded, click to install and follow the prompts on your computer. You may have to install a couple packages (that will all download together) in order to get it to work.
f. Trouble shoot the Security and Privacy settings.
1. Try opening QGIS.
2. On a Mac, you will likely get a message that says, “QGIS3.28” can’t be opened because Apple cannot check it for malicious software.” This is because your computer does not recognize the developer.
3. Go to the System Preferences on the Desktop. It is generally accessed through the apple icon in top left corner of your screen.
4. Select the “Security and Privacy” subsection.
5. If the little lock icon is “locked,” you will have to click it to unlock it so that you can make changes.
6. Select the “Open Anyway” button next to the sentence that says, ““QGIS3.28” was blocked from use because it is not from an identified developer.”
7. Now, you should be ready to open QGIS 3.28. Your computer will one more time ask you if you want to open the program. Select “Open.”
STEP 2
Download your data.
a. All of the data associated with this tutorial can be found in
b. Download the zipped file and then unzip it on your computer. Put all contents of that unzipped folder into a single folder where you will save all of your material associated with your lab. I highly recommend saving all of your work and data in a single folder for this class (you can have subfolders within that if you like) so that if you need to move to a different computer, you can simply move the whole folder together. This can be the same folder you used as your Working Directory in Exercise 1 in R. Depending on your computer, you may be able to unzip directly into your folder or you may have to click and drag stuff over.
c. Recall that shapefiles contain multiple files that all have important information for the GIS program to be able to read and depict them. As such, be sure that you keep each of the component files together.
STEP 3
Open QGIS.
a. When you open it, click “New Empty Project” in the pop-up or go to Project in the top menu bar and select “New Project.”
b. You will notice that the screen that first appears has a number of boxes and toolbars. The largest box is your mapping window. On the left-hand side there is also a Browser box and a Layers box.
c. Check out what is there. You can hover over a tool with your mouse and it will tell you what it is. As you become more familiar with it, you will learn what the important tool symbols are.
STEP 4
Save your file.
a. Like in other GIS platforms, map files must be saved in the same relative position to the data you are using. Please save your map in the folder with your data for this tutorial.
b. To save your file, click “Project” in the top menu bar and select ‘Save As.’ Give it a name and save it in your class folder.
c. In the future, if you want to open that file, you would click “Project” and then “Open” and navigate to the file you wish to work on.
STEP 5
Import your data into QGIS.
a. In the Browser window, navigate to your class folder and find the shapefile you want to add. (Alternatively, you can click “Layer” from the top menu bar, then click “Add Layer” and then click “Add Vector Layer”.)
b. Navigate to the Kenya.shp shapefile (shapefiles end with .shp) and click “Open” or double click on it. You should now see an image of a map in your mapping window. This is a shapefile simply showing the boundaries of the country.
c. Then we will add elevation data which is a raster file, so you can either drag the elevation.tif raster into your Browser window or go to “Layer,” “Add Layer,” and then click “Add Raster Layer”).
STEP 6
First, let’s consider elevation. The mosquitoes that carry malaria cannot survive above 1500m. So, let’s figure out which areas of Kenya are below 1500m as those are the only areas at risk.
a. We have a .tif file showing elevation globally (elevation). Since we are only interested in Kenya, let’s shrink our file to only show Kenya. This will make future calculations faster as we will be working with a smaller dataset.
b. To do this, have the elevation file selected (in your Layers window it will be highlighted in blue), and select Raster from the menu bar at the top of your screen, then Extraction, then Clip by Mask Layer….
c. Your input layer should be elevation (this is the layer you are clipping). Your mask layer should be Kenya (this is the layer you are clipping it to). By default, “Match the extent of the clipped raster to the extent of the mask layer” should be selected (if it is not, please check the box next to it).
d. If you scroll down in the clip window, you will see that the default is to “Save to Temporary File” under “Clipped (mask).” Click on the … at the end of that line, select “Save to File,” and save the resulting clip to your class folder.
e. Be sure “Open output file after running algorithm is selected. Then click “Run.”
f. You should now see your new elevation layer only showing Kenya. You can turn off the other layers by unchecking the boxes next to them in the Layers window.
g. Now we want to figure out which parts of Kenya are below 1500m in elevation. To do this, we want to be sure that our new Kenyan elevation layer is selected (it should appear highlighted in blue in your Layers window) and then we want to select Raster from the menu at the top of your screen, and then Raster Calculator.
h. In the pop-up window, start by writing your expression. You’ll want to double click on your Kenyan elevation layer from the list of Raster Bands in the top left corner. Then click on the less than symbol (<) and then type 1500.
i. Next, you’ll need to tell QGIS to save the file so in the top right where it says Output layer, click on the box at the end of the line with the … and tell it to save the file to your class folder.
j. If all looks in order, click “Run.”
k. You should now see a binary Raster file where 0 = areas above 1500m and 1 = areas below 1500m. This means, we have a value of 1 in areas where there could be malaria (where our expression is true) and 0 in areas where there could not be (where our expression is false).
l. For practice, let’s turn this into a polygon. To do this, be sure that this new binary elevation layer is selected (highlighted in blue in your Layers window) and then select Raster from the menu at the top of your screen, then Conversion, then Polygonize (Raster to Vector)….
m. Be sure that your input layer is your binary elevation file and then feel free to rename the field that will appear in your shapefile if you wish. You will also want to tell QGIS where to save the file (do not leave it as a temporary file) and then click “Run.”
n. You’ll now have a shapefile that should look something like the image below. Let’s color the areas that are at risk (based on elevation) a different color than those not at risk. To do this, right click on the layer and select Properties. (If you are using a mac, you can click with two fingers on the mousepad rather than right click).o. Select the “Symbology” tab and then at the very top where it says “Single Symbol”, change that to “Categorized”. For your value, you’ll choose your binary category (this should be the only choice you have) and then you’ll want to click “Classify” near the bottom for the two categories (1 and 0) to autopopulate with different colors. Right click on the color boxes and select “Change Color” to change the color. Select two colors that are intuitive to you and then click “OK” to put them on your map.
STEP 7
Next, we’ll want to consider whether temperature is a limiting factor or not. The mosquitoes that carry malaria can survive in temperatures between 21 and 32 degrees Celsius. They don’t need these temperatures year round, as they can go dormant if it is too hot or cold, but if it is too hot in the coldest month or too cold in the warmest month, you wont find mosquitos. March is the warmest month in Kenya, so if there are areas where the max temperature in March is too cool, we know that malaria will not be a risk factor there. July is the coldest month in Kenya, so if there are areas where the minimum temperature in July is too warm, we know that malaria will not be a risk factor in those areas either. As such, you have been provided with data on maximum temperature in March and minimum temperature in July.
a. Add this data to your map by navigating to MarchMaxTemperature and JulyMinTemperature in the Browser window and either double clicking or dragging them into your Layers window to add them to your map.
b. Following the steps above (step 6 a-f), clip both maps to the boundaries of Kenya.
c. Next, we’ll use the same process as above (step 6 g-k) to create a binary measure of where it is both not too warm in July for malaria and not too cold in March for malaria by combining both measures in our Raster Calculator equation.
d. To do this, select Raster from the menu at the top and then Raster Calculator. Write an expression that will return the areas that are warm enough in July and cool enough in March. (Hint: you can use the AND function to put two conditions together).
STEP 8
The next limiting factor is humidity. The mosquitoes that cause malaria require about 60% relative humidity in order to survive. May is the wettest month in Kenya, so we want to check if any areas of Kenya don’t have sufficient relative humidity in May to sustain the mosquitoes that cause malaria. While calculating relative humidity is a very complex formula, we can approximate it by dividing the actual vapor pressure (in kPa) by 3 (an estimate of our approximate saturation vapor pressure for equatorial regions). Note that this approximation only works in equatorial regions where average annual temperature is approximately 25 degrees Celsius.
a. So, to calculate relative humidity, let’s start by adding our May water vapor pressure data (MayWaterVaporPressure) to our map in the same way we have added other data (step 5c).
b. Next, use the Raster Calculator to make a raster file of relative humidity by dividing the vapor pressure in your May dataset by 3 (see step 6 g-k). Be sure to save the resulting layer in your class folder.
c. Now, we want to use the Raster Calculator as we have before (again see step 6 g-k) so that we can exclude all areas where relative humidity in May is less than 60% (or 0.6). Remember that we want it to assign a value of 1 (or True) to all areas with at least 0.6 relative humidity and a value of 0 (or False) to all areas with less than that.
STEP 9
Finally, let’s put our exclusionary data together to get a single binary raster of where in Kenya we would expect there to be malaria and where we would expect there to be no malaria.
a. We will once again use the Raster Calculator for this. If you wrote all of your conditional statements (the Raster Calculator formulas) such that they were conditions for finding malaria (as opposed to finding areas that don’t have malaria), we can simply create a raster file that multiplies each of our binary results together. Because anything multiplied by 0 is 0, if we multiply each of them together, you should get a map where 0 is assigned to any areas where malaria could not be present (on account of one or more of our above limitations) and 1 shows areas where malaria could be present (at least at some point during the year).
STEP 10
Finally, you’ll want to add a legend and make your map look nice.
a. First, in order to give us more power over the symbology, let’s start by converting our final results from a raster layer to a vector layer. Follow steps l-o in Step 6 above to convert our layer and adjust the symbology.
b. Next, click the “New Print Layout” button (or select Project from the menu at the top and then New Print Layout). This will open a new window where you can make your map look nice. You will have to give it a name before it lets you start.
c. If you ever close this window and want to get back to it, click “Project” in the top menu, click “Layouts” and select the name you assigned the map you want to work on.
1. While it is a bit clunky to move between the project window and the composition window, the beauty of this model is that you can have multiple composition windows associated with a single project. Note that you can also duplicate a layout window by clicking “Duplicate Layout” in the layout window.
d. You should see a blank page. To add your map to the screen, click on the “Add Map” button in the column on the left-hand side of the screen. Nothing will happen, but you can now click and drag a rectangle onto the page to position your map. Your map should show up and will now be listed under Items in the window on the right-hand side of the screen.
e. Use the buttons on the left-hand side to add a legend, text, etc. Notice that as you insert things they appear in the Items window on the right-hand side of the screen. If you click on the items there, the Items Properties window (under the Items window on the right-hand side) will give you a lot of options to adjust the settings of each map element.
STEP 11
When you are happy with your map, export it.
a. In the layout window, click one of the three export buttons at the top of the window (Export as image, SVG, or PDF). The left most button is for saving your map as an image to embed in another document (such as a word document). The middle button is for saving your map as a SVG file for use in some other programs. And the right most button is for exporting your map as a PDF. Note that once you export it, you can’t easily make changes, so be sure to save the map document as well before closing QGIS.