I have the following code
coastline<-readOGR(dsn=".",layer="shp")
wetlands<-readOGR(dsn=".",layer="shp")
wetb<-gBuffer(wetlands,width=500,byid=T)
wetb2<-gBuffer(wetlands,width=1000,byid=T)
u<-gUnion(wetb2,wetb)
plot(u)
EDIT
u<-raster::union(wetb2,wetb)
u2<-raster::union(coastline, u)
plot(u2)
gives
Error in if (is.numeric(i) && i < 0) { :
missing value where TRUE/FALSE needed
In addition: Warning message:
In RGEOSUnaryPredFunc(spgeom, byid, "rgeos_isvalid") :
Self-intersection at or near point 699045.17841763003 4339815.8708455302
gUnion results to a SpatialPolygon but i need SpatialPolygonDataFrame. How can i do union that has that outcome?
package::functionto access a particular function in a package – Ellis Valentiner Jul 21 '15 at 13:11