Hi, I am trying to download S2 images for a large area. I’ve splitted my boundig box in smaller patches and now I can download each one manually with the SentinelHubRequest object. I want to automate the process, but I cannot find a way to get the path where the tiff is saved from the get_data() or save_data() methods. Is there a way to this ? Thanks.
Hi,
You’d have to specify the data_folder
parameter in the SentinelHubRequest
object. Then calling request.get_data(save_data=True)
or directly request.save_data()
would save the data.
Please check section 4 and 4.1 in this example.
If you also wanted to process these data you could do so with eo-learn, you can find an example on how to do that here.
Yes, the problem is that I am doing multiple downloads to the same folder and I don’t have a direct way to know the path of the most recent one (for example) since it gets merged with all the rest. It would be nice to have something like this:
path_to_saved_data = request.save_data()
Although I recognise that it could be solved by making a new folder for each download and then just get the contents of that folder. In any case, I solved the issue by deleting my data folder before each download of all patches, and I also found gdal merge is a great tool to reconstruct the original tiff from the patches.
I see what you meant. Yes, getting the path is a good solution. Would be great if you could open an issue here, so we can evaluate how/whether to fix it.
The batch processing API is otherwise tailored to such use-case if you just wanted the tiff files.
Thanks, I definitely want to check out the batch processing API since now I am replicating the single use examples with loops and I feel that would be a better solution.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.