[R-sig-Geo] Reversed raster after readGDAL()

Sarah Goslee sarah.goslee at gmail.com
Wed Feb 10 17:34:20 CET 2010


This may well be too simplistic an answer, but it might just be image().

>From the help for image:
     Notice that ‘image’ interprets the ‘z’ matrix as a table of
     ‘f(x[i], y[j])’ values, so that the x axis corresponds to row
     number and the y axis to column number, with column 1 at the
     bottom, i.e. a 90 degree counter-clockwise rotation of the
     conventional printed layout of a matrix.

x <- matrix(rep(1:10, each=10), nrow=10)
x
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    3    4    5    6    7    8    9    10
 [3,]    1    2    3    4    5    6    7    8    9    10
 [4,]    1    2    3    4    5    6    7    8    9    10
 [5,]    1    2    3    4    5    6    7    8    9    10
 [6,]    1    2    3    4    5    6    7    8    9    10
 [7,]    1    2    3    4    5    6    7    8    9    10
 [8,]    1    2    3    4    5    6    7    8    9    10
 [9,]    1    2    3    4    5    6    7    8    9    10
[10,]    1    2    3    4    5    6    7    8    9    10
image(x) # not what you might expect
image(t(x)) # this view matches the matrix representation

What happens if you use plot(mygeotiff) instead of image(mygeotiff)?

Sarah

On Wed, Feb 10, 2010 at 11:17 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
> I think I tripped on this same stone, but cannot find anything in my
> records, perhaps it's on the lost computer.
>
> The file test2.tif was made by plugin Interpolation in QGIS out of a
> vector layer of points with nitrate concentration values, just
> a simple inverse distance method. I think that the author f that
> pluginis Marco Hugentobler (Marco, sorry if it's not you) to whom I'm
> forwarding.
>
> Relevant info from the metadata in QGIS for this raster:
>
> Layer Spatial Reference System:
> +proj=utm +zone=31 +ellps=intl +units=m +no_defs
>
> Origin
> 424389,4.68549e+06
>
> Pixel Size:
> 279.887,-279.887
>
> NW corner in QGIS (interactive):424388.820,4685490.931
> SW corner in QGIS (interactive):424389.122,4635951.740
>
> Image with grid: http://sites.google.com/site/eospansite/dummy/test2gridqgis.jpg
>
> The weird thing is that QGIS uses gdal to read the geotif files.
>
>
> Agus
>


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-sig-Geo mailing list