How can I Get Area from GPS Points coordinates List

Like this in Java

public static double CalculatePolygonArea(List<Vector2D> coordinates)
    double area = 0;

    if (coordinates.size() > 2)
        for (int i = 0; i < coordinates.size()-1; i++)
            Vector2D p1, p2;
            p1 = coordinates.get(i);
            p2 = coordinates.get(i + 1);
            area += Math.toRadians(p2.x - p1.x) * (2 + Math.sin(Math.toRadians(p1.y))
               + Math.sin(Math.toRadians(p2.y)));

        area = area * R * R / 2;

    return Math.abs(area);

(assuming Vector2D.x is the longitude and Vector2D.y is the latitude).

How can I do it in app inventor
User set Point List with any number of Points

Use maths blocks and list blocks

Screenshot 2024-06-24 115118

I know the math solution manually

I have List


I will create 2 lists

1 st list for x


2nd list


and then use math blocks to get area

that is easy if i know the numbers of list item is fixed known number

but I have n unknown number of items .

It could be something like this:

1 Like

have you tried this extension by @ Passos_0213

[FREE] Calculate areas and distances on maps precisely to calculate area ?

I Get PushPin locations by bingmap extension


I remove all unnessary symbols from this list and create a new list " modified point list to be :

and add each point by CalculateMapArea extension

but the extension give me wrong result for any shape i draw after that !!!

II compared the result of the extension with the result of the Google Earth program on the computer, the result of the first shape is true , but any shape i draw after give me a big difference in area.


You wrecked the JSON list structure when you did that.
You could have used a Web1.JSONTextDecode block and preserved the table structure you need to traverse the points.

further to @Ramon 'd solution, there is some python code

import math
def ComputeArea(data):
    arr = data.split(';')
    arr_len = len(arr)
    if arr_len < 3:
        return 0.0
    temp = []
    for i in range(0,arr_len):
        temp.append([float(x) for x in arr[i].split(',')])
    s = temp[0][1] * (temp[arr_len -1][0]-temp[1][0])
    print s
    for i in range(1,arr_len):
        s += temp[i][1] * (temp[i-1][0] - temp[(i+1)%arr_len][0])
    return round(math.fabs(s/2)*9101160000.085981,6)

data format like

data = "115.989099,39.646023;115.987394,39.645988;115.987371,39.647407;115.986684,39.647423;115.986602,39.648088;115.989095,39.648151;115.989188,39.646021;115.989099,39.646023"

but I am afraid it will be not so accurate if the locations is far away from equator.


Any equation that uses longitude coordinates to create a polygon to determine the polygon's area needs to consider the latitude at which the polygon is made. The length the method uses for longitude in the area calculation needs to be 'corrected' or adjusted.


The length of each degree of latitude is about 111.111 km or 111,111 meters and is relatively consistent at all latitudes.

Each degree of longitude at the equator is equivalent to about 111.111 meters. But moving away from the equator towards either of the poles the distance represented by the longitude gets smaller; the lines become closer. The distance represented by a longitude line then becomes approximately 111,111 * cos(latitude) where 'latitude' is the approximate latitude of the polygon you are 'measuring'.

Table from Longitude - Wikipedia

Deg. latitude longitude
0° 110.574 km 111.320 km
15° 110.649 km 107.551 km
30° 110.852 km 96.486 km
45° 111.133 km 78.847 km
60° 111.412 km 55.800 km
75° 111.618 km 28.902 km
90° 111.694 km 0.000 km

For a location that is at 45 deg. latitude, the longitude length is not 111 km but about 79 km.

Either the extension or algorithm from Google Earth assumes the length of latitude and longitude everywhere in the polygon is the same; which is not true. If the methodology to determine the polygon's area does not consider the variation in the length of longitude as latitude varies, it will produce erroneous results. Which is correct; the extension or Google Earth? I don't know. :cry: