Thanks for the answer Paul,

Tom Philippi kindly offered a solution in a private mail. Quoting his
message:

> can't you use the definition of Voroni tesselation to think of your
problem
> as simply finding for each point in set 2 the nearest neighbor in set 1?

Anyway, I was still thinking about how to compare to layers of points and
polygons, and ?overlay is obviously the piece of code I was looking for!

Thanks again,

Pierre



2009/10/13 Paul Hiemstra <p.hiemstra@geo.uu.nl>

> Hi Pierre,
>
> When you load the output of tripack into a SpatialPolygons object (see the
> sp-pacakge on CRAN), you can use the overlay() function.
>
> cheers,
> Paul
>
> Pierre Roudier wrote:
>
>> Dear list,
>>
>> I am trying to use the Voronoi tesselation of a point pattern to predict
>> values of a second one.
>>
>> This is what it looks like:
>>
>> I got a first population of points :
>>
>> x <- runif(100)
>> y <- runif(100)
>> my.data.set <- data.frame(cbind(x,y))
>>
>> The second population is a subsample of the first one:
>>
>> spl.data.set <- my.data.set[1:20,]
>> spl.data.set$z <- rnorm(20)
>>
>> plot(my.data.set$x,my.data.set$y)
>> points(spl.data.set$x,spl.data.set$y,pch='+',col='red')
>>
>> I want to interpolate the values of my.data.set using the tesselation of
>> spl.data.set:
>>
>> require(spatstat)
>> spl.ppp <-
>>
>> as.ppp(spl.data.set,c(range(my.data.set$x),range(my.data.set$y)),marks=spl.data.set$z)
>> spl.dir <- dirichlet(spl.ppp)
>> plot(spl.dir,add=TRUE)
>>
>> To do that, I have to identify, for which point of my.data.set, to which
>> voronoi tile it belongs to.
>>
>> Using spatstat, I can just extract to which tile belongs each point, using
>> an ugly double loop, and without possibility to find back the value of the
>> center of each voronoi cell:
>>
>> require(spatstat)
>> tiles.id <- vector(mode="numeric",length=nrow(my.data.set))
>> spl.tiles <- tiles(spl.dir)
>> for (i.pt in 1:nrow(my.data.set)) {
>>   for (i.tile in 1:length(spl.tiles)){
>>      curr.tile <-spl.tiles[[i.tile]]
>>      if ( inside.owin(my.data.set$x[i.pt],my.data.set$y[i.pt],curr.tile)
>> )
>> {
>>         tiles.id[i.pt] <- i.tile
>>      }
>>   }
>> }
>>
>> Using tripack, I would know how to retrieve the centre of a tile and go
>> back
>> to the original value (using cells() function), but unfortunately it
>> misses
>> an equivalent to inside.owin().
>>
>> Does any spatstat/tripack/other package user has an idea about it?
>>
>> Thanks,
>>
>> Pierre
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>
>
> --
> Drs. Paul Hiemstra
> Department of Physical Geography
> Faculty of Geosciences
> University of Utrecht
> Heidelberglaan 2
> P.O. Box 80.115
> 3508 TC Utrecht
> Phone:  +3130 274 3113 Mon-Tue
> Phone:  +3130 253 5773 Wed-Fri
> http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul>
>
>

	[[alternative HTML version deleted]]

