Load the vector object of the Sentinel-2 tiles. When the function is run for the first time, it downloads the vector file from the sen2r GitHub repository and it saves it on disk.
s2_tiles()
An sf spatial object containing the extent of the tiles.
License: GPL 3.0
# Retrieve all the tiles s2tiles <- s2_tiles() # Extract a subset of all the tiles httr::GET( "https://raw.githubusercontent.com/ranghetti/sen2r/devel/utils/vector/ch_bound.rds", httr::write_disk(ch_path <- tempfile()) )#> Response [https://raw.githubusercontent.com/ranghetti/sen2r/devel/utils/vector/ch_bound.rds] #> Date: 2020-04-22 08:32 #> Status: 200 #> Content-Type: application/octet-stream #> Size: 43.8 kB #> <ON DISK> /tmp/RtmpXqkLyR/file429a5424679bch <- readRDS(ch_path) s2tiles_ch <- s2tiles[suppressMessages(sf::st_intersects(ch, s2tiles))[[1]],] s2_coords <- sf::st_coordinates(suppressWarnings(sf::st_centroid(s2tiles_ch))) # Show the tiles plot(s2tiles_ch$geometry, border = "blue")# Use function tiles_intersects() to exclude unuseful tiles.