Skip to content
Prev 2233 / 29559 Next

ODP: ODP: spsample and NA

I understand, but how do I convert between one type and the other?
I've tried:

x <- GDAL.open("C:/ALOBO/dipu2006/STLL_VEG2006/ESTRAT3_OBAC.tif")
ESTRAT3OBAC <- asSGDF_GROD(x, output.dim=c(118,189))
GDAL.close(x)
ESTRAT3OBAC at data[ESTRAT3OBAC at data==55537]<- NA
X <- ESTRAT3OBAC[seq(1,118,by=10),seq(1,189,by=10)] #small example
 > summary(X)
Object of class SpatialGridDataFrame
Coordinates:
         min       max
x  410649.7  415399.7
y 4607910.5 4610910.5
Is projected: TRUE
proj4string : [ +proj=utm +zone=31 +ellps=intl +units=m +no_defs]
Number of points: 2
Grid attributes:
   cellcentre.offset cellsize cells.dim
x          410774.7      250        19
y         4608035.5      250        12
Data attributes:
      band1
  Min.   :  4.0
  1st Qu.: 67.0
  Median :156.0
  Mean   :125.8
  3rd Qu.:163.0
  Max.   :237.0
  NA's   :119.0

 > Y <- SpatialPixels(X)
 > summary(Y)
Object of class SpatialPixels
Coordinates:
         min       max
x  410649.7  415399.7
y 4607910.5 4610910.5
Is projected: TRUE
proj4string : [ +proj=utm +zone=31 +ellps=intl +units=m +no_defs]
Number of points: 2

So X and Y are not the same at all.

Thanks for your help.

Agus


Edzer J. Pebesma escribi?: