Requests, length and height calculation

Hello, and have a good time. I have come across a case in Sentinel Hub. I would appreciate it if you could guide me in this case.

Because the cost of each request depends on the length and width of the output image, on the other hand, depending on the size of the polygon, the quality of the output image cannot be defined as a fixed number. How can I calculate the length and width of the input polygon?

By the way, I obtained the length and width of the area in degrees using the bbox information, but when I divide by 0.00009, the obtained numbers are different from the length and width numbers of the request builder, and my output image is stretched as well.

Hi @sahar ,

You can use our Requests Builder to obtain the height and width of your image. Simply put the resolution in meters in the Output window (Fig 1), then find out the value of height/width in the Request Preview window (Fig 2).

Fig 1

Fig 2

If you’re using Python, our sentinelhub Python Package also has a function bbox_to_dimensions to help you calculate the height and width of your image.

Note that 0.00009 is just an approximate value at the equator. The actual value you need to convert degree to meter can be different depending on the location of your bounding box. Also, the value is different in x- and y-axis.

Thank you for answering and for your complete explanation.
Yes, as you mentioned, both Request Builder and Python are good, still, I am not familiar with Python, and I need to code the conversion of bbox to length and width (in Sentinel Hub to JavaScript), still, in Request Builder, it is calculated automatically.
Moreover, since the area is large, I have to use grade-based CRS

Hi @sahar ,

We use haversine formula for the Requests builder.

Note that the result will still be an approximate because Earth is not a sphere, but the result will be better than computing via dividing degrees by 0.00009.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.