Map raster of interpolated oceanographic variable for a cruise.
map_raster(r, legend_title = "Temperature (C)")
raster of type raster::raster()
title for legend of variable mapped
interactive plot of leaflet::leaflet()
(r_tif <- tempfile(fileext=".tif"))
#> [1] "/var/folders/sl/7s3zmk1129jcrgsn1c4hcs2r0000gn/T//RtmpBSt1sc/file23ca62fd4149.tif"
# use second variable from previously fetched v
c(v$table_field[2], v$plot_label[2])
#> Error in eval(expr, envir, enclos): object 'v' not found
# fetch interpolated raster from CalCOFI API
get_raster(
variable = v$table_field[2],
cruise_id = "2020-01-05-C-33RL",
depth_m_min = 0, depth_m_max = 200,
out_tif = r_tif)
#> Error in eval(expr, envir, enclos) : object 'v' not found
#> Error in resp_body_json(.): Unexpected content type "text/csv".
#> • Expecting type "application/json" or suffix "json".
r <- raster::raster(r_tif)
#> Warning: /var/folders/sl/7s3zmk1129jcrgsn1c4hcs2r0000gn/T//RtmpBSt1sc/file23ca62fd4149.tif: No such file or directory (GDAL error 4)
#> Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", ...): Cannot create a RasterLayer object from this file. (file does not exist)
# plot raster
map_raster(r, v$plot_label[2])
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'extent': error in evaluating the argument 'x' in selecting a method for function 'raster': object 'r' not found