4.4 Exercises

  • It was established in Section 4.2 that Canterbury was the region of New Zealand containing most of the 100 highest points in the country.How many of these high points does the Canterbury region contain?

  • Which region has the second highest number of nz_height points in, and how many does it have?

  • Generalizing the question to all regions: how many of New Zealand’s 16 regions contain points which belong to the top 100 highest points in the country? Which regions?

    • Bonus: create a table listing these regions in order of the number of points and their name.
  • Use data(dem, package = "RQGIS"), and reclassify the elevation in three classes: low, medium and high.Secondly, attach the NDVI raster (data(ndvi, package = "RQGIS")) and compute the mean NDVI and the mean elevation for each altitudinal class.
  • Apply a line detection filter to raster(system.file("external/rlogo.grd", package = "raster")).Plot the result.Hint: Read ?raster::focal().
  • Calculate the NDVI of a Landsat image.Use the Landsat image provided by the spDataLarge package (system.file("raster/landsat.tif", package="spDataLarge")).
  • A StackOverflow post shows how to compute distances to the nearest coastline using raster::distance().Retrieve a digital elevation model of Spain, and compute a raster which represents distances to the coast across the country (hint: use getData()).Second, use a simple approach to weight the distance raster with elevation (other weighting approaches are possible, include flow direction and steepness); every 100 altitudinal meters should increase the distance to the coast by 10 km.Finally, compute the difference between the raster using the Euclidean distance and the raster weighted by elevation.Note: it may be wise to increase the cell size of the input raster to reduce compute time during this operation.

References

Qiu, Fang, Caiyun Zhang, and Yuhong Zhou. 2012. “The Development of an Areal Interpolation ArcGIS Extension and a Comparative Study.” GIScience & Remote Sensing 49 (5): 644–63. https://doi.org/10.2747/1548-1603.49.5.644.

Tobler, Waldo R. 1979. “Smooth Pycnophylactic Interpolation for Geographical Regions.” Journal of the American Statistical Association 74 (367): 519–30. https://doi.org/10.1080/01621459.1979.10481647.

Tomlin, C. Dana. 1990. Geographic Information Systems and Cartographic Modeling. Englewood Cliffs, N.J: Prentice Hall.

Burrough, P. A., Rachael McDonnell, and Christopher D. Lloyd. 2015. Principles of Geographical Information Systems. Third. Oxford, New York: Oxford University Press.

Liu, Jian-Guo, and Philippa J. Mason. 2009. Essential Image Processing and GIS for Remote Sensing. Chichester, West Sussex, UK, Hoboken, NJ: Wiley-Blackwell.

Wegmann, Martin, Benjamin Leutner, and Stefan Dech, eds. 2016. Remote Sensing and GIS for Ecologists: Using Open Source Software. Data in the Wild. Exeter: Pelagic Publishing.


  • This can be verified with identical(st_geometry(nz), st_geometry(nz_avheight)).

  • Map algebra operations are also possible with headerless rasters; in this case the user has to make sure that in fact there exists a one-to-one locational correspondence.An example showing how to import a headerless raster into R is provided in a post at https://stat.ethz.ch/pipermail/r-sig-geo/2013-May/018278.html.