[R-sig-Geo] gIntersection - Input geom 0 is invalid

Lyndon Estes lyndon.estes at gmail.com
Sat Jan 24 21:27:47 CET 2015


Hi Milan,

Two possible workarounds I have found that can sometimes clear up a
problem with unclean polygons are to first run either:

gBuffer(your_shape, width = 0)

gUnaryUnion (if you don't mind losing the identities of individual polygons)

And then try run the intersection on the output.  It might not work.  The
next option is to use pprepair, which is a standalone program that is
great for repairing polygons.

https://github.com/tudelft3d/pprepair

Hope this helps.

Cheers, Lyndon

On Sat, Jan 24, 2015 at 2:22 PM, Milan Cisty <milan.cisty at stuba.sk> wrote:
> Dear list members.
> I tried intersection of two SpatialPolygonsDataFrames and I get following
> error:
>  > podnyDruh=gIntersection(textura, zavlahaJTSK)
> Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
> "rgeos_intersection") :
>   TopologyException: Input geom 0 is invalid: Self-intersection at or near
> point -536834.52051807998 -1210383.10809479 at -536834.52051807998
> -1210383.10809479
> I believe, that there is refered error in data (in geom 0), but I would like to
> ask if there is not possible some workaround this (I want to do more
> intersections). When I made shp files it was possible to accomplish
> intersection in ArcGIS, so maybe there is some trick how to accomplish it also
> in R. Referred error in geom 0 is not in area of my interest.
> I am not sending data because I do not think its necessary, but I can if it
> could help.
> Thanks,
> Milan
>
> _______________________________________________
> 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