# Bbox_area calculation doesn't use the correct formula for square degrees

iNat calculates and stores the area of the bounding box for each place. Based on the code, it seems to be intending to calculate this in units of square degrees, but because the Earth is a sphere and the calculation assumes planar geometry, the area is overestimated – sometimes by a lot. Around half of all places have their bounding box area overestimated by more than 25%, and at high latitudes it can exceed 4x. For example, Franz Josef Land, has an actual bounding box area of 6.8 square degrees, but iNat has it listed as 42.8.

1 Like

what are square degrees? how do you even square degrees?

you can square meters or kilometers…

The basic formula is 180/pi * abs(sin(lat1) - sin(lat2)) * abs(lng1 - lng2), but you might have to account for bounding boxes which cross the date line, the equator, or both? Edit: Not to mention bounding boxes which enclose one of the poles. Do I have to mention those?

Franz Josef Land:
NE: 81.90degN 65.58degE
SW: 79.84degN 44.86degE
Area ~ 6.8 square degrees (°)2

3 Likes

ok. so a “square degree” is a unit of measure with a funny name – like how a dragonfly is neither a dragon nor a fly, but it is like a dragon and a fly.

i think this is is the way the square degrees formula should go:

180 / pi * abs(sin(lat1*pi/180)-sin(lat2*pi/180)) * abs(lng1-lng2)

or:

X * Y / pi, where Y = 180 * abs(sin(lat1*pi/180)-sin(lat2*pi/180)), and X = abs(lng1-lng2)

i think you may have to handle cases where the bounding box crosses the antimeridian, depending on how the bounding box is expressed, but i don’t think it matters if the box crosses the equator, and the box cannot by definition exceed the poles (though it should be fine if it includes the poles).

also, i was thinking about the original post, and a simple X * Y bounding box area calculation might actually be appropriate, depending on how it’s going to be used. if the coordinates are stored as ESPG:4326, which is basically a rectangle 360 degrees wide by 180 degrees high, then maybe a simple X * Y calculation does give you an appropriate bounding box area, relative to that rectangle.

2 Likes