hull: Add a convex hull to a map

Description Usage Arguments Details Value Examples

View source: R/hull.R

Description

Add a convex hull to a map

Usage

1
hull(x, ...)

Arguments

x

input

...

ignored

Details

Can be used with map_leaflet(), map_plot(), and map_ggplot(). Other methods in this package may be supported in the future.

Value

Adds a convex hull to the plot. See grDevices::chull() for info.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# map spocc output, here using a built in object
data(occdat_eg1)
map_plot(occdat_eg1, hull = TRUE)

# map rgbif output, here using a built in object
hull(map_ggplot(occdat_eg1))

## Not run: 
# leaflet
library("spocc")
spp <- c('Danaus plexippus', 'Accipiter striatus', 'Pinus contorta')
dat <- occ(spp, from = 'gbif', limit = 30, has_coords = TRUE)
hull(map_leaflet(dat))

# ggplot
if (requireNamespace("rgbif")) {
library("rgbif")
res <- occ_search(scientificName = "Puma concolor", limit = 100)
hull(map_ggplot(res))
}

# base plots
library("spocc")
out <- occ(query='Accipiter striatus', from='gbif', limit=25,
  has_coords=TRUE)
map_plot(out, hull = TRUE)

## End(Not run)

mapr documentation built on Oct. 23, 2020, 8:22 p.m.