Search code examples
rmatlabgisareapolygons

areaint in Matlab vs. areaPolygon or areapl in R


I am getting two different sets of values when I try to calculate the polygon area in Matlab vs. R. In Matlab, I used areaint (with the reference ellipsoid set to WGS84). In R, I tried both geosphere::areaPolygon on lat-lon or splancs::areapl on grid-converted Euclidean coordinates. The R results agree with each other, but not with the Matlab calculation. The two sets are on average 25% different (Matlab lower). What am I missing?


Solution

  • Apparently, the result from Matlab came from an incorrectly formatted input matrix: areaint() requires (lat,lon), whereas the R input was correctly formatted as (lon,lat). This holds true for any of the previously mentioned R functions.

    See also: http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=reply&node=7581419