What CRS is KoBo's area() function based on?

Hi,

I’ve developed a survey in KoBo that allows users to collect GPS points and determine the area of the polygon enclosed by those points. To calculate the area, I’m using the area() function, with the polygon’s points as arguments.

Do you know which projected Coordinate Reference System (CRS) KoBo uses for area calculations? I’ve conducted some tests in QGIS and suspect that the CRS is a global equal-area one, possibly Mollweide or Eckert IV, but I haven’t found any information about this in the KoBo documentation.

Additionally, is there a way to change KoBo’s CRS? The current (default?) CRS seems to be overestimating my polygon areas.

Thank you in advance for your support! I’m new to KoBo and have already found this community incredibly helpful.

Best,
Francesco

I’m no GIS specialist, but my interpretation of the code is that a fairly coarse approach is taken to calculating areas (and distances, for that matter), modelling the Earth as a perfect sphere with a radius of 6,378.1 km [I dont know what CRS that corresponds to, eg WGS84, but it probably doesn’t get any simpler than that!].

If you wish to analyze the calculation used it is defined here. Essentially, the formula is:

        // calculate segment x and y in degrees for each point
        final double latitudeRef = latLongs.get(0).latitude;
        final double longitudeRef = latLongs.get(0).longitude;
        for (int i = 1; i < latLongs.size(); i++) {
            double latitude = latLongs.get(i).latitude;
            double longitude = latLongs.get(i).longitude;
            listY.add(calculateYSegment(latitudeRef, latitude));
            listX.add(calculateXSegment(longitudeRef, longitude, latitude));
        }

        // sum areas of all triangle segments
        double areasSum = 0;
        for (int i = 1; i < listX.size(); i++) {
            areasSum += calculateAreaInSquareMeters(listX.get(i - 1), listX.get(i), listY.get(i - 1), listY.get(i));
        }

where

private static Double calculateAreaInSquareMeters(double x1, double x2, double y1, double y2) {
        return (y1 * x2 - x1 * y2) / 2;
    }

So it does not surprise me that QGIS provides a more accurate result. Please note, from the documentation:

The distance [and area] function takes into account the circumference of the Earth around the equator but does not take altitude into account. The longer the line segments are, the less accurate the computed distance will be. Additionally, distance calculations closer to the equator are more accurate than ones close to the poles.

To answer your other question…

is there a way to change KoBo’s CRS

No. As you can see above, KoboCollect uses javarosa to perform these geo calculations. If you wish to use a more accurate CRS to obtain a more precise area/distance result then you would need to rebuild a KoboCollect against a customized javarosa.

If this will be a serious problem for you, then I might suggest considering writing a PR for javarosa with a more sophisticated (and precise) calculation.

2 Likes