[R-sig-Geo] areaint in Matlab vs. areaPolygon or areapl in R

c.gutierrez c74gutierrez at gmail.com
Thu Oct 25 21:11:17 CEST 2012


Using the self-contained example from ?areaPolygon:

p <- rbind(c(-180,-20), c(-140,55), c(10, 0), c(-140,-60), c(-180,-20))
library(geosphere)
areaPolygon(p)
#result in m^2
[1] 2.12582e+14 

Here is the parallel code in Matlab (requires Mapping Toolkit):

p=[-180 -20; -140 55; 10 0; -140 -60; -180 -20];
area=areaint(p(:,2),p(:,1),referenceEllipsoid('wgs84','km'))
%result in km^2
area = 2.524097207871018e+08

>>> The results are ~20% (~40 km^2) different.




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/areaint-in-Matlab-vs-areaPolygon-or-areapl-in-R-tp7581399p7581411.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list