An error occurred while loading the file. Please try again.
-
Guillaume Perréal authored11f62e8c
import argparse
from scenes import load_scenes, Index, utils
# Arguments
parser = argparse.ArgumentParser(description="Search scenes intesecting an ROI",)
parser.add_argument("--pickle_file", help="List of scenes (serialized in pickle format)", required=True)
parser.add_argument("--roi", help="ROI. Can be a vector or a raster", required=True)
params = parser.parse_args()
# Load scenes list
scenes = load_scenes(params.pickle_file)
# spatial index
print("Indexation...")
idx = Index(scenes)
# search
print("Search roi")
bbox_fn = utils.get_bbox_wgs84_from_raster if params.roi.lower().endswith(".tif") \
else utils.get_bbox_wgs84_from_vector
matches = idx.find(bbox_wgs84=bbox_fn(params.roi))
print(f"{len(matches)} scenes found.")
for i, scene_match in enumerate(matches):
print(f"Scene #{i}")
print(scene_match)