User Tools

Site Tools


courses:msc:msc-phygeo-remote-sensing:worksheets:rs-ws-02-2

W02-2: Crop aerial images

This worksheet will deal with the cropping of raster data sets which is a quite common operation in image pre-processing, primarily in order to reduce computation costs.

After completing this worksheet, you should be able to crop raster data sets in R.

Things you need for this worksheet

  • R — the interpreter can be installed on any operation system. For Linux, you should use the r-cran packages supplied for your Linux distribution. If you use Ubuntu, this is one of many starting points. If you use Windows, you could install R from the official CRAN web page.

  • R Studio — we recommend to use R Studio for (interactive) programming with R. You can download R Studio from the official web page.

  • Git environment for your operating system. For Windows users with little experience on the command line we recommend GitHub Windows.

  • your aerial images from W02-1: Aerial images I/O
  • LiDAR-derived raster data layer (optional) available from

    GeoMOC - a data repository holding various data sets for visualization and download.

Learning log assignments

8-) As always, please add these entries to your today's learning log in the beginning of your Rmd file you will use to push to your GitHub classroom.

  • Favorite aspect of the session (if any)
  • Superfluous aspect of the session (if any)
  • Eureka effect (if any)
  • Links to what I've learned so far (if any)
  • Questions (if any)

As today's special, please complete the following assignment:

After downloading the aerial images of Marburg University forest as part of W02-1: Aerial images I/O, the eastern extent of the to eastern most images is still 1 by 2 km larger then necessary for a rough overlay of the LiDAR and aerial data sets. Although this overlay is not intended for the time being, we will use the extent of the LiDAR data set as a template for the study region. Hence, the eastern most areas of the two images at question are just producing computation time so let's crop these images. If you do not want to use the LiDAR rasters you have created as part of last weeks assignment, you can download one layer from GeoMOC.

:-\ Please write an R script which crops the two eastern most aerial images to the extent of the LiDAR data set. Please make sure that the new raster files do not overwrite the original ones by e.g. saving the new files into a folder called “aerial_croped”. Mark the original and no longer necessary files with the suffix “deprc”.

:-\ Please copy the code of the above R script to an Rmd file with html output, add a screenshot of the cropped images as visualized in a GIS software of your choice and include it in your GitHub classroom repository.

Please make sure that for assignments like the one above (i.e. those which use the Rmd just to show not actually run the code) the opening statement for the code block in the Rmd file includes the evaluation statement set to false, i.e.
```{r, eval=FALSE}
# Your code here...
```
If you wonder why you should first write an R script and then copy the code to a Rmd file, here's the explanation. If you use an Rmd file you will have to re-compute everything again once you knitr it for the final time. That's just a waste of time since this assignment does not require an actual run-time output from R but just a screenshot of the created product.
courses/msc/msc-phygeo-remote-sensing/worksheets/rs-ws-02-2.txt · Last modified: 2016/11/03 09:12 by tnauss