Description Usage Arguments Details Value dataset options region options Examples
Filter points within ecoregions
1 2 3 4 5 | eco_region(x, dataset = "meow", region, lat = NULL, lon = NULL, drop = TRUE)
regions_meow()
regions_fao()
|
x |
(data.frame) A data.frame |
dataset |
(character) the dataset to use. one of: "meow" (Marine Ecoregions of the World), "fao" (). See Details. |
region |
(character) one or more region names. has the form |
lat, lon |
(character) name of the latitude and longitude column to use |
drop |
(logical) Drop bad data points or not. Either way, we parse out
bad data points as an attribute you can access. Default: |
see scrubr_cache
for managing the cache of data
Returns a data.frame, with attributes
Marine Ecoregions of the World (meow):
data from: https://opendata.arcgis.com/datasets/ed2be4cf8b7a451f84fd093c2e7660e3_0.geojson
Food and Agriculture Organization (fao):
data from: http://www.fao.org/geonetwork/srv/en/main.home?uuid=ac02a460-da52-11dc-9d70-0017f293bd28
within meow:
ECOREGION: many options, see regions_meow()
ECO_CODE: many options, see regions_meow()
and you can use others as well; run regions_meow()
to get the data used
within eco_region()
and see what variables/columns can be used
within fao:
OCEAN: Atlantic, Pacific, Indian, Arctic
SUBOCEAN: 1 through 11 (inclusive)
F_AREA (fishing area): 18, 21, 27, 31, 34, 37, 41, 47, 48, 51, 57, 58, 61, 67, 71, 77, 81, 87, 88
and you can use others as well; run regions_fao()
to get the data used
within eco_region()
and see what variables/columns can be used
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 29 30 31 32 33 34 35 36 | ## Not run:
if (requireNamespace("mapview") && requireNamespace("sf") && interactive()) {
## Marine Ecoregions of the World
wkt <- 'POLYGON((-119.8 12.2, -105.1 11.5, -106.1 21.6, -119.8 20.9, -119.8 12.2))'
res <- rgbif::occ_data(geometry = wkt, limit=300)$data
res2 <- sf::st_as_sf(res, coords = c("decimalLongitude", "decimalLatitude"))
res2 <- sf::st_set_crs(res2, 4326)
mapview::mapview(res2)
tmp <- eco_region(dframe(res), dataset = "meow",
region = "ECOREGION:Mexican Tropical Pacific")
tmp2 <- sf::st_as_sf(tmp, coords = c("decimalLongitude", "decimalLatitude"))
tmp2 <- sf::st_set_crs(tmp2, 4326)
mapview::mapview(tmp2)
## filter many regions at once
out <- eco_region(dframe(res), dataset = "meow",
region = c("ECOREGION:Mexican Tropical Pacific", "ECOREGION:Seychelles"))
out
out2 <- sf::st_as_sf(out, coords = c("decimalLongitude", "decimalLatitude"))
out2 <- sf::st_set_crs(out2, 4326)
mapview::mapview(out2)
## FAO
## FIXME - this needs fixing, broken
wkt <- 'POLYGON((72.2 38.5,-173.6 38.5,-173.6 -41.5,72.2 -41.5,72.2 38.5))'
manta_ray <- rgbif::name_backbone("Mobula alfredi")$usageKey
res <- rgbif::occ_data(manta_ray, geometry = wkt, limit=300, hasCoordinate = TRUE)
dat <- sf::st_as_sf(res$data, coords = c("decimalLongitude", "decimalLatitude"))
dat <- sf::st_set_crs(dat, 4326)
mapview::mapview(dat)
tmp <- eco_region(dframe(res$data), dataset = "fao", region = "OCEAN:Indian")
tmp <- tmp[!is.na(tmp$decimalLongitude), ]
tmp2 <- sf::st_as_sf(tmp, coords = c("decimalLongitude", "decimalLatitude"))
tmp2 <- sf::st_set_crs(tmp2, 4326)
mapview::mapview(tmp2)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.