diff --git a/scenes/download.py b/scenes/download.py
index 05c516a8039fb028fd4016b352d5e14473827566..190ddbc762e691f7fc9ff9fcf009438fe1b472a3 100644
--- a/scenes/download.py
+++ b/scenes/download.py
@@ -173,7 +173,40 @@ class TheiaDownloader:
                 else:
                     print("\t{} already downloaded. Skipping.".format(acq_date))
 
-def download_closest(config_file, acq_envelope, acq_date, level="LEVEL3A"):
+def download_in_range(config_file, bbox_wgs84, start_date, end_date, download_dir=None, level="LEVEL3A",
+                      max_records=500):
+    """
+    Download all images within spatial and temporal ranges
+    :param config_file: theia config file
+    :param bbox_wgs84: bounding box (WGS84)
+    :param start_date: start date (datetime.datetime)
+    :param end_date: end date (datetime.datetime)
+    :param download_dir: download directory
+    :param level: LEVEL2A, LEVEL3A, ...
+    :param max_records: maximum number of records
+    """
+    # lonmin, latmin, lonmax, latmax
+    box = '{},{},{},{}'.format(bbox_wgs84[2], bbox_wgs84[0], bbox_wgs84[3], bbox_wgs84[1])
+    dict_query = {
+        "box": box,
+        "startDate": start_date.strftime("%Y-%m-%d"),
+        "completionDate": end_date.strftime("%Y-%m-%d"),
+        "maxRecords": max_records,
+        "processingLevel": level
+    }
+
+    # Theia downloader
+    downloader = TheiaDownloader(config_file)
+
+    # Search products
+    search_results = downloader.query(dict_query)
+
+    # Download products
+    if download_dir:
+        downloader.download(search_results, download_dir)
+
+
+def download_closest(config_file, bbox_wgs84, acq_date, download_dir=None, level="LEVEL3A"):
     """
     query theia catalog, download_closest the files
     """
@@ -182,9 +215,9 @@ def download_closest(config_file, acq_envelope, acq_date, level="LEVEL3A"):
     ndays_seek = datetime.timedelta(days=17)  # temporal range to check for monthly synthesis
 
     # Query products
-    print(acq_envelope)
+    print(bbox_wgs84)
     # box={lonmin},{latmin},{lonmax},{latmax}'
-    box = '{},{},{},{}'.format(acq_envelope[2], acq_envelope[0], acq_envelope[3], acq_envelope[1])
+    box = '{},{},{},{}'.format(bbox_wgs84[2], bbox_wgs84[0], bbox_wgs84[3], bbox_wgs84[1])
     dict_query = {'box': box}
     start_date = acq_date - ndays_seek
     end_date = acq_date + ndays_seek
@@ -234,6 +267,5 @@ def download_closest(config_file, acq_envelope, acq_date, level="LEVEL3A"):
             print("\t{} ({})".format(description_date, selected_tile[tile_name][description_date]["delta"]))
 
     # Download products
-    #downloader.download(selected_tile, get_local_file)
-
-    return selected_tile
+    if download_dir:
+        downloader.download(selected_tile, download_dir)
diff --git a/test/download_test.py b/test/download_test.py
index d4b0c097ad20a194210d3a469b505c57a7aa5687..e4edd6cf3fb5104093f1ab03dc46617fbf07fb2a 100644
--- a/test/download_test.py
+++ b/test/download_test.py
@@ -6,9 +6,11 @@ import datetime
 parser = argparse.ArgumentParser(description="Download test",)
 parser.add_argument("--refimage", required=True)
 parser.add_argument("--theia_cfg", required=True)
+parser.add_argument("--download_dir")
 params = parser.parse_args()
 
 # Get all scenes in the root_dir
 _, _, bbox = utils.get_epsg_extent_bbox(params.refimage)
 acq_date = datetime.datetime(year=2020, month=1, day=1)
-download.download_closest(config_file=params.theia_cfg, acq_envelope=bbox, acq_date=acq_date)
\ No newline at end of file
+download.download_closest(config_file=params.theia_cfg, acq_envelope=bbox, acq_date=acq_date,
+                          download_dir=params.download_dir)