ring_area: geojson area function

Description Usage Arguments Details Value Examples

Description

geojson area function

Usage

1

Arguments

x

A list of coordinates. See examples for its form

Details

ported from geojson-aera JS library at https://github.com/mapbox/geojson-area

Calculate the approximate area of the polygon were it projected onto the earth. Note that this area will be positive if ring is oriented clockwise, otherwise it will be negative.

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 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409

Value

single integer - The approximate signed geodesic area of the polygon in square meters. Positive if ring is oriented clockwise, otherwise it will be negative.

Examples

1
2
3
4
5
6
7
8
9
x <- '{
 "type":"Polygon",
 "coordinates":[
   [[100.0,0.0],[100.0,1.0],[101.0,1.0],[101.0,0.0],[100.0,0.0]]
 ]
}'
x <- jsonlite::fromJSON(x, FALSE)
ring_area(x = x$coordinates[[1]])
ring_area(x = rev(x$coordinates[[1]]))

ropenscilabs/geojsonrewind documentation built on May 27, 2019, 8:34 p.m.