[R-sig-Geo] Conflicting information between GDALinfo() and gdalinfo

Roger Bivand Roger.Bivand at nhh.no
Thu Jun 14 16:54:51 CEST 2012


GDALinfo() reports the lower left corner, which agrees with gdalinfo. 
Whether the origin is upper left or lower left is arbitrary, in sp and 
hence in rgdal, the origin of rasters is lower left.

Roger

On Thu, 14 Jun 2012, Agustin Lobo wrote:

> Hi!
> I'm having different origin according to gdalinfo ( "Origin =
> (0.000000000000000,1024.000000000000000)") and GDALinfo
> ("TTC0125v2flip.tif"). When displayed in QGIS, the origin is 0,1024
> (using ubuntu 10.04, see sessionInfo at the end, tif file here:
> http://dl.dropbox.com/u/3180464/TTC0125v2flip.tif
>
> tif file was saved with
> writeRaster(bout,filename="TTC0125v2flip.tif", format="GTiff",
> overwrite=TRUE,flip=T)
>
>> system("gdalinfo TTC0125v2flip.tif",intern=T)
> [1] "Driver: GTiff/GeoTIFF"
> "Files: TTC0125v2flip.tif"
> [3] "Size is 1280, 1024"
> "Coordinate System is `'"
> [5] "Origin = (0.000000000000000,1024.000000000000000)"
> "Pixel Size = (1.000000000000000,-1.000000000000000)"
> [7] "Image Structure Metadata:"                                   "
> COMPRESSION=LZW"
> [9] "  INTERLEAVE=PIXEL"
> "Corner Coordinates:"
> [11] "Upper Left  (       0.000,    1024.000) "
> "Lower Left  (   0.0000000,   0.0000000) "
> [13] "Upper Right (    1280.000,    1024.000) "
> "Lower Right (    1280.000,       0.000) "
> [15] "Center      (     640.000,     512.000) "
> "Band 1 Block=1280x1 Type=Float32, ColorInterp=Gray"
> [17] "  Min=12.000 Max=219.000 "                                   "
> Minimum=12.000, Maximum=219.000, Mean=0.000, StdDev=0.000"
> [19] "  NoData Value=-3.39999999999999996e+38"                     "
> Metadata:"
> [21] "    STATISTICS_MAXIMUM=219"                                  "
> STATISTICS_MEAN=0"
> [23] "    STATISTICS_MINIMUM=12"                                   "
> STATISTICS_STDDEV=0"
> [25] "Band 2 Block=1280x1 Type=Float32, ColorInterp=Undefined"     "
> Min=0.000 Max=215.000 "
> [27] "  Minimum=0.000, Maximum=215.000, Mean=0.000, StdDev=0.000"  "
> NoData Value=-3.39999999999999996e+38"
> [29] "  Metadata:"                                                 "
> STATISTICS_MAXIMUM=215"
> [31] "    STATISTICS_MEAN=0"                                       "
> STATISTICS_MINIMUM=0"
> [33] "    STATISTICS_STDDEV=0"
> "Band 3 Block=1280x1 Type=Float32, ColorInterp=Undefined"
> [35] "  Min=0.000 Max=234.000 "                                    "
> Minimum=0.000, Maximum=234.000, Mean=0.000, StdDev=0.000"
> [37] "  NoData Value=-3.39999999999999996e+38"                     "
> Metadata:"
> [39] "    STATISTICS_MAXIMUM=234"                                  "
> STATISTICS_MEAN=0"
> [41] "    STATISTICS_MINIMUM=0"                                    "
> STATISTICS_STDDEV=0"
> [43] "Band 4 Block=1280x1 Type=Float32, ColorInterp=Undefined"     "
> Min=0.000 Max=255.000 "
> [45] "  Minimum=0.000, Maximum=255.000, Mean=0.000, StdDev=0.000"  "
> NoData Value=-3.39999999999999996e+38"
> [47] "  Metadata:"                                                 "
> STATISTICS_MAXIMUM=255"
> [49] "    STATISTICS_MEAN=0"                                       "
> STATISTICS_MINIMUM=0"
> [51] "    STATISTICS_STDDEV=0"
> "Band 5 Block=1280x1 Type=Float32, ColorInterp=Undefined"
> [53] "  Min=0.000 Max=221.000 "                                    "
> Minimum=0.000, Maximum=221.000, Mean=0.000, StdDev=0.000"
> [55] "  NoData Value=-3.39999999999999996e+38"                     "
> Metadata:"
> [57] "    STATISTICS_MAXIMUM=221"                                  "
> STATISTICS_MEAN=0"
> [59] "    STATISTICS_MINIMUM=0"                                    "
> STATISTICS_STDDEV=0"
> [61] "Band 6 Block=1280x1 Type=Float32, ColorInterp=Undefined"     "
> Min=0.000 Max=178.000 "
> [63] "  Minimum=0.000, Maximum=178.000, Mean=0.000, StdDev=0.000"  "
> NoData Value=-3.39999999999999996e+38"
> [65] "  Metadata:"                                                 "
> STATISTICS_MAXIMUM=178"
> [67] "    STATISTICS_MEAN=0"                                       "
> STATISTICS_MINIMUM=0"
> [69] "    STATISTICS_STDDEV=0"
>> GDALinfo("TTC0125v2flip.tif")
> rows        1024
> columns     1280
> bands       6
> origin.x        0
> origin.y        0
> res.x       1
> res.y       1
> ysign       -1
> oblique.x   0
> oblique.y   0
> driver      GTiff
> projection  NA
> file        TTC0125v2flip.tif
> apparent band summary:
>   GDType Bmin Bmax Bmean Bsd hasNoDataValue NoDataValue
> 1 Float32   12  219     0   0           TRUE    -3.4e+38
> 2 Float32    0  215     0   0           TRUE    -3.4e+38
> 3 Float32    0  234     0   0           TRUE    -3.4e+38
> 4 Float32    0  255     0   0           TRUE    -3.4e+38
> 5 Float32    0  221     0   0           TRUE    -3.4e+38
> 6 Float32    0  178     0   0           TRUE    -3.4e+38
>
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=C
>               LC_NAME=C
> [9] LC_ADDRESS=C               LC_TELEPHONE=C
> LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_2.0-02 rgdal_0.7-5   sp_0.9-99
>
> loaded via a namespace (and not attached):
> [1] grid_2.15.0     lattice_0.19-30 tools_2.15.0
>
>
> Any help?
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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