Take the 2-minute tour ×

What formula could I use to calculate the size in Kilometres of a bounding box based on a given Southwest latitude/longitude and a Northeast latitude/longitude points?

The bounding box format is defined as:

bounds = sw_latitude,sw_longitude,ne_latitude,ne_longitude
share|improve this question
Welcome to SE.GIS forum . In which software you want to calculate the a bounding box? –  Sunil Apr 25 '13 at 6:03
Do you want the extent in geographic coordinates, as suggested by your use of latitude and longitude, or in projected coordinates, as indicated by your request for size in kilometers? The two boxes usually have different sizes and different shapes. If you want the former, note that it does not have a single "size": its sides will be geodesic and of equal length, but its top and bottom will be circles of latitude and usually of different lengths, giving three "sizes" altogether. There is no such problem in the latter case. –  whuber Apr 25 '13 at 13:51
I am doing a bounding box search on a MySQL database and I would like to check the area size of the given SouthWest and NorthEast points is not too large. –  Chris Apr 25 '13 at 14:43
is the data in a spacial format or just in strings? –  dassouki Apr 25 '13 at 14:46
add comment

1 Answer

Generally to calculate the area of a bbox in a projected coordinate system since it's a (big) rectangle you can use the area formula :

enter image description here

area = (sw_longitude - ne_longitude) * (sw_latitude - ne_latitude)

Depending now on your spatial location (ie you're in a projected crs) the above formula will give you square mapunits (km^2, m^2 whatever).

In case you're in a sphere, like earth, you can use the sperical zone approach:

enter image description here

Where the area can be calculated with the following formula :

enter image description here

where :

enter image description here and l2>l1

And since you want a sector of the zone, you'll need to multiply the above with enter image description here where α = lat2 - lat1

Thus the formula for the bbox area equals with:

enter image description here


share|improve this answer
Your proposal fails to calculate the area correctly, making huge errors for regions away from the Equator. A spherical approximation will work well enough. Let the two longitudes be l1 < l2, the latitudes be f1 < f2 (all in degrees), and let R = 6,371.0072 kilometers be the earth's authalic radius. The BB area equals R^2 * (cos(f2)-cos(f1)) * (l2-l1) / 180 square kilometers. For comparing areas you could drop the multiplicative constant R^2/180, leaving a formula almost as simple as yours--but much more accurate. –  whuber Jul 25 '13 at 14:18
Yes you are correct, once again :) I'll update the answer accordingly. The simple area approach won't work in a projected CRS though? And shouldn't be a pi in the numerator? Area_sphere_zone = 2*π*R*h -> Area_sphere_zone_arc = 2 * π * R^2 * (cos()-cos()) * (α/360)? –  nickves Jul 25 '13 at 16:07
(1) In a projected CRS the geographic bounding box will be a curvilinear shape and so its area is not easily found. (2) Yes, a factor of Pi belongs there: where in my comment I inserted 1/180 I should have used Pi/180 to convert from degrees to radians. Thanks for catching that. Also, "cos" should be "sin" (again my mistake: you would use "cos" only with colatitudes, which is not the geographic convention). As a double-check, the formula will give R^2 * Pi * (sin(90) - sin(-90)) * (180 - (-180)) / 180 = 4 * Pi * R^2 for the sphere's surface area, which is correct. –  whuber Jul 25 '13 at 18:11
add comment

Your Answer


