Dear List,

I am having troubles trying to turn a spatialpointsdataframe into a 
raster, when I use the rasterize function from the raster packages I get 
strange white lines in certain area of the map and when turning values 
back to spatialpointsdataframe some of them disappeared. Below is a code 
example

#create a list of points from coordinates of grid points in europe at a 
10 arc-minute resolution
test_point<-data.frame(Long=y70$Long,Lat=y70$Lat,Values=rnorm(length(y70[,1])))
coordinates(test_point)<-~Long+Lat
proj4string(test_point)<-CRS("+proj=longlat +datum=WGS84")
summary(test_point)
Object of class SpatialPointsDataFrame
Coordinates:
   min      max
Long -10.41667 31.91668
Lat   34.25000 71.25001
Is projected: FALSE
proj4string : [+proj=longlat +datum=WGS84]
Number of points: 31143
Data attributes:
   Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
-4.278000 -0.672700 -0.003040 -0.000353  0.668600  3.915000
#create a raster from the points extent and resolution (since 60 
arc-minutes make a degree, we have a resolution of #10/60)
r<-raster(nrows=(bbox(test_point)[2,2]-bbox(test_point)[2,1])/0.1666667,ncols=(bbox(test_point)[1,2]-bbox(test_point)[1,1])/0.1666667,xmn=bbox(test_point)[1,1],xmx=bbox(test_point)[1,2],ymn=bbox(test_point)[2,1],ymx=bbox(test_point)[2,2],crs=CRS("+proj=longlat 
+datum=WGS84"))
#then rasterize the points
ras<-rasterize(x=test_point,y=r)
#then when ploting white lines appears
plot(ras)
#and if we retrieve the non-NA values from this raster
new_points<-rasterToPoints(ras,spatial=TRUE)
summary(new_points)
Object of class SpatialPointsDataFrame
Coordinates:
   min      max
x -10.33333 31.83334
y  34.33333 71.16667
Is projected: FALSE
proj4string : [+proj=longlat +datum=WGS84]
Number of points: 29373
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1    7515   15420   15410   23220   31140

the number of points went from 31143 to 29373, what is the problem?
Thank you,
-- 

*HERTZOG* Lionel
2^nd year MSc in Organismic Biology
University of Bonn
email: s6lihert@uni-bonn.de <mailto:s6lihert@uni-bonn.de>
Phone number: (+49)015215148128


	[[alternative HTML version deleted]]

