R/prepareICESareas.R

Defines functions prepareICESareas

Documented in prepareICESareas

#' @title Download and format ICES area polygons
#' @details This function is an Ibrahim hack which does not work optimally because the area polygons supplied on the ICES site are very complex and partly corrupted. Use the premade polygons (\code{data(icesAreas)}) instead. These polygons have been obtained from the ICES GIS team upon request and much simpler. 
#' @author Ibrahim Umar
#' @keywords internal
prepareICESareas <- function() {
    dst <- tempfile()
    utils::download.file("https://gis.ices.dk/shapefiles/ICES_areas.zip", dst)
    shpfiles <- utils::unzip(dst, exdir = paste0(dirname(dst), "/shape"))
    poly <- sf::st_read(dirname(shpfiles[1]))
    unlink(dirname(shpfiles[1]), recursive = TRUE)
    unlink(dst)
    return(poly)
}
MikkoVihtakari/BioticExplorerServer documentation built on Feb. 28, 2025, 11:23 p.m.