get_depth | R Documentation |
Extracts depth from basemap bathymetry raster dataset for coordinates in a data frame
get_depth(
data,
bathy.style = "raster_continuous",
lon = NULL,
lat = NULL,
shapefile = "DecimalDegree",
proj.in = 4326,
bind = TRUE,
depth.col = "depth",
verbose = FALSE
)
data |
Data frame or sf object containing geographic coordinates. |
bathy.style |
Character defining the basemap bathymetry raster which should be used for the depth extraction. Valid alternatives: |
lon , lat |
Either the names of the longitude and latitude columns in |
shapefile |
Land shape to which distances should be calculated. Either a character argument referring to a name of pre-made shapefiles in |
proj.in |
|
bind |
Logical indicating whether |
depth.col |
The name of the depth column, if |
verbose |
Logical indicating whether information about the process should be returned as messages. Set to |
Uses the st_extract
function to extract values from basemap bathymetry raster grids. Does not work for vector bathymetries.
Returns a vector if bind = FALSE
, otherwise a data frame. The depths are given in a new column defined by the dist.col
argument. The distances are kilometers. NA
distance means that the position is on land.
Mikko Vihtakari
## Not run:
dt <- data.frame(lon = seq(-20, 80, length.out = 41), lat = 50:90)
dt <- get_depth(dt)
qmap(dt, color = depth) + scale_color_viridis_c()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.