Skip to content
Prev 23649 / 29559 Next

gUnaryUnion Not Dissolving Correctly

On Thu, 5 Nov 2015, Roger Bivand wrote:

            
A potentially robust approach at default scale uses the dx= argument to 
HexPoints2SpatialPolygons():

hex_grid <- HexPoints2SpatialPolygons(hex_points, dx=size)

Setting:

set_RGEOS_polyThreshold(1e-2) # for example
set_RGEOS_warnSlivers(TRUE)

shows the remaining slivers, and:

set_RGEOS_dropSlivers(TRUE)

drops them. It is still possible that an inward dangle will get through 
(zero area line in from boundary point, but part of the single boundary).

Setting dx= to the same value as cellsize= in the spsample call seems to 
be crucial, avoiding an approximation marked in the code as:

 	# EJP; changed:
 	# how to figure out dx from a grid? THK suggested:
         #dx <- hexGrid$x[2] - hexGrid$x[1]
 	# and the following will also not always work:

in sp:::genPolyList(), so there was a warning there against taking the 
default.

Roger