[R-sig-Geo] Problem reading back a raster from GRASS

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Jan 28 20:34:18 CET 2011


Hi,

It seems I'm having problem storing a raster into GRASS using the spgrass6 package. I writeRAST6() a 1376x1376 raster to GRASS, but when I readRAST6() it back to R the raster is only 1x1 pixels... Note that the raster is a bmp and hence is not projected to any coordinate system.

I must be doing something wrong. Here is my R code:

------------------------------------------------------------------
> image1 = readGDAL("D:/temp/image01.bmp")
  D:/Clients/AlainPaquette/AnalyseDeCimeR/images/image01.bmp has GDAL driver BMP
  and has 1376 rows and 1376 columns

> summary(image1)
  Object of class SpatialGridDataFrame
  Coordinates:
         min     max
  x    -2953 8123703
  y -8123703    2953
  Is projected: NA
  proj4string : [NA]
  Number of points: 2
  Grid attributes:
    cellcentre.offset cellsize cells.dim
  x                 0     5906      1376
  y          -8120750     5906      1376
  Data attributes:
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
   0.0000  1.0000  1.0000  0.9962  1.0000  1.0000

> writeRAST6(image1, "image1", overwrite=TRUE)
  ATTENTION : Raster map <image1> already exists and will be overwritten
  Projection of input dataset and current location appear to match

  RINGDA~1 terminé. Raster map <image1> created.

> image1_2 <-  readRAST6(c("image1"), cat=c(TRUE), ignore.stderr=TRUE, plugin=NULL)

> summary(image1_2)
  Object of class SpatialGridDataFrame
  Coordinates:
    min max
  x   0   1
  y   0   1
  Is projected: NA
  proj4string : [NA]
  Number of points: 2
  Grid attributes:
    cellcentre.offset cellsize cells.dim
  x               0.5        1         1
  y               0.5        1         1
  Data attributes:

  1

>
------------------------------------------------------------------

Thanks,

Pierre



More information about the R-sig-Geo mailing list