[R-sig-Geo] Unable to apply 'gIntersection' successfully

satishr satish.regonda at gmail.com
Tue Jan 31 23:40:12 CET 2012


Edzer, It helps. Thanks.
For the future audience reference, here is the solution that worked in this
situation  Thanks to Colin Rundel. 

 I calculated areas and compared with values after gBuffer application -
they are same for  all polygons except for two polygons for which values of
'area' differed on the order of 10^(-4). However, I found gBuffer resulted
one or two additional rings though. This is OK for my calculations purpose.

"
the US 102 climate divisions polygons are invalid as they have self
intersections. These self intersections cause geos to fail, you can see
which of the polygons in climagdiv are invalid using the following code:

gIsValid(climagdiv,reason=TRUE,byid=TRUE)

There is not a simple cure all for fixing this kind of geometry issue, but
in some cases using gBuffer with width=0 can fix things, which seems to be
the case here.

gIsValid(gBuffer(climagdiv,byid=TRUE,width=0),byid=TRUE)

reports all the polygons as being valid.

Fixing the climate divisions with

climagdiv = gBuffer(climagdiv,width=0,byid=TRUE) 

"

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Unable-to-apply-gIntersection-successfully-tp7240529p7241456.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list