port of the JS library geojson-rewind, with ports of parts of the JS libraries geojson-area and wgs84 included

Installation

install.packages("devtools")
devtools::install_github("ropenscilabs/geojsonrewind")
library("geojsonrewind")

Get ring area

the value is positive if ring is oriented clockwise

x <- jsonlite::fromJSON(x, FALSE)
ring_area(x = x$coordinates[[1]])
#> [1] 12391399902

the value is negative if ring is oriented counterclockwise

ring_area(x = rev(x$coordinates[[1]]))
#> [1] -12391399902

Meta

rofooter