[R-sig-Geo] rgeos::gArea() to all polygons within sp polygons DF
Agustin Lobo
alobolistas at gmail.com
Mon Apr 9 22:28:22 CEST 2012
Thanks Roger.
Apologies for the missing output of sessionInfo() .
Confirmed that the results are correct with rgeos 0.2-5, although it's
now very slow.
Ticket in QGIS updated (and closed).
Agus
El día 9 de abril de 2012 17:36, Roger Bivand <Roger.Bivand at nhh.no> escribió:
> On Mon, 9 Apr 2012, Agustin Lobo wrote:
>
>> Thanks Edzer,
>>
>> b2 <- gArea(BorneoLCg, byid=T)
>>
>> I get many warnings such as:
>> 40: In RGEOSMiscFunc(spgeom, byid, "rgeos_area") :
>> Polygons object missing comment attribute ignoring hole(s). See
>> function createSPComment.
>>
>> is this normal?
>>
>> The result is identical to
>> b <- sapply(BorneoLCg at polygons, function(x) x at area)
>>
>> while it is different than the one provided by QGIS (known to be wrong for
>> very
>> large polygons only because of a format problem) and postgis (assumed
>> to be correct). Please give a look to:
>> http://hub.qgis.org/issues/5332
>
>
> Please always provide sessionInfo() output, and a copy of the rgeos startup
> messages (showing which version of GEOS is used). With rgeos 0.2-5 and GEOS
> runtime version: 3.3.2-CAPI-1.7.2, I have:
>
> bn <- readOGR(".", "BorneoLCv2google")
> b2 <- gArea(bn, byid=TRUE)
>>
>> print(b2[25967], digits=16)
>
> 25966
> 8550196769.93012
>>
>> print(b2[26570], digits=16)
>
> 26569
> 173647473841.3217
>
> so the hole warnings were the reason for the difference. SVN revision 327 of
> 16 March enforced the use of createSPComment() in gArea() - the user was
> expected to denote holes properly themselves before this change. Update your
> rgeos and try again.
>
> Please update the QGIS #5332 to state that from rgeos 0.2-5, the values are
> correct. The area slot in the Polygons object is a gross area used to order
> plotting (because until recently R polygons simply overplotted one another),
> so it is not guaranteed to be a planar area measure for polygons with holes.
>
> Roger
>
>
>>
>> Agus
>>
>>
>> El día 8 de abril de 2012 17:26, Edzer Pebesma
>> <edzer.pebesma at uni-muenster.de> escribió:
>>>
>>> Agus, have you tried
>>>
>>> gArea(BorneoLCg, byid = TRUE)
>>>
>>> ?
>>>
>>> On 04/08/2012 04:52 PM, Agustin Lobo wrote:
>>>>
>>>> Hi!
>>>>
>>>> How do I apply gArea()) to all polygons within an spatial pol. DF?
>>>> I've tried
>>>> areas <- apply(BorneoLCg,gArea)
>>>> and
>>>> areas <- sapply(BorneoLCg,gArea)
>>>>
>>>> but this is not correct.
>>>>
>>>> I want to compare to
>>>> areas <- sapply(BorneoLCg at polygons, function(x) x at area)
>>>>
>>>> Thanks
>>>>
>>>> Agus
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>>> --
>>> Edzer Pebesma
>>> Institute for Geoinformatics (ifgi), University of Münster
>>> Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
>>> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
>>> http://www.52north.org/geostatistics e.pebesma at wwu.de
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> --
> Roger Bivand
> Department of Economics, NHH Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list