Sentinelhub package Image dimensions

Hello community,

I am trying to understand the use of Sentinelhub python package and understand its bbox_to_dimensions() function that returns the image dimensions in pixels (width, height) given the bounding box and resolution in metres. When I use request builder for a given bounding box and set the resolution to (10m, 10m), the size parameter of the sh-py request gives one value and for the same bounding box and resolution using bbox_to_dimensions from the sentinelhub python package, I get a different value for the size. Why is this so? Could you please let me know why does the sentinelhub package give a different result from the request builder?

Here is my request:
bounding box: [
] in EPSG:4326.

In the request builder, the size parameter in sh-py requests shows size =
[1450.4182979693774, 1572.7321809625796] for 10m resolution

For the same bounding box, on sentinelhub package, the result is : (1411,1603)

Hi Shreyas

the bbox_to_dimensions() is more of an informative utility. What it does is that it reprojects the bbox vertices into an appropriate UTM coordinate system (which is in meters) and then tries to get the dimensions based on the resolution.

The method assumes that it is a box However, a box in WGS84 is not really a box, since the coordinate system is wrapped. This can give you very wrong results when used far from the equator. Therefore, this function should not be used for any precision calculations, but to give you an estimate.

Hope this helps you out!

I see. Thats why it gives incorrect values. Could you please let me know what function I can use instead to get accurate dimensions? Also what function does the request builder use in the background to compute accurate dimensions?

Hi Shreyas,

The methodology in Request Builder is slightly different from the function in SH-PY. Firstly, it calculates height and northern and southern width of AOI bbox in meters using haversine formula. Then it takes the height and the greater of the two widths and divides them by the input resolution to get the pixel size.

Currently, this function does not exist in SH-PY and we do not have plans to add it at this time.