Skip to content

Commit 3231eda

Browse files
committed
r_inla_spatial: use PROJ>=6 compliant CRS
1 parent 241d9ce commit 3231eda

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

content/tutorials/r_inla/spatial/index.Rmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ output:
1616
library(knitr)
1717
opts_chunk$set(
1818
message = FALSE,
19+
warning = FALSE, # suppress rgdal CRS warnings here and there
1920
dev = "cairo_pdf",
2021
dpi = 300
2122
)
@@ -329,8 +330,8 @@ PRborder %>%
329330
list() %>%
330331
Polygons(ID = 1) %>%
331332
list() %>%
332-
SpatialPolygons(proj4string = CRS("+init=epsg:4326")) %>%
333-
spTransform(CRS("+init=epsg:5880")) -> boundary
333+
SpatialPolygons(proj4string = CRS(SRS_string = "EPSG:4326")) %>%
334+
spTransform(CRS(SRS_string = "EPSG:5880")) -> boundary
334335
```
335336

336337
```{r mesh-rainfall-1}
@@ -577,7 +578,7 @@ si <- inla.stack.index(stack_all, "grid")$data
577578
grid_data %>%
578579
bind_cols(model_grid$summary.fitted.values[si, ]) %>%
579580
`coordinates<-`(~X + Y) %>%
580-
`proj4string<-`(CRS("+init=epsg:5880")) -> gd
581+
`proj4string<-`(CRS(SRS_string = "EPSG:5880")) -> gd
581582
gd[!is.na(over(gd, boundary)), ] %>%
582583
as.data.frame() %>%
583584
ggplot() + geom_tile(aes(x = X, y = Y, fill = mean)) + coord_fixed()

0 commit comments

Comments
 (0)