[R-sig-Geo] st_area / st_transform / crs

Jean-Luc Dupouey jean-luc.dupouey at inra.fr
Sat Sep 16 13:52:36 CEST 2017


Dear all,

I am a new user of sf. I have the following error:

"lay" is an sf object, composed of POLYGONS and MULTIPOLYGONS in a 
projected coordinates system.

 > st_area(lay)  # works well and returns the area of polygons

 > # convert to WGS
 > laywgs = st_transform(lay, 4326)

 > st_area(laywgs)
Error in as_Spatial(from) :
   conversion from feature type sfc_GEOMETRY to sp is not supported

Why st_area works on the projected layer and not on the 
latitude/longitude layer? I read carefully the manual and did not find 
any clue. It is just told that for unprojected geometries, st_area uses 
areaPolygon. Well... it means that some conversion probably takes place, 
but there is no information about this conversion.

Thank you advance for your help,

Jean-Luc Dupouey

-- 
INRA
Forest Ecology and Ecophysiology Unit
F-54280 Champenoux
France



More information about the R-sig-Geo mailing list