rbgm-Spatial: Convert to spatial format

Description Usage Arguments Details Value Warning Examples

Description

Take the output of bgmfile and return a Spatial object or a sf object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
boxSpatial(bgm)

box_sp(bgm)

box_sf(bgm)

boundarySpatial(bgm)

boundary_sp(bgm)

boundary_sf(bgm)

node_sp(bgm)

point_sp(bgm)

faceSpatial(bgm)

face_sp(bgm)

face_sf(bgm)

Arguments

bgm

output of a BGM file, as returned by bgmfile

Details

Note that the '_sp' forms are aliased to original functions called '*Spatial', and now have '_sf' counterparts to return that format.

Value

Spatial* object or sf object

Warning

The sf objects created by 'box_sf()', 'node_sf()', 'face_sf()', 'boundary_sf()' and 'point_sf()' were not created by the sf package. They were created with reference to the sf format prior to November 2019. If you have problems it may be necessary to recreate the 'crs' part of the of the object with code like 'x <- box_sf(bgm); library(sf); st_crs(x) <- st_crs(attr(x$geometry, "crs")$proj)'.

Get in touch ([create an issue](https://github.com/AustralianAntarcticDivision/rbgm/issues)) if you have any troubles.

Examples

1
2
3
4
5
6
7
8
fname <- bgmfiles::bgmfiles(pattern = "antarctica_28")
bgm <- bgmfile(fname)
spdf <- box_sp(bgm)
sfdf <- box_sf(bgm)
sldf <- face_sp(bgm)

plot(spdf, col = grey(seq(0, 1, length = nrow(bgm$boxes))))
plot(sldf, col = rainbow(nrow(bgm$faces)), lwd = 2,  add = TRUE)

mdsumner/rbgm documentation built on April 20, 2020, 9:43 p.m.