[R-sig-Geo] projection string when using asSGDF_GROD()

Harry Kim harryk at cal.berkeley.edu
Mon Dec 8 09:06:35 CET 2008


Dear r-sig-geoers,

      I need some help reading in a raster data and at the same time
project it so I can use the overlay() function. The data I am reading
in is quite big, so I managed to source in the subset of the data by
running:

      wetland= asSGDF_GROD(x, offset=c(3600,20400), region.dim=c(8140,18000))

      Running summary(wetland) gives:

      Object of class SpatialGridDataFrame
Coordinates:
        min      max
x -9.999992 140.0000
y -7.833337  60.0000
Is projected: NA
proj4string : [NA]
Number of points: 2
Grid attributes:
  cellcentre.offset    cellsize cells.dim
x         -9.995825 0.008333334     18000
y         -7.829171 0.008333334      8140
Data attributes:
        Min.      1st Qu.       Median         Mean      3rd Qu.         Max.
1.000000e+00 3.000000e+00 4.000000e+00 5.594000e+00 9.000000e+00 1.200000e+01
        NA's
1.396304e+08
----------------------------------------------------------------------------------------------------------------------------------

The original data is geocoded in latitude and longitude spanning from
-180 to 180 for longitude and from -90 to 90 for latitude. As you
probably noticed, the read-in raster image does not inherit the
projection.
I tried to project the data by running:

asSGDF_GROD(x, offset=c(3600,20400),
region.dim=c(8140,18000),CRS("+proj=longlat" ))

and I get a message that says

Error: object is not subsettable

If anybody could help me out, I would greatly appreciate it.

Thank you
Harry




More information about the R-sig-Geo mailing list