Skip to content

Commit fbe5c02

Browse files
Merge branch 'main' into main
2 parents 7d69690 + fed2af1 commit fbe5c02

2 files changed

Lines changed: 64 additions & 102 deletions

File tree

learners/images/01-rstudio.png

386 KB
Loading

learners/setup.md

Lines changed: 64 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,38 @@ This workshop is designed to be run on your local machine. First, you will need
88

99
## Data
1010

11-
You can download all of the data used in this workshop by clicking
12-
[this download link](https://ndownloader.figshare.com/articles/2009586/versions/10). The file is 218.2 MB.
11+
You can download all of the data used in this workshop by clicking [this download link](https://ndownloader.figshare.com/articles/2009586/versions/10). The file is 218.2 MB.
1312

14-
Clicking the download link will automatically download all of the files to your default download directory as a single compressed
15-
(`.zip`) file. To expand this file, double click the folder icon in your file navigator application (for Macs, this is the Finder
16-
application).
13+
Clicking the download link will automatically download all of the files to your default download directory as a single compressed (`.zip`) file. To expand this file, double click the folder icon in your file navigator application (for Macs, this is the Finder application).
1714

1815
For a full description of the data used in this workshop see the [data page](instructors/data.md).
1916

2017
## Option A: Local Installation
2118

2219
### Software
2320

24-
| Software | Install | Manual | Available for | Description |
25-
| -------- | ------- | ------ | --------------------- | ------------------------------------------------------------- |
26-
| [GDAL](https://www.gdal.org) | [Link](https://gdal.org/download.html) | [Link](https://gdal.org) | Linux, MacOS, Windows | Geospatial model for reading and writing a variety of formats |
27-
| [GEOS](https://trac.osgeo.org/geos) | [Link](https://trac.osgeo.org/geos) | [Link](https://geos.osgeo.org/doxygen/) | Linux, MacOS, Windows | Geometry models and operations |
28-
| [PROJ.4](https://proj4.org) | [Link](https://proj4.org/install.html) | [Link](https://proj4.org/index.html) | Linux, MacOS, Windows | Coordinate reference system transformations |
29-
| [R](https://www.r-project.org) | [Link](https://cloud.r-project.org) | [Link](https://cloud.r-project.org) | Linux, MacOS, Windows | Software environment for statistical and scientific computing |
30-
| [RStudio](https://www.rstudio.com) | [Link](https://www.rstudio.com/products/rstudio/download/#download) | | Linux, MacOS, Windows | GUI for R |
31-
| [UDUNITS](https://www.unidata.ucar.edu/software/udunits/) | [Link](https://www.unidata.ucar.edu/downloads/udunits/index.jsp) | [Link](https://www.unidata.ucar.edu/software/udunits/#documentation) | Linux, MacOS, Windows | Unit conversions |
21+
| Software | Install | Manual | Available for | Description |
22+
|------------|------------|------------|------------|-------------------------|
23+
| [R](https://www.r-project.org) | [Link](https://cloud.r-project.org) | [Link](https://cloud.r-project.org) | Linux, MacOS | Software environment for statistical and scientific computing |
24+
| [RStudio](https://www.rstudio.com) | [Link](https://www.rstudio.com/products/rstudio/download/#download) | | Linux, MacOS | GUI for R |
3225

3326
We provide quick instructions below for installing the various software needed for this workshop. At points, they assume familiarity with the command line and with installation in general. As there are different operating systems and many different versions of operating systems and environments, these may not work on your computer. If an installation doesn't work for you, please refer to the installation instructions for that software listed in the table above.
3427

35-
### GDAL, GEOS, and PROJ.4
36-
37-
The installation of the geospatial libraries GDAL, GEOS, and PROJ.4 varies significantly based on operating system. These are all dependencies for `sf`, the `R` package that we will be using for spatial data operations throughout this workshop.
38-
39-
:::::::::::::::: spoiler
40-
28+
::: spoiler
4129
## Windows
4230

4331
To install the geospatial libraries, install the latest version [RTools](https://cran.r-project.org/bin/windows/Rtools/)
32+
:::
4433

45-
:::::::::::::::::::::::::
46-
47-
:::::::::::::::: spoiler
48-
34+
::: spoiler
4935
## macOS - Install with Packages (Beginner)
5036

5137
The simplest way to install these geospatial libraries is to install the latest version of [Kyng Chaos's pre-built package](https://www.kyngchaos.com/software/frameworks) for GDAL Complete. Be aware that several other libraries are also installed, including the UnixImageIO, SQLite3, and `NumPy`.
5238

5339
After downloading the package in the link above, you will need to double-click the cardbord box icon to complete the installation. Depending on your security settings, you may get an error message about "unidentified developers". You can enable the installation by following [these instructions](https://kb.wisc.edu/page.php?id=25443) for installing programs from unidentified developers.
40+
:::
5441

55-
:::::::::::::::::::::::::
56-
57-
:::::::::::::::: spoiler
58-
42+
::: spoiler
5943
## macOS - Install with Homebrew (Advanced)
6044

6145
Alternatively, participants who are comfortable with the command line can install the geospatial libraries individually using [homebrew](https://brew.sh):
@@ -65,102 +49,91 @@ $ brew install proj
6549
$ brew install geos
6650
$ brew install gdal
6751
```
52+
:::
6853

69-
:::::::::::::::::::::::::
70-
71-
:::::::::::::::: spoiler
72-
54+
::: spoiler
7355
## Linux
7456

7557
Steps for installing the geospatial libraries will vary based on which form of Linux you are using. These instructions are adapted from the [`sf` package's `README`](https://github.com/r-spatial/sf).
7658

7759
For **Ubuntu**:
7860

79-
```bash
61+
``` bash
8062
$ sudo add-apt-repository ppa:ubuntugis
8163
$ sudo apt-get update
8264
$ sudo apt-get install libgdal-dev libgeos-dev libproj-dev
8365
```
8466

8567
For **Fedora**:
8668

87-
```bash
69+
``` bash
8870
$ sudo dnf install gdal-devel proj-devel geos-devel
8971
```
9072

9173
For **Arch**:
9274

93-
```bash
75+
``` bash
9476
$ pacman -S gdal proj geos
9577
```
9678

9779
For **Debian**: The [rocker geospatial](https://github.com/rocker-org/geospatial) Dockerfiles may be helpful. Ubuntu Dockerfiles are found [here](https://github.com/r-spatial/sf/tree/master/inst/docker). These may be helpful to get an idea of the commands needed to install the necessary dependencies.
98-
99-
:::::::::::::::::::::::::
80+
:::
10081

10182
### UDUNITS
10283

10384
Linux users will have to install UDUNITS separately. Like the geospatial libraries discussed above, this is a dependency for the `R` package `sf`. Due to conflicts, it does not install properly on Linux machines when installed as part of the `sf` installation process. It is therefore necessary to install it using the command line ahead of time.
10485

105-
:::::::::::::::: spoiler
106-
86+
::: spoiler
10787
## Linux
10888

10989
Steps for installing the geospatial will vary based on which form of Linux you are using. These instructions are adapted from the [`sf` package's `README`](https://github.com/r-spatial/sf).
11090

11191
For **Ubuntu**:
11292

113-
```bash
93+
``` bash
11494
$ sudo apt-get install libudunits2-dev
11595
```
11696

11797
For **Fedora**:
11898

119-
```bash
99+
``` bash
120100
$ sudo dnf install udunits2-devel
121101
```
122102

123103
For **Arch**:
124104

125-
```bash
105+
``` bash
126106
$ pacaur/yaourt/whatever -S udunits
127107
```
128108

129109
For **Debian**:
130110

131-
```bash
111+
``` bash
132112
$ sudo apt-get install -y libudunits2-dev
133113
```
134-
135-
:::::::::::::::::::::::::
114+
:::
136115

137116
### R
138117

139118
Participants who do not already have `R` installed should download and install it.
140119

141-
:::::::::::::::: spoiler
142-
120+
::: spoiler
143121
## Windows
144122

145123
To install `R`, Windows users should select "Download R for Windows" from RStudio and CRAN's [cloud download page](https://cloud.r-project.org), which will automatically detect a CRAN mirror for you to use. Select the `base` subdirectory after choosing the Windows download page. A `.exe` executable file containing the necessary components of base R can be downloaded by clicking on "Download R 3.x.x for Windows".
124+
:::
146125

147-
:::::::::::::::::::::::::
148-
149-
:::::::::::::::: spoiler
150-
126+
::: spoiler
151127
## macOS
152128

153129
To install `R`, macOS users should select "Download R for (Mac) OS X" from RStudio and CRAN's [cloud download page](https://cloud.r-project.org), which will automatically detect a CRAN mirror for you to use. A `.pkg` file containing the necessary components of base R can be downloaded by clicking on the first available link (this will be the most recent), which will read `R-3.x.x.pkg`.
130+
:::
154131

155-
:::::::::::::::::::::::::
156-
157-
:::::::::::::::: spoiler
158-
132+
::: spoiler
159133
## Linux
160134

161135
To install `R`, Linux users should select "Download R for Linux" from RStudio and CRAN's [cloud download page](https://cloud.r-project.org), which will automatically detect a CRAN mirror for you to use. Instructions for a number of different Linux operating systems are available.
162-
163-
:::::::::::::::::::::::::
136+
:::
164137

165138
### RStudio
166139

@@ -170,29 +143,28 @@ RStudio is a GUI for using `R` that is available for Windows, macOS, and various
170143

171144
The following `R` packages are used in the various geospatial lessons.
172145

173-
- [`dplyr`](https://cran.r-project.org/package=dplyr)
174-
- [`ggplot2`](https://cran.r-project.org/package=ggplot2)
175-
- [`raster`](https://cran.r-project.org/package=raster)
176-
- [`rgdal`](https://cran.r-project.org/package=rgdal)
177-
- [`rasterVis`](https://cran.r-project.org/package=rasterVis)
178-
- [`remotes`](https://cran.r-project.org/package=remotes)
179-
- [`sf`](https://cran.r-project.org/package=sf)
146+
- [`dplyr`](https://cran.r-project.org/package=dplyr)
147+
- [`ggplot2`](https://cran.r-project.org/package=ggplot2)
148+
- [`raster`](https://cran.r-project.org/package=raster)
149+
- [`rgdal`](https://cran.r-project.org/package=rgdal)
150+
- [`rasterVis`](https://cran.r-project.org/package=rasterVis)
151+
- [`remotes`](https://cran.r-project.org/package=remotes)
152+
- [`sf`](https://cran.r-project.org/package=sf)
180153

181-
To install these packages in RStudio, do the following:
182-
1\. Open RStudio by double-clicking the RStudio application icon. You should see
183-
something like this:
154+
To install these packages in RStudio, do the following:\
155+
1. Open RStudio by double-clicking the RStudio application icon. You should see something like this:
184156

185-
![](/fig/01-rstudio.png){alt='RStudio layout'}
157+
![](fig/01-rstudio.png){alt="RStudio layout"}
186158

187159
2\. Type the following into the console and hit enter.
188160

189-
```r
161+
``` r
190162
install.packages(c("dplyr", "ggplot2", "raster", "rgdal", "rasterVis", "sf"))
191163
```
192164

193165
You should see a status message starting with:
194166

195-
```output
167+
``` output
196168
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/dplyr_0.7.6.tgz'
197169
Content type 'application/x-gzip' length 5686536 bytes (5.4 MB)
198170
==================================================
@@ -206,7 +178,7 @@ downloaded 3.4 MB
206178

207179
When the installation is complete, you will see a status message like:
208180

209-
```output
181+
``` output
210182
The downloaded binary packages are in
211183
/var/folders/7g/r8_n81y534z0vy5hxc6dx1t00000gn/T//RtmpJECKXM/downloaded_packages
212184
```
@@ -221,24 +193,21 @@ This option involves downloading an Docker image that contains an installation o
221193

222194
Once up and running - you'll have full access to RStudio right from your browser:
223195

224-
![](/fig/docker.png){alt='RStudio layout in browser showing similarity to desktop layout'}
196+
![](fig/docker.png){alt="RStudio layout in browser showing similarity to desktop layout"}
225197

226198
Please be aware that the `R` package `rasterVis` is not included in the `rocker/geospatial` Docker image. If your instructor teaches with this package then you will need to install this `R` package yourself. All other `R` packages will already be installed for you.
227199

228-
:::::::::::::::: spoiler
229-
200+
::: spoiler
230201
## Downloading and Installing Docker Community Edition
231202

232203
To get started with Docker, download the [Docker Community Edition](https://www.docker.com/community-edition) from [Docker's store](https://store.docker.com/search?type=edition&offering=community). Community editions are available for [Windows](https://store.docker.com/editions/community/docker-ce-desktop-windows), [macOS](https://store.docker.com/editions/community/docker-ce-desktop-mac), and Linux operating systems including [Debian](https://store.docker.com/editions/community/docker-ce-server-debian), [Fedora](https://store.docker.com/editions/community/docker-ce-server-fedora), and [Ubuntu](https://store.docker.com/editions/community/docker-ce-server-ubuntu).
233204

234205
The download pages for each of these operating systems contain notes about some necessary system requirements and other pre-requisites. Once you download the installer and follow the on-screen prompts.
235206

236207
Additional installation notes are available in Docker's documentation for each of these operating systems: [Windows](https://docs.docker.com/docker-for-windows/install/), [macOS](https://docs.docker.com/docker-for-mac/install/), [Debian](https://docs.docker.com/install/linux/docker-ce/debian/), [Fedora](https://docs.docker.com/install/linux/docker-ce/fedora/), and [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/).
208+
:::
237209

238-
:::::::::::::::::::::::::
239-
240-
:::::::::::::::: spoiler
241-
210+
::: spoiler
242211
## Using the `rocker/geospatial` Docker Image via the Command Line
243212

244213
#### Download and Set-up
@@ -247,23 +216,23 @@ Once Docker is installed and up and running, you will need to open your computer
247216

248217
You need to have already installed Docker Community Edition (see instructions above) before proceeding. Once you have Docker downloaded and installed, make sure Docker is running and then enter the following command into the terminal to download the `rocker/geospatial` image:
249218

250-
```bash
219+
``` bash
251220
$ docker pull rocker/geospatial
252221
```
253222

254223
Once the pull command is executed, the image needs to be run to become accessible as a container. In the following example, the image is named `rocker/geospatial` and the container is named `gis`. The [image](https://docs.docker.com/glossary/?term=image) contains the software you've downloaded, and the [container](https://docs.docker.com/glossary/?term=container) is the run-time instance of that image. New Docker users should need only one named container per image.
255224

256225
When `docker run` is used, you can specify a folder on your computer to become accessible inside your RStudio Server instance. The following `docker run` command exposes Jane's `GitHub` directory to RStudio Server. Enter the file path where your workshop resources and data are stored:
257226

258-
```bash
227+
``` bash
259228
$ docker run -d -P --name gis -v /Users/jane/GitHub:/home/rstudio/GitHub -e PASSWORD=mypass rocker/geospatial
260229
```
261230

262231
When she opens her RStudio instance below, she will see a `GitHub` folder in her file tab in the lower righthand corner of the screen. Windows and Linux users will have to adapt the file path above to follow the standards of their operating systems. More details are available on [rocker's Wiki](https://github.com/rocker-org/rocker/wiki/Sharing-files-with-host-machine).
263232

264233
The last step before launching your container in a browser is to identify the port that your Docker container is running in:
265234

266-
```bash
235+
``` bash
267236
$ docker port gis
268237
```
269238

@@ -273,30 +242,28 @@ An output, for example, of `8787/tcp -> 0.0.0.0:32768` would indicate that you s
273242

274243
When you are done with a Docker session, make sure all of your files are saved locally on your computer **before closing your browser and Docker**. Once you have ensured all of your files are available (they should be saved at the file path designated in `docker run` above), you can stop your Docker container in the terminal:
275244

276-
```bash
245+
``` bash
277246
$ docker stop gis
278247
```
279248

280249
#### Re-starting a Container
281250

282251
Once a container has been named and created, you cannot create a container with the same name again using `docker run`. Instead, you can restart it:
283252

284-
```bash
253+
``` bash
285254
$ docker start gis
286255
```
287256

288257
If you cannot remember the name of the container you created, you can use the following command to print a list of all named containers:
289258

290-
```bash
259+
``` bash
291260
$ docker ps -a
292261
```
293262

294263
If you are returning to a session after stopping Docker itself, make sure Docker is running again before re-starting your container!
264+
:::
295265

296-
:::::::::::::::::::::::::
297-
298-
:::::::::::::::: spoiler
299-
266+
::: spoiler
300267
## Using the `rocker/geospatial` Docker Image via Kitematic
301268

302269
#### Download and Install Kitematic
@@ -307,17 +274,17 @@ If you are returning to a session after stopping Docker itself, make sure Docker
307274

308275
Once you have installed Kitematic, make sure the Docker application is running and then open Kitematic. You should not need to create a login to use Kitematic. If prompted for login credentials, there is an option to skip that step. Use the search bar in the main window to find `rocker/geospatial` (pictured below) and click `Create` under that Docker repository.
309276

310-
![](/fig/kitematicSearch.png)
277+
![](fig/kitematicSearch.png)
311278

312279
After downloading and installing the image, your container should start automatically. Before opening your browser, connect your Docker image to a local folder where you have your workshop resources stored by clicking on the `Settings` tab and then choosing `Volumes`. Click `Change` and then select the directory you would like to connect to.
313280

314-
![](/fig/kitematicLocal.png)
281+
![](fig/kitematicLocal.png)
315282

316283
When you open RStudio instance below, you will see the contents of the connected folder inside the `kitematic` directory in the file tab located in the lower righthand corner of the screen.
317284

318285
When you are ready, copy the `Access URL` from the `Home` tab:
319286

320-
![](/fig/kitematicURL.png)
287+
![](fig/kitematicURL.png)
321288

322289
Paste that url into your browser and, if prompted, enter `rstudio` for both the username and the password.
323290

@@ -326,37 +293,32 @@ Paste that url into your browser and, if prompted, enter `rstudio` for both the
326293
When you are done with a Docker session, make sure all of your files are saved locally on your computer **before closing your browser and Docker**. Once you have ensured all of your files are available (they should be saved at the file path designated in `docker run` above), you can stop your Docker container by clicking on the `Stop` icon in Kitematic's toolbar.
327294

328295
You can restart your container later by clicking the `Restart` button.
296+
:::
329297

330-
:::::::::::::::::::::::::
331-
332-
:::::::::::::::: spoiler
333-
298+
::: spoiler
334299
## Managing Docker Containers and Images
335300

336301
To obtain a list of all of your current Docker containers:
337302

338-
```bash
303+
``` bash
339304
$ docker ps -a
340305
```
341306

342307
To list all of the currently downloaded Docker images:
343308

344-
```bash
309+
``` bash
345310
$ docker images -a
346311
```
347312

348313
These images can take up system resources, and if you'd like to remove them, you can use the `docker prune` command. To remove any Docker resources not affiliated with a container listed under `docker ps -a`:
349314

350-
```bash
315+
``` bash
351316
$ docker system prune
352317
```
353318

354319
To remove **all** Docker resources, including currently named containers:
355320

356-
```bash
321+
``` bash
357322
$ docker system prune -a
358323
```
359-
360-
:::::::::::::::::::::::::
361-
362-
324+
:::

0 commit comments

Comments
 (0)