[R-sig-Geo] doubt with readGDAL

Roger Bivand Roger.Bivand at nhh.no
Sun Oct 4 22:26:35 CEST 2009


On Sun, 4 Oct 2009, Barry Rowlingson wrote:

> 2009/10/4 Roger Bivand <Roger.Bivand at nhh.no>:
>
>> Thanks for a clear report - the y range and the cell sizes were wrong when
>> all three of offset=, region.dim= and output.dim= were used together. With
>> current rgdal 0.6-18, using the Arc ASCII file (not GTiff), I see for the
>> undecimated subscene:
>>
>>> gridparameters(catb)
>>
>>  cellcentre.offset     cellsize cells.dim
>> x      4.839851e-08 0.0008333333      5000
>> y      4.041750e+01 0.0008333333      2600
>>>
>>> bbox(catb)
>>
>>            min      max
>> x -0.0004166183  4.16625
>> y 40.4170835754 42.58375
>>
>> but for the decimated subscene:
>>
>>> gridparameters(cata)
>>
>>  cellcentre.offset   cellsize cells.dim
>> x       0.004584215 0.01000167       500
>> y     -15.769325078 0.01923397       260
>>>
>>> bbox(cata)
>>
>>            min        max
>> x -4.166183e-04   5.000417
>> y -1.577894e+01 -10.778109
>>
>>
>> In forthcoming 0.6-19 (committed to the sourceforge rgdal repository) and
>> the undecimated subscene:
>
> I'm using: Rgdal=0.6-18 with R=2.9.2, sp=0.9-37and I don't see this
> problem (see my previous post).

The area is a 5 degree by 5 degree part of the Mediteranean coast, as:

> GDALinfo("srtm_37_04.asc")
rows        6001
columns     6001
bands       1
origin.x        -0.0004166183
origin.y        39.99958
res.x       0.0008333333
res.y       0.0008333333
oblique.x   0
oblique.y   0
driver      AAIGrid
projection  +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
file        srtm_37_04.asc
apparent band summary:
   GDType        Bmin       Bmax
1  Int32 -2147483648 2147483647

indicates - filled out by running gdalinfo on the file:

> system("gdalinfo srtm_37_04.asc")
Driver: AAIGrid/Arc/Info ASCII Grid
Files: srtm_37_04.asc
        srtm_37_04.prj
Size is 6001, 6001
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.257223563,
             AUTHORITY["EPSG","7030"]],
         TOWGS84[0,0,0,0,0,0,0],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0,
         AUTHORITY["EPSG","8901"]],
     UNIT["degree",0.0174532925199433,
         AUTHORITY["EPSG","9108"]],
     AUTHORITY["EPSG","4326"]]
Origin = (-0.000416618268153,45.000416908780309)
Pixel Size = (0.000833333333333,-0.000833333333333)
Corner Coordinates:
Upper Left  (  -0.0004166,  45.0004169) (  0d 0'1.50"W, 45d 0'1.50"N)
Lower Left  (  -0.0004166,  39.9995836) (  0d 0'1.50"W, 39d59'58.50"N)
Upper Right (   5.0004167,  45.0004169) (  5d 0'1.50"E, 45d 0'1.50"N)
Lower Right (   5.0004167,  39.9995836) (  5d 0'1.50"E, 39d59'58.50"N)
Center      (   2.5000000,  42.5000002) (  2d30'0.00"E, 42d30'0.00"N)
Band 1 Block=6001x1 Type=Int32, ColorInterp=Undefined
   NoData Value=-9999

The "logic" in readGDAL() was shot when both subscene selection and 
decimation were used. Try dropping the decimation, and you'll see the 
difference; cata and cata2 in the bug report have the same grid 
parameters.

Roger


>
> Barry
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list