RingArea
Constants
EARTH_RADIUS = 6371008.8
FACTOR = (EARTH_RADIUS * EARTH_RADIUS) / 2
A constant factor used to compute the area of a polygon. It's derived from the square of the Earth's radius divided by 2.
FACTORS = {
acres: 0.000247105,
centimeters: 10000,
centimetres: 10000,
feet: 10.763910417,
hectares: 0.0001,
inches: 1550.003100006,
kilometers: 0.000001,
kilometres: 0.000001,
meters: 1,
metres: 1,
miles: 3.86e-7,
nauticalmiles: 2.9155334959812285e-7,
millimeters: 1000000,
millimetres: 1000000,
yards: 1.195990046,
}
PI_OVER_180 = Math::PI / 180
A constant used for converting degrees to radians. Represents the ratio of PI to 180.
VERSION = {{ (`shards version /tmp/tmp.aMLpfM/src/src`).chomp.stringify }}
Instance methods
Calculate the approximate area of the polygon were it projected onto the earth.
Reference: Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion Laboratory, Pasadena, CA, June 2007 https://trs.jpl.nasa.gov/handle/2014/40409
coords - Ring Coordinates as [[longitude1, latitude1], [longitude2, latitude2], ...]
Return the approximate geodesic area of the polygon.
https://github.com/Turfjs/turf/blob/master/packages/turf-area/index.ts