SpatialPolygons
. Useful for plotting (see example). The function bb_earth
returns a spatial polygon of the 'boundaries' of the earth, which can also be done in other projections (if a feasible solution exists).
bb_sp(x, projection = NULL, steps = 100, stepsize = NA, as.sf = FALSE)
bb_earth(projection = NULL, stepsize = 1, earth.datum = "WGS84", bbx = c(-180, 180, -90, 90), buffer = 1e-06, as.sf = FALSE)
bb
x
are provided, see get_proj4
. For bb_earth
, projection
is the projection in which the bounding box is returned (if possible).steps
sf
object"WGS84"
, other frequently used datums are "NAD83"
and "NAD27"
. Any other PROJ.4
character string can be used. See get_proj4
.c(-180, 180, -90, 90)
. If for some projection
, a feasible solution does not exist, it may be wise to choose a smaller bbx, e.g. c(-180, 180, -88, 88)
. However, this is also automatically done with the next argument, buffer
.1e-06
). This value is subtracted from each the bounding box coordinates. If it still does not result in a feasible bounding box, this procedure is repeated 5 times, where each time the buffer is multiplied by 10. Set buffer=0
to disable this procedure.if (require(tmap)) {
data(Europe)
current.mode <- tmap_mode("view")
qtm(bb_sp(Europe))
# restore mode
tmap_mode(current.mode)
}
Run the code above in your browser using DataLab