# Convert Long and Lat Co-ordinates to Square Miles

I have a set of Long and Lat co-ordinates making up a five point polygon which I have converted in excel using the following formula:

=((X1*Y2)-(X2*Y1)+(X2*Y3)-(X3*Y2)+(X3*Y4)-(X4*Y3)+(X4*Y5)-(X5*Y4)+(X5*Y1)-(X1*Y5))*0.5

*Replacing X,Y with cell references of course.

This gives me a negative number but how do I convert this number to square miles or kilometres?

Help please I need to work out irregular shape areas!!

-
Thank you a lot for this, I have spent some time getting the right calculations - I Hope! However would you mind checking my work? It's allways nice to have a greater mind then mine give it a once over. I used the following site to easily get my co-ordinates : itouchmap.com/latlong.html I then input into the above formula, then worked out the area seperately, then to find the square miles I multiplied by 3.861E-07 or 0.00000003861 to get the result. However my result is 1789415 square miles and I am positive my area is not that big, any idea where I am going wrong? Thank you. –  user2660 Apr 13 '11 at 15:51
I just tried the formula I posted to try and approximate the area of my home city, and it worked fine. You need to make sure your last point is the same as your first point (so a rectangle is actually a polygon with 5 points). I suspect that is your issue. –  Sasa Ivetic Apr 13 '11 at 17:35
You're probably not closing the ring: In the formula, (x5, y5) must be the same as (x1, y1). BTW, if your polygon doesn't circle a pole, you can omit the "2+" terms in the formula: they all cancel out. (Including them actually degrades numerical precision near the equator.) –  whuber Apr 13 '11 at 20:46

Try this formula (assuming your source is WGS1984, if not then you'll need to adjust the ellipsoid used by the second line):

``````area = rad(x2 - x1) * (2 + sin(rad(y1)) + sin(rad(y2))) + rad(x3 - x2) * (2 + sin(rad(y2)) + sin(rad(y3))) + rad(x4 - x3) * (2 + sin(rad(y3)) + sin(rad(y4))) + rad(x5 - x4) * (2 + sin(rad(y4)) + sin(rad(y5)))

area = abs(area * 6378137.0 * 6378137.0 / 2.0)
``````

rad() is a function that converts Degrees to Radians (i.e. Degrees * PI / 180)

Source: OpenLayers LinearRing

This will result in an area returned in square meters.

-
@whuber: Thanks for noticing the missing parenthesis! –  Sasa Ivetic Apr 13 '11 at 14:39
+1 Quite effective. This formula applies a cylindrical equal-area projection (for a sphere, not an ellipsoid) to the vertices and then computes the area of the polygon formed by the projected vertices. This makes it a good approximation for small polygons: it is approximately as accurate as the spherical datum. Note that it will fail for large polygons (whose edges span more than a few degrees apiece) or for ones that cross the longitudinal cut (usually at +-180 degrees). The latter problem is fixable if 'x2-x1' etc. are computed modulo 360 degrees. –  whuber Apr 13 '11 at 14:40
@whuber: Quick and effective, but like you mentioned it is NOT an exact area, instead it is an approximation. Very important point to remember. –  Sasa Ivetic Apr 13 '11 at 14:48
+1 Nice formula - does it have a name? –  Kirk Kuykendall Apr 13 '11 at 15:04
I'm honestly not sure if it does have a name. Today I quickly looked it up in OpenLayers code (though I've used it before), and they cite a paper by Chamberlain and Duquette which you can get here: trs-new.jpl.nasa.gov/dspace/bitstream/2014/40409/1/07-03.pdf –  Sasa Ivetic Apr 13 '11 at 15:18

I think Sasa's answer above is pretty solid.

A quick Measure: A rough and ready sanity check to I use to double check complicated math is the rough width / height of the shape. (ie its bounding box) At most inhabited latitudes .01 degrees lat lng is approximately .5 to .7 miles or roughly 1km. So a shape .01 x .01 would be about 1km+/- or .25 to .5 sq miles. This math will go haywire at the poles and international date line, so its just a rough guide. Depending on the type of shape it should be some rough percentage of the overall bounding box.

Example Below is the same measure (approximate hand drawn) in Boston and Atlanta for comparison.

Atlanta GA

Boston, MA

-
Not a bad approach, but it could use refinement: .01 degree latitude is 1.1 km while .01 degree of longitude is the same amount multiplied by the cosine of the latitude. It's easy to memorize a few cosines, especially for the latitudes where one tends to work. –  whuber Apr 13 '11 at 20:01
Good idea. I like the simplicity the cosine conversion. –  Glenn Apr 14 '11 at 10:22