EREA (Entire Ride Enclosed Area) does exactly what it says, calculates the area enclosed by a ride.
We consider the ride to be a polygon id 2d, approximating the local part of the earth with a plane. The endpoints are connected if they're within 2 miles to account for Strava's privacy settings.
If the ride is non-intersecting, this is an easy problem. For polygons whose sides intersect, we first need to find the perimeter of the polygon. This work is based on sample code from http://alienryderflex.com/polygon_perimeter/. However, this technique fails for special cases where the polygon has overlapping, collinear sides, or a vertex is on a side. We have extended the algorithm to deal with these cases.
Calculations are done in quad-precision to reduce round-off errors. Input is rounded to six decimal places so it's basically single precision and theoretically 4x the precision would be needed for exact results. Thus, quad-precision is a reasonably solution here.
If you have a ride for which this algorithm fails, I'd like to know. Contact me at paulmach -at- raceshape.com. Thank you.