Set up.
library(rbgm)
## Loading required package: raster
## Loading required package: sp
## Warning: Installed Rcpp (0.12.11) different from Rcpp used to build dplyr (0.12.10).
## Please reinstall dplyr to avoid random crashes or undefined behavior.
library(sf, quietly = TRUE)
## Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2
data("wrld_simpl", package = "maptools")
Read the native shapefile, and the native BGM.
path <- "~/EastAntarctica_Atlantis/versions/EastAntarctica_BB"
native_shp <- sf::read_sf(path, "EastAntarctica_BB")
native_bgm <- rbgm::bgmfile(file.path(path, "EastAntarctica_BB.bgm"))
print(st_crs(native_shp))
## $epsg
## [1] NA
##
## $proj4string
## [1] "+proj=laea +lat_0=-63 +lon_0=82 +x_0=2500000 +y_0=2000000 +ellps=WGS84 +units=m +no_defs"
##
## attr(,"class")
## [1] "crs"
print(native_bgm$extra$projection)
## [1] "+proj=laea +lat_0=-63 +lon_0=82 +x_0=2500000 +y_0=2000000 +ellps=WGS84 +units=m +no_defs"
Read the longlat shapefile and the longlat BGM.
ll_shp <- sf::read_sf(path, "EastAntarctica_BB_ll")
ll_bgm <- rbgm::bgmfile(file.path(path, "EastAntarctica_BB_ll.bgm"))
print(st_crs(ll_shp))
## $epsg
## [1] 4326
##
## $proj4string
## [1] "+proj=longlat +datum=WGS84 +no_defs"
##
## attr(,"class")
## [1] "crs"
print(ll_bgm$extra$projection)
## [1] "+proj=longlat +a=6378137.0 +es=0.0066943799901413165 +lon_0=0d00 +lat_0=0d00 +x_0=0.0 +y_0=0.0"
Make maps.
The native projection, with basic graticule and the coarse coastline.
plot(boxSpatial(native_bgm), col = sample(viridis::viridis(nrow(native_bgm$boxes))))
plot(st_geometry(native_shp), col = NA, lty = 2, lwd = 3, border = "firebrick", add = TRUE)
plot(st_graticule(native_shp), add = TRUE)
plot(st_transform(st_as_sf(subset(wrld_simpl, NAME == "Antarctica")), st_crs(native_shp)), add = TRUE, col = "grey")
The longlat version, with basic graticule and the coarse coastline.
plot(boxSpatial(ll_bgm), col = sample(viridis::viridis(nrow(native_bgm$boxes))))
plot(st_geometry(ll_shp), col = NA, lty = 2, lwd = 3, border = "firebrick", add = TRUE)
plot(st_graticule(ll_shp), add = TRUE)
plot(st_as_sf(subset(wrld_simpl, NAME == "Antarctica")), add = TRUE, col = "grey")