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.
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
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.
Added to my weekly report.
if the actual intent was to calculate area on the surface of a sphere (as opposed to area on a plane), then may i suggest using a unit of measure that’s meaningful for a regular person, like sq. meters or sq. km, as opposed to “square degrees”?
Hi all,
First-time poster.
So has the accuracy of the bounding box been established to be accurate by greater minds than my own? Or can it sometimes be wildly inaccurate as @jwidness suggests?
Doing a number of API calls from an app and it’s somewhat important.
Thanks,
Happy days.
Ryan
Hong Kong
why would this be important for your application? if you’re trying to get an actual area of a polygon, you can always just calculate the area of a given bounding box or the simplified polygons provided by the API. if you’re not sure how to do that calculation, there are lots of existing tools that will do that calculation based on a geoJSON or some similar polygon definition.