Message-ID: <CAHT1vpjyhEs1Pb8Ra4_u7eGpyQXf2gdyoBovzTxc2Lr3xKwExw@mail.gmail.com>
Date: 2016-05-19T07:28:25Z
From: Roman Luštrik
Subject: gBuffer solution to invalid objects problem fails
In-Reply-To: <CALOjXYTVhsjvEwAxYuSvy75Dui0_cvGum8cQOLUN694cn3WRbQ@mail.gmail.com>
Hi Kenny,
can you provide a small, reproducible example which replicates this
behavior?
Cheers,
Roman
On Wed, May 18, 2016 at 7:08 PM, Kenny Bell <kmb56 at berkeley.edu> wrote:
> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
In God we trust, all others bring data.
[[alternative HTML version deleted]]