sentinel-hub / sentinelhub-py

Download and process satellite imagery in Python using Sentinel Hub services.
http://sentinelhub-py.readthedocs.io/en/latest/
MIT License
798 stars 243 forks source link

[HELP] Get pixel at point (x, y) #491

Open AdrienWehrle opened 8 months ago

AdrienWehrle commented 8 months ago

Question

Hi, I'm trying to find a rule to extract the one and only pixel at (x, y) coordinates given a bounding box to add to earthspy. I thought that creating a very small bounding box smaller than the satellite resolution (eg 1 meter) would be enough to target the pixel (associated trial here but it looks like the bounding box need to cover the entire pixel at least... Which makes it tricky to select the pixel alone and not neighboring ones depending on the resolution... Would you by any chance have a method to point to a specific pixel? Thank you a lot in advance!

Additional context

Add any information that would help us supporting you.

mlubej commented 8 months ago

Hi @AdrienWehrle!

Such practices are not so common for SH, so we don't have any utilities/methods to point to specific pixels. What we would usually do is get a larger area around the pixel of interest and download spatially aggregated data, which makes more sense in terms of stability, especially when you think about image registration issues.

If you still want to proceed this way, and assuming you know the resolution of the data, you could construct a BBox which is 100% aligned with the pixel of interest. For example, in case of Sentinel-2, you would need to provide the bbox in the appropriate UTM crs which is aligned to 10 m in both directions. Something like [min_x, min_y, min_x + res_x, min_y + res_y]

Hope this helps!

Regards, Matic