Dear Turner,

Thanks very much for your reply,

I hope you will recently implement this utility.

Regards,

Volkan Kepoglu.

On Sat, Apr 17, 2010 at 3:48 AM, Turner Rolf <r.turner@auckland.ac.nz>wrote:

>
> Volkan Kepoglu wrote:
>
> Hi,
>
> how can i convert the delaunay triangulation to spatial polygons?
>
>       Briefly, you can't, at the present time.  At least not
> ``automatically''.
>
> library(deldir)
> library(sp)
> x   <- c(2.3,3.0,7.0,1.0,3.0,8.0)
> y   <- c(2.3,3.0,2.0,5.0,8.0,9.0)
> df_xy <- data.frame(x=x,y=y)
> coordinates(df_xy) <- ~x+y
> # deluanay triangulation is plotted. That is OK.
> z <- deldir(x,y,plot=TRUE,wl='triang',wp="none")
>
> # However, while trying to convert z (deluanay) to SpatialPolygon,
> # the output is as the same as dirichlet/voronoi tesselation output,
> # even the z is delaunay triangulation.
>
>       You are confused; the object ``z'' is NOT the Delaunay triangulation;
> it is an object
>      of class "deldir'' which contains a description of both the Delaunay
> triangulation and
>      the Dirichlet tessellation.
>
>      You asked plot.deldir() to ***plot*** only the Delaunay triangulation;
> this has no effect
>      on the actual nature of ``z''.
>
> w <- tile.list(z)
>
>      The function tile.list() produces a list of the ***Dirichlet tiles***
> described in ``z''.
>      It does produce anything directly related to the Delaunay
> triangulation.
>
> polys <- vector(mode="list", length=length(w))
> for (i in seq(along=polys))
> {
> pcrds <- cbind(w[[i]]$x, w[[i]]$y)
> pcrds <- rbind(pcrds, pcrds[1,])
> polys[[i]] <- Polygons(list(Polygon(pcrds)), ID=as.character(i))
> }
> SP <- SpatialPolygons(polys)
> plot(SP)
> plot(df_xy, add=T, col="RED")
>
> is there any way to convert the delaunay to sp polygon class?
>
>       No, not at the present time.  There is no existing utility to extract
> from ``z'' a list of
>      the Delaunay triangles which ``z'' describes.  It would not be
> impossible to create
>      such a utility, say triang.list() to go with tile.list(), but I have
> never done so.  I will try
>      to write such a utility and update the deldir package accordingly some
> time in the
>      not too distant future, but I can't say exactly when I'll get around
> to it.
>
>              cheers,
>
>                    Rolf Turner
>

	[[alternative HTML version deleted]]

