Skip to content

Commit

Permalink
Fix #576 again
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Apr 6, 2021
1 parent cf35157 commit 4a07048
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 05-geometry-operations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ We will use a real-world digital elevation model (DEM) because the artificial ra
<!-- because when creating it we made the upper left corner the lowest and the lower right corner the highest value while increasing cell values by one from left to right. -->
Contour lines can be created with the **raster** function `rasterToContour()`, which is itself a wrapper around `contourLines()`, as demonstrated below (not shown):

```{r 05-geometry-operations-66, eval = FALSE}
```{r 05-geometry-operations-66, eval=FALSE}
data(dem, package = "spDataLarge")
cl = rasterToContour(dem)
plot(dem, axes = FALSE)
Expand Down
20 changes: 19 additions & 1 deletion 07-read-write-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,27 @@ usa_sf = st_as_sf(usa)
A second example downloads a series of rasters containing global monthly precipitation sums with spatial resolution of ten minutes.
The result is a multilayer object of class `RasterStack`.

```{r, eval=FALSE, echo=FALSE}
# in case the raster server is down
# library(raster)
# if this fails:
# worldclim_prec = getData(name = "worldclim", var = "prec", res = 10)
if(!file.exists("prec_10m_bil.zip")) {
u = "https://github.com/Robinlovelace/geocompr/releases/download/1.2/prec_10m_bil.zip"
download.file(u, "prec_10m_bil.zip")
unzip("prec_10m_bil.zip", exdir = "prec")
}
worldclim_prec = stack(list.files("prec", pattern = "bil", full.names = TRUE))
saveRDS(worldclim_prec, "worldclim_prec.Rds")
piggyback::pb_upload("worldclim_prec.Rds")
piggyback::pb_download_url("worldclim_prec.Rds")
```


```{r 07-read-write-plot-5}
library(raster)
worldclim_prec = getData(name = "worldclim", var = "prec", res = 10)
u = "https://github.com/Robinlovelace/geocompr/releases/download/1.2/worldclim_prec.Rds"
worldclim_prec = readRDS(url(u))
class(worldclim_prec)
```

Expand Down

0 comments on commit 4a07048

Please sign in to comment.