2

I am trying to measure area from gps coordinates but fail to get the correct result (7200 square meters). I used the formula from this post but I get way too high number as result (should be in square meters). Here is my current work in jsfiddle. Any idea what is wrong?

Math.radians = function(degrees) {
  return degrees * Math.PI / 180;
};

area = Math.radians(x2 - x1) * (2 + Math.sin(Math.radians(y1)) + Math.sin(Math.radians(y2))) + Math.radians(x3 - x2) * (2 + Math.sin(Math.radians(y2)) + Math.sin(Math.radians(y3))) + Math.radians(x4 - x3) * (2 + Math.sin(Math.radians(y3)) + Math.sin(Math.radians(y4))) + Math.radians(x5 - x4) * (2 + Math.sin(Math.radians(y4)) + Math.sin(Math.radians(y5)));

area = Math.abs(area * 6378137.0 * 6378137.0 / 2.0)
alert(area);
Defain
  • 131
  • 5

1 Answers1

5

Your units are in decimal degrees and they should be in a projected coordinate system. If you still have the gps unit, you can change it to something like an appropriate UTM projection then download the coordinates and use those in your calculation.

  • Thanks for the answer. Is there any practical guide for that? I get the gps data using http://cordova.apache.org/docs/en/2.5.0/cordova_geolocation_geolocation.md.html and have no idea how to project the results as you explained – Defain Aug 17 '14 at 16:52
  • see proj4js (proj4 lib). – simpleuser001 Aug 20 '14 at 07:59