Skip to main content

Hi,


I’m looking for a way to calculate the area from a polygon.

Do you have this feature on the Sentinel API?


It would shorten some of our work.


Thanks

Hello,


Sharing the alternative that I used to solve the problem.

Basically is the sum of the products of the vertices


With a closed polygon, my script looked something like this:


$max_i = $total_rows - 1;
$i = 0;
$area = 0;
while ($i < $max_i){
$area = $area + (($x[$i] * $y[$i+1]) - ($y[$i] * $x[$i+1]));
$i ++;
}
if ($area < 0){ $area = $area * -1; }
$area = $area / 2;

Source:
https://www.mathopenref.com/coordpolygonarea.html


There are some solutions available here as well:

stackoverflow.com

Jason Z



How do I calculate the area of a 2d polygon?




algorithm, geometry, 2d








Reply