Extract environmental data - pt based
sp_extract_pt(x, from = "noaa_isd", radius = 50, select = "first", date = NULL)
x | input data.frame |
---|---|
from | which data source, only 'noaa_isd' for now OR an object with data in it, including data.frame or SpatialPointsDataFrame |
radius | radius, in km, for which to search for stations/point locations
from each input point in |
select | Ignored right now |
date | Date to search for data for. Ignored if you supply your own
env data in |
Works for the use case of finding locations for point based stations, e.g., floats/buoys type data
if (FALSE) { file <- system.file("examples", "obis_mola_mola.csv", package = "spenv") dat <- read.csv(file, stringsAsFactors = FALSE) head(dat) # data.frame input res <- sp_extract_pt(x = dat[1:10,], radius = 10) dplyr::bind_rows(res) # spatial objects ## SpatialPointsDataFrame - w/ NOAA remote data library("sp") coordinates(dat) <- ~longitude + latitude sp_extract_pt(dat, radius = 10) ## SpatialPointsDataFrame - w/ data.frame file <- system.file("examples", "noaa_data.csv", package = "spenv") ref <- read.csv(file, stringsAsFactors = FALSE) sp_extract_pt(x = dat, from = ref, radius = 10) }