[R-sig-Geo] voronoi (thiessen) polygons inside irregular area

buzzfuzz006 joshfirth at hotmail.com
Tue Jan 21 08:10:14 CET 2014


Hi,
Is there a simple way to draw voronoi/thiessen polygons inside an irregular
polygon similar to this, but where the polygons created do not extend over
the boundaries of the overlaying polygon. E.g
Using the packages

library(spatstat);library(spdep)

If we had set points:

x<-c(0.9,1.7,2.4,2.9,4.83, 0.73, 2.31, 3.69, 4.23, 2.86, 1.91, 4.32, 4.60,
1.82)
y<-c(1.9,0.9,2.8,1.9,1.81, 1.66, 4.54, 5.66, 1.99, 4.03, 4.32, 5.98, 5.56,
3.41)

within the set irregular polygon:

x.p<-c(0.1, 6.0, 6.0, 1.0, 5.0, 3.0, 3.5, 0.1)
y.p<-c(0.1, 1.0, 6.5, 5.5, 5.0, 1.0, 4.8, 5.0)

now I set the polygon to needed dirichlet format

poly.l<-list(x.p,y.p)
names(poly.l)<-c("x","y")

and create the spatial point pattern

poly.w.points<-ppp(x=x,y=y,poly=poly.l)

then carry out the voronoi tessellation

spatstat.options("gpclib"=T)
tess<-dirichlet(poly.w.points)

unfortunately if we are to plot this it looks like this

plot(tess)
text(x,y,1:length(x))

and if we check the neighbours we see that the voronoi polygons extend
outside the polygon area
tess.sp<-as(tess,"SpatialPolygons")
neighs<-poly2nb(tess.sp)

e.g.
neighs[10]
shows that point 10 is neighbours (shares boundary) with 8,9 and 13 – whilst
I want a result whereby 10 would only be neighbours with 7,11,14 and 3.




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/voronoi-thiessen-polygons-inside-irregular-area-tp7584761p7585593.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list