Message-ID: <CALOjXYTVhsjvEwAxYuSvy75Dui0_cvGum8cQOLUN694cn3WRbQ@mail.gmail.com>
Date: 2016-05-18T17:08:21Z
From: Kenny Bell
Subject: gBuffer solution to invalid objects problem fails
Hi all,
I have been getting the below error a few times. I have seen in several
places that a zero-width gBuffer call will fix the topology problem.
However, in this case, I find that the call to gBuffer generates a 4 point
horizontal line, not solving the problem. Is there another solution? Thanks
for any help!
My code:
library(sp)
library(rgeos)
load("r-sig-geo.RData")
gIntersection(grid_poly, new_poly,
byid = c(TRUE, FALSE),
id = as.character(grid_poly at data[,1]),
# if there are coinciding lines, gIntersection
# returns a cross.
drop_lower_td = TRUE,
checkValidity = TRUE)
# new_poly is invalid
# Error in rgeos::gIntersection(grid_poly, new_poly, byid = c(TRUE, FALSE),
:
# Invalid objects found
# In addition: Warning message:
# In RGEOSUnaryPredFunc(spgeom, byid,
"rgeos_isvalid") :
# Self-intersection at or near point
172.23206269997971 -42.13157792003453
# Try using gBuffer as suggested here:
#
http://gis.stackexchange.com/questions/163445/r-solution-for-topologyexception-input-geom-1-is-invalid-self-intersection-er
new_poly1 <- gBuffer(new_poly, width = 0)
plot(new_poly1)
# Generates a line (i.e. kills the polygon)?
?
r-sig-geo.RData
<https://www.dropbox.com/s/9ivpcmboodpu6zd/r-sig-geo.RData?dl=0>
?
[[alternative HTML version deleted]]