Dealing with Sentinel Tile Borders

Hello everyone,

I’m currently working with a model in southern Spain, and I’ve encountered an issue regarding the border between two Sentinel tiles within my study area. The Sentinel satellite’s orbit, from north to south, captures images every few seconds, resulting in consecutive north and south tiles with a slight time gap between them. Since my area falls on the border between these tiles, I’m facing challenges in accurately processing the data.

When using openeo to download the tiles, I noticed that the saved files only include the date of capture in their names. Initially, I assumed this would be sufficient to differentiate between images since the next picture is captured after several days. However, given the specific satellite orbit pattern and tile borders, this approach seems inadequate.

How can I address this issue and ensure that I can effectively differentiate between images captured on either side of the tile border using openeo? Should I utilize the tile_grid parameter, and if so, how can I configure it to account for the unique characteristics of the Sentinel orbit and tile layout in my study area?

Any insights or suggestions would be greatly appreciated. Thank you!

Hi,

Could you provide us with some sample code that shows what you’re trying to achieve and where it goes wrong? That will make it easier for us to provide some specific suggestions for your use case.

Kind regards,
Jeroen

Hey there!

I’m in the process of downloading some images from an area of interest, and I need to keep them separate based on their TileID. You see, I have two different photos from the same date, and it’s crucial to distinguish between them. My initial approach was to save the files with just the date since I knew the next image wouldn’t be available for many days. However, it turns out that the subject area falls right on the border between two Sentinel tiles, complicating matters.

Here’s a snippet of the code I’m using:

aoi <- "C:/Users/1/Desktop/Work - BGU/juniper_RBD.gpkg"
from_date <- "2023-11-22"
to_date <- "2023-12-22"

library(openeo)
con <- connect(host = "https://openeo.dataspace.copernicus.eu")
openeo::login()

# Extracting bbox from the aoi file
catch = sf::st_read(aoi)
bbox_t = sf::st_bbox(obj = catch)

# get the process collection to use the predefined processes of the back-end
p = openeo::processes()

# get the collection list to get easier access to the collection ids, via auto completion
collections = openeo::list_collections()

# get the formats
formats = openeo::list_file_formats()

# load the initial data collection and limit the amount of data loaded
# note: for the collection id and later the format you can also use the its character value
cube = p$load_collection(id = collections$SENTINEL2_L2A,
                         spatial_extent = bbox_t,
                         temporal_extent = c(from_date, to_date),
                         bands = c('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B11', 'B12'),
                         properties = list(
                         "eo:cloud_cover" = function(x) x <= 10))

veg_index = "SAVI"
#' @title Calculate Vegetation Index function
calculate_vi_ <- function(x, context){
  
  # loading bands colors
  blue = x["B02"]
  green = x["B03"]
  red = x["B04"]
  nir = x["B08"]
  
  if (veg_index == "NDVI") {
      vi_rast = ((nir - red) / (nir + red))
  } else if (veg_index == "SAVI") {
      vi_rast = ((1.5 * (nir - red)) / (nir + red + 0.5) )
  } else if (veg_index == "MSAVI") {
      vi_rast = ((2 * nir + 1 - sqrt((2 * nir + 1)^2 - 
          8 * (nir - red))) / 2)
  } else if (veg_index == "CI") {
      vi_rast = (1-((red - blue) / (red + blue)))
  } else if (veg_index == "BSCI") {
      vi_rast = ((1-(2*(red - green))) / 
          (terra::mean(green, red, nir, na.rm = TRUE)))
  } else {
      message("Unrecognized index: ", veg_index)
      vi_rast = NULL
  }
  return(vi_rast)
}
cube_s2_vi = p$reduce_dimension(data = cube, reducer = calculate_vi_, dimension = "bands")
result = p$save_result(data = cube_s2_vi, format = formats$output$GTiff, options = list(filename_prefix=veg_index))

job_1 = openeo::create_job(graph = result, title = "check prefix")
openeo::start_job(job = job_1, log = TRUE)

jobs_vi = openeo::list_results(job = job_1)
openeo::download_results(job = job_1, folder = "C:/Users/1/Desktop/c2/check")

As you can see, the filenames of the saved files only include the date of the photo. However, since the subject area straddles two tiles, I need a way to differentiate between them. Any ideas on how I could achieve this?

My output:
image

Expected:
image

You can ignore the vi index; it’s just for the example
Looking forward to your suggestions!

Thanks,
Ron

Dear @ronbeiden7 , maybe you can run one process for each tile separately?

Look at the example I was working on here: Sentinel-2 data: how to filter by tile or recognize provenance? - #4 by michele.claus

1 Like

Hi @michele.claus, thanks for your response. I noticed in the code you provided that you filter by a specific tile ID. My intention was to download a series of images, and if I encounter a scenario where there are two tiles, I need a way to differentiate between them.