[R] Are centre coordinates or upper left corners used of x, y for SpatialPixels?

Jan.Verbesselt at csiro.au Jan.Verbesselt at csiro.au
Tue Jul 1 10:03:59 CEST 2008

Dear all,

I'm working with satellite images in R and plotting them via the code
I was wondering whether coordinates (spatial["x"], spatial["y"]) are
used as centre coordinates of the pixels in the GRID? In this script;
spatial["x"] & spatial["y"] are the centre coordinates of the satellite
image pixels. I'm asking this because some software packages use the
upper left corner of a pixel as a reference.

  # --> Create GRID and image in R
   S <- SpatialPoints(cbind(spatial["x"], spatial["y"]), proj4string =
    SP <- SpatialPixels(S, proj4string = proj, tolerance = 5e-07)
    GRID <- SpatialPixelsDataFrame(points = SP , tolerance = 5e-07, data
= spatial[columnname])
    proj4string(GRID) <- proj
    nr <- 30
    zaxis <- c(0.7, 1)
    plot(as(GRID, "Spatial"), axes=T)
    title(main = paste(" Day ",dy[i,1], " Year ",dy[i,2], sep=""))
    image(GRID, zlim=zaxis, col=rainbow(nr,start=0, end=2/6),add=T)

Thanks for your help,

Ps. Is this good approach to plot satellite images as spatial grids in
R? is rgdal an better approach?

More information about the R-help mailing list