The function orders S2 products from Long Term Archive.

  s2_prodlist = NULL,
  export_prodlist = TRUE,
  delay = 0.5,
  apihub = NA,
  service = NA,
  reorder = TRUE



Named character: list of the products to be ordered, in the format safelist (see safelist). Alternatively, it can be the path of a JSON file exported by a previous execution of s2_order, in case the user wants, for any reason, to resubmit the order.


Logical or character: if TRUE (default), the list of ordered products is saved in a JSON text file, so to be easily retrievable at a later stage with safe_is_online or s2_download; if FALSE, no output files are generated. It is also possible to pass the path of an existing folder in which the JSON file will be saved (otherwise, a default path is used).


Numeric: time frame (in seconds) to leave between two consecutive orders. Default is 0.5 seconds: use a higher value if you encountered errors (i.e. not all the products were correctly ordered).


Path of the apihub.txt file containing credentials of SciHub account. If NA (default), the default location inside the package will be used.


Character: it can be "dhus" or "apihub", in which cases the required service is forced instead that the one present in the URLs passed through argument s2_prodlist. If NA (default), the service present in the URLs is maintained.


Logical: If TRUE, and a json file exported by s2_order is passed as argument to the function, try to order again also the "available" and "ordered" S2 datasets. Otherwise, only order the "notordered" ones.


A named vector, containing the subset of s2_prodlist elements which were ordered. Moreover, the vector includes the following attributes:

  • "available" with the elements of s2_prodlist which were already available for download,

  • "notordered" with the elements of s2_prodlist which were not ordered for any reasons,

  • "path" (only if argument export_prodlist is not FALSE) with the path of the json file in which the list of the products (ordered, available and not ordered) was saved (if export_prodlist = TRUE).


License: GPL 3.0


L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. doi: 10.1016/j.cageo.2020.104473 , URL:


Luigi Ranghetti, phD (2019)

Lorenzo Busetto, phD (2020)


if (FALSE) { # Generate the lists of products pos <- sf::st_sfc(sf::st_point(c(-57.8815,-51.6954)), crs = 4326) time_window <- as.Date(c("2019-10-21", "2019-11-20")) list_safe <- s2_list(spatial_extent = pos, time_interval = time_window) print(list_safe) # (at the time the documentation was updated, this list was containing 6 # archives already available online and 3 stored in the Long Term Archive) # Order the products ordered_prods <- s2_order(list_safe) # Check in a second time if the product was made available (order_path <- attr(ordered_prods, "path")) safe_is_online(order_path) }