[R] How to use your own data in gstat and sp?

Paul Heinrich Dietrich paul.heinrich.dietrich at gmail.com
Mon Aug 17 12:53:47 CEST 2009


Thanks that makes sense.  Just a newby to spatial data in R.  Thanks.


Roger Bivand wrote:
> 
> First re-read the definition of what a SpatialPixels object is -
> ?"SpatialPixels-class" - note that it says: "class for defining a pixels,
> forming a possibly incomplete rectangular grid of arbitrary dimension".
> When you try to coerce a SpatialPointsDataFrame to a
> SpatialPixelsDataFrame, it is checked to see that the points form a
> "possibly incomplete rectangular grid". Your points are random within a
> 1,10 square, so only regularly spaced for a very special setting of the
> seed of the RNG, right? Since you are unlikely to hit that very, very rare
> seed at random, you are not likely to generate a regular grid in this way.
> Did you examine the class(), summary() and str() of the input data in the
> examples?
> 
> Hope this helps,
> 
> Roger Bivand 
> 
> PS. consider following this up on the R-sig-geo list.
> 
> 
> Paul Heinrich Dietrich wrote:
>> 
>> This seems pretty basic, but I can't get any data to work except for the
>> documented examples.  When the goal is to get to SpatialPixels, here is
>> what I see...
>> 
>>> x <- runif(10,1,10)
>>> y <- runif(10,1,10)
>>> z <- rnorm(10,0,1)
>>> MyData <- as.data.frame(cbind(x,y,z))
>>> library(gstat)
>>> coordinates(MyData) <- ~x + y
>>> gridded(MyData) <- TRUE
>> suggested tolerance minimum: 0.893182669294186 
>> Error in points2grid(points, tolerance, round, fuzz.tol) : 
>>   dimension 1 : coordinate intervals are not constant
>> 
>> I've spent way too much time trying to get my data to work.  Please help. 
>> Thanks.
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-use-your-own-data-in-gstat-and-sp--tp24994744p25004653.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list