Error using SpatialPixelsDataFrame function
Dear R-Geo users, I am trying to create a SP objects using SpatialPixelsDataFrame. Next I can see the code:
proj <- '+proj=lcc +ellps=WGS84 +lat_0=0 +lat_1=30 +lat_2=60 +lon_0=-4.75'
coords <- read.table("coords.txt")
dat <- read.table("dem.txt")
test <- SpatialPixelsDataFrame(points=coords, data=dat, proj4string=proj)
Error in if (max(object at grid.index) > .NumberOfCells(object at grid))
stop("grid.index max value too large") :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In points2grid(points, tolerance, round) :
grid has empty column/rows in dimension 1
2: In points2grid(points, tolerance, round) :
grid topology may be corrupt in dimension 1
3: In points2grid(points, tolerance, round) :
grid has empty column/rows in dimension 2
4: In points2grid(points, tolerance, round) :
grid topology may be corrupt in dimension 2
5: In getGridIndex(coordinates(points), grid) : NAs introduced by coercion
What's the problem?
PD: I can not attach data for this because the size exceeds the maximum
allowable.
Thanks in advance.