Introduction

The giscourse package contains some quickly typed functions based on the material in the introduction to open source gis course. The package implements a few examples in the course as R functions. This saves typing out all the lines of code needed and allows the functions to be re-run quickly for different sites. However, these are high level functions, with preset defaults. They may not do exactly what you want. In this case you can edit and adapt the functions by applying the concepts that are explained in the course. The functions are aimed mainly at simplifying the task of setting up an R GIS environment with some commonly used data layers.

Quick map

The simplest way to form a web map is just to type qmap() into the console, or into a code chunk within a markdown document. This will map the bounding box of Bournemouth as a default area. If you type some other text as the input then the function will attempt to geocode the text and zoom to the appropriate place.

library(giscourse)
qmap()

Notice that the map can be taken full screen and contains a geocoding serach control. You can use that to test a search for another place name that could be used as the focus for a map.

As you move the mouse over the map you will see the latitude and longitude of the point shown at the top. This is very useful if you want to focus on a point that does not have name. Write down the longitude and latitude for use in a query. Notice that you can change the base maps using the menu at the top.

Adding a WMS

The local geoserver can be used to visualise some layers in WMS format. These layers are only for visualisation and cannot be analysed directly. However WMS layers can be zoomed to any extent without putting any strain on the system.

qmap("Arne, Dorset") %>% uk_wms()

WMS with query

The geoserver has been set up with sql queries on the priority habitat and landcover layers. So if two key words are provided to the hab_wms() function two wms layers will be added to the quick map.

qmap() %>% hab_wms(hab="calc",bhab="Grass")

Deforestation mapping

The package provides quick access to Hansen’s analysis of global deforestation.

https://earthenginepartners.appspot.com/science-2013-global-forest

The raw data can be clipped to a site for analysis. The WMS layer provides a visual representation of the raster layer.

qmap("Sumatra") %>% hansen_wms()

Capturing a polygon or set of points

The package has a function for quickly digitising some geometries from within an interactive R sesssion. Type emap into the console. The results are saved in the database and also returned as an object.

conn<-connect()
#mp<-emap()
st_read(conn,"emap") %>% mapview()
disconnect()
#> [1] TRUE