Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

BITC / NBD protocol - 8

0 (0 Likes / 0 Dislikes)
The next step is to bring your well-known shapefile into R. You will rasterize it so that all well-known sites have values of 1, and all other sites in the study area have values of 0. You'll need to load 3 libraries in R. The first library is 'maptools'. This library will work with your shapefiles. The second library is 'raster'. This will rasterize your shapefiles and output new grids for use in QGIS. The third library is 'rgdal'. This is a dependency of the raster package, and it's best to load it separately. Whenever you're working in R, you need to navigate to the folder where all of your data is located. This is called your working directory. So, go ahead and set the directory to where the data is located. If you want to see what's inside of the folder, type: dir(). This will give you a list of all of the files inside of the folder. The first step is to read in the boundary of the study area. This example is using Ghana data, so we'll read in a shapefile of the boundary of Ghana. If you would like to look at the boundary, type: plot(shapefileName). This should allow you to see the outline of the shapefile to the right. We want to convert this to a raster object. We will change it to raster using the same extent as the shapefile. And, we need to give it a projection. We'll use the same projection as the shapefile. Then, we need to specify the cell size or spatial resolution. In this case, we'll use 0.1 degrees. The final step is to rasterize it. Sometimes this can take a bit to process. Once it's done rasterizing, we'll plot it to the right. You'll know it's done processing when the carrot (>) appears in the lower left corner of the R console. This will be a raster of the extent of Ghana. R will automatically assign a value of 1 to any empty raster that you create. But, we want values of 1 in the well-sampled sites only; and, values of 0 everywhere else. So, we'll take this raster —which is basically is giant matrix— and multiply it by 0 to convert all of the values in the raster to 0. The next step is to bring in the shapefile of the well-known sites. We can take a quick look at this shapefile as well. We're going to follow the same steps to rasterize this shapefile. We don't need to supply all of the parameters that we did previously because the parameters of the new raster object will be based on those of the raster created from the Ghana boundary. Because these are the well-known sites, we want the vales of these rasterized cells to equal 1. So, let's plot the new raster object. You can see the cells are all yellow, so they're equal to 1 according to the scale on the right. Again, these are the well-known sites. The final step is to combine these two rasters so that the well-known and not well-known sites are joined and matched to the Ghana boundary. Let's plot the final raster object. The green boxes are the well-sampled sites with values of 1. The gray area has values of 0. And, everything matches to the extent of the Ghana boundary. Now, we need to be able to import these rasters into QGIS. Right now, they're just objects within R. So, we'll write out a raster file that can be used in other programs. First, we'll write out an ASCII file. ASCIIs aren't very large, and they're good generic files to work with. They're just good to have on hand. We'll also write out a GTIFF file. This will work best for the next step that Town will lead you through in QGIS. If we re-check the contents of our working directory, we should see the two new rasters that we created. Once you've completed these steps, you can exit R. You're data should now be ready to import into QGIS.

Video Details

Duration: 7 minutes and 9 seconds
Country:
Language: English
License: Dotsub - Standard License
Genre: None
Views: 1
Posted by: townpeterson on Jul 26, 2016

This video gives a step-by-step through the protocol being used in the course on National Biodiversity Diagnoses, an advanced course focused on developing summaries of state of knowledge of particular taxa for countries and regions. The workshop was held in Entebbe, Uganda, during 12-17 January 2015. Workshop organized by the Biodiversity Informatics Training Curriculum, with funding from the JRS Biodiversity Foundation.

Caption and Translate

    Sign In/Register for Dotsub to translate this video.