Skip to content

Commit

Permalink
replace rgdal with terra (not checked carefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Mar 27, 2024
1 parent 2ff8d84 commit b9f1c7d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SOmap
Type: Package
Title: Southern Ocean maps
Version: 0.6.2.9003
Version: 0.6.2.9004
Authors@R: c(person("Dale", "Maschette", email = "dale.maschette@aad.gov.au", role = c("aut", "cre")),
person("Michael", "Sumner", role = "aut"),
person("Ben", "Raymond", role = "aut"))
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dev

* add rgdal to Remotes so it can install from github
* Removed rgdal.

* Changed underlying method of getting background bathymetry for SOmap_auto().

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The `SOmap_auto()`, `SOmap()`, and `SOmap2()` functions return the data used to
```{r automap2, fig.height = 5, fig.width = 5}
data("albatross", package = "adehabitatLT")
## convert the albatross data to a single matrix of lon, lat points
albatrack <- do.call(rbind, lapply(albatross, function(z) gdal_project(rbind(as.matrix(z[, c("x", "y")]), NA), source = "+proj=utm +zone=42 +south +datum=WGS84", proj = "EPSG:4326")))
albatrack <- do.call(rbind, lapply(albatross, function(z) terra::project(rbind(as.matrix(z[, c("x", "y")]), NA), from = "+proj=utm +zone=42 +south +datum=WGS84", to = "EPSG:4326")))
## construct the map and return it, but don't plot it
alb_map <- SOmap_auto(albatrack[, 1], albatrack[, 2])
Expand Down
6 changes: 3 additions & 3 deletions vignettes/SOmap-introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ One reason for this is that if we choose a projection where the east and west ed
```{r laea}
## scale factor
f <- 3e6
plot(gdal_project(lonlat, "+proj=laea +lat_0=-90 +datum=WGS84"), asp = 1, type = "l",
plot(terra::project(lonlat, to = "+proj=laea +lat_0=-90 +datum=WGS84", from = "EPSG:4326"), asp = 1, type = "l",
xlim = c(-1, 1) * f, ylim = c(-1, 1) * f, xlab = "", ylab = "")
```
Expand All @@ -118,7 +118,7 @@ In `m` we have the maps data structure, and this looks promising.
str(m)
mp <- m
pxy <- gdal_project(lonlat, "+proj=laea +lat_0=-90 +datum=WGS84")
pxy <- terra::project(lonlat, to = "+proj=laea +lat_0=-90 +datum=WGS84", from "EPSG:4326")
mp$x <- pxy[,1]
mp$y <- pxy[,2]
mp$range <- c(range(mp$x,na.rm = TRUE), range(mp$y, na.rm = TRUE))
Expand Down Expand Up @@ -149,7 +149,7 @@ maps::map(col = "grey", fill = TRUE)
mpmerc <- m
pxy <- gdal_project(lonlat, "+proj=merc +datum=WGS84")
pxy <- terra::project(lonlat, to = "+proj=merc +datum=WGS84", from = "EPSG:4326")
mpmerc$x <- pxy[,1]
mpmerc$y <- pxy[,2]
mpmerc$range <- c(range(mpmerc$x,na.rm = TRUE), range(mpmerc$y, na.rm = TRUE))
Expand Down
2 changes: 1 addition & 1 deletion vignettes/many-automap-examples.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ temporarily turn this off ...
```{r examples26, eval = FALSE}
data("albatross", package = "adehabitatLT")
## convert the albatross data to a single matrix of lon, lat points
albatrack <- do.call(rbind, lapply(albatross, function(z) gdal_project(rbind(as.matrix(z[, c("x", "y")]), NA), "+proj=utm +zone=42 +south +datum=WGS84", inv = TRUE)))
albatrack <- do.call(rbind, lapply(albatross, function(z) terra::project(rbind(as.matrix(z[, c("x", "y")]), NA), from = "+proj=utm +zone=42 +south +datum=WGS84", to = "EPSG:4326")))
## construct the map and return it, but don't plot it
alb_map <- SOmap_auto(albatrack[, 1], albatrack[, 2])
Expand Down

0 comments on commit b9f1c7d

Please sign in to comment.