[Solved] how to calculate area of polygon on a map? [closed]


From the formula of polygon,

Area of ploygon = [(x1y2-x2y1) + (x2y3-x3y2) + .... + (x(n-1)yn - y(n-1)xn)]/2

Try,

var arr=[
    [10.075854059674523, 76.32832467556],
    [10.079825860518895, 76.33338868618011],
    [10.076234340596953, 76.33806645870209],
    [10.07065684212598, 76.33806645870209],
    [10.068924417668397, 76.33175790309906]
];
var sum=0;
for(var i=0,l=arr.length-1;i<l;i++){
    sum+=(arr[i][0]*arr[i+1][1]-arr[i+1][0]*arr[i][1]);
}
alert('The Area of Ploygon is:'+(sum/2));

Demo

6

solved how to calculate area of polygon on a map? [closed]