Hello all, I am new to rgdal. I downloaded a tif file from 'http://mrdata.usgs.gov/radiometric/data/NArad_U_geog83.tif' which i would like to convert into a regular data frame so that i can plot it using ggplot2. when i tried to read the file using readGDAL i get a warning message NArad_U_geog83.tif has GDAL driver GTiff and has 2432 rows and 5868 columns Warning message: In readGDAL("NArad_U_geog83.tif") : GeoTransform values not available What does it mean? Here s the summary of the file: Object of class SpatialGridDataFrame Coordinates: min max x 0 5868 y 0 2432 Is projected: NA proj4string : [NA] Grid attributes: cellcentre.offset cellsize cells.dim x 0.5 1 5868 y 0.5 1 2432 Data attributes: band1 band2 band3 Min. : 0.0 Min. : 0.0 Min. : 0 1st Qu.:255.0 1st Qu.:255.0 1st Qu.:255 Median :255.0 Median :255.0 Median :255 Mean :222.4 Mean :231.1 Mean :226 3rd Qu.:255.0 3rd Qu.:255.0 3rd Qu.:255 Max. :255.0 Max. :255.0 Max. :255 Can anyone please tell me which packages i should look into for converting it into a data frame so that i can plot it using ggplot2. Thanks, Swagath
TIF with 3 bands to data frame
6 messages · Swagath, Etienne B. Racine, MacQueen, Don +2 more
3 days later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130506/0c9bfb82/attachment.pl>
I don't really know, exactly, but I'm going to guess. The warning message refers to missing "GeoTransform" values. I find that suggestive of information about the coordinate system. The website also has a link to download a "TFW", which I believe contains coordinate system information. This is supported by the absence of proj4string info in your summary info. Try downloading the TFW file, putting it in the same directory as the tif, and then try reading again with rgdal. Instead, you might consider reading the file using the raster package; conversion to a suitable data frame might be simpler from that point. -Don
Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/3/13 5:41 AM, "Swagath Navin" <swagathnavin82 at gmail.com> wrote: >Hello all, > >I am new to rgdal. I downloaded a tif file from >'http://mrdata.usgs.gov/radiometric/data/NArad_U_geog83.tif' which i >would like to convert into a regular data frame so that i can plot it >using ggplot2. > >when i tried to read the file using readGDAL i get a warning message > >NArad_U_geog83.tif has GDAL driver GTiff >and has 2432 rows and 5868 columns >Warning message: >In readGDAL("NArad_U_geog83.tif") : GeoTransform values not available > >What does it mean? > >Here s the summary of the file: > >Object of class SpatialGridDataFrame >Coordinates: > min max >x 0 5868 >y 0 2432 >Is projected: NA >proj4string : [NA] >Grid attributes: > cellcentre.offset cellsize cells.dim >x 0.5 1 5868 >y 0.5 1 2432 >Data attributes: > band1 band2 band3 > Min. : 0.0 Min. : 0.0 Min. : 0 > 1st Qu.:255.0 1st Qu.:255.0 1st Qu.:255 > Median :255.0 Median :255.0 Median :255 > Mean :222.4 Mean :231.1 Mean :226 > 3rd Qu.:255.0 3rd Qu.:255.0 3rd Qu.:255 > Max. :255.0 Max. :255.0 Max. :255 > >Can anyone please tell me which packages i should look into for >converting it into a data frame so that i can plot it using ggplot2. > >Thanks, >Swagath > >_______________________________________________ >R-sig-Geo mailing list >R-sig-Geo at r-project.org >https://stat.ethz.ch/mailman/listinfo/r-sig-geo
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130506/6a3ef78d/attachment.pl>
On Mon, 6 May 2013, MacQueen, Don wrote:
I don't really know, exactly, but I'm going to guess.
The message says that:
In readGDAL("NArad_U_geog83.tif") : GeoTransform values not available
which is confirmed by running:
$ file NArad_U_geog83.tif
NArad_U_geog83.tif: TIFF image data, little-endian
$ gdalinfo NArad_U_geog83.tif
Driver: GTiff/GeoTIFF
Files: NArad_U_geog83.tif
Size is 5868, 2432
Coordinate System is `'
Metadata:
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
TIFFTAG_XRESOLUTION=671
TIFFTAG_YRESOLUTION=671
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 2432.0)
Upper Right ( 5868.0, 0.0)
Lower Right ( 5868.0, 2432.0)
Center ( 2934.0, 1216.0)
Band 1 Block=5868x16 Type=Byte, ColorInterp=Red
Band 2 Block=5868x16 Type=Byte, ColorInterp=Green
Band 3 Block=5868x16 Type=Byte, ColorInterp=Blue
so the file is just a Tiff image, not a GTiff file. It has no information
on its placing in space or dimensions. The table at:
http://mrdata.usgs.gov/radiometric/
actually says that it is a Tiff file, matched by Geosoft Grid files,
discussed in a thread resolved by Barry Rowlingson:
https://stat.ethz.ch/pipermail/r-sig-geo/2013-April/018157.html
apparently by the same person who is puzzled now. The resolution is
probably the same, so I'm not sure why the question is being repeated.
Roger
The warning message refers to missing "GeoTransform" values. I find that suggestive of information about the coordinate system. The website also has a link to download a "TFW", which I believe contains coordinate system information. This is supported by the absence of proj4string info in your summary info. Try downloading the TFW file, putting it in the same directory as the tif, and then try reading again with rgdal. Instead, you might consider reading the file using the raster package; conversion to a suitable data frame might be simpler from that point. -Don
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
Hi Roger, Thanks for your reply. You are correct, its more similar to my previous post. Thanks to help from Barry, i was able to convert the '.grd' file. Since there is also a tif file available, i was trying to skip the part of downloading the software and use R directly to convert into a data frame. Thanks, Swagath
On 5/6/13 10:06 PM, Roger Bivand wrote:
On Mon, 6 May 2013, MacQueen, Don wrote:
I don't really know, exactly, but I'm going to guess.
The message says that:
In readGDAL("NArad_U_geog83.tif") : GeoTransform values not available
which is confirmed by running:
$ file NArad_U_geog83.tif
NArad_U_geog83.tif: TIFF image data, little-endian
$ gdalinfo NArad_U_geog83.tif
Driver: GTiff/GeoTIFF
Files: NArad_U_geog83.tif
Size is 5868, 2432
Coordinate System is `'
Metadata:
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
TIFFTAG_XRESOLUTION=671
TIFFTAG_YRESOLUTION=671
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 2432.0)
Upper Right ( 5868.0, 0.0)
Lower Right ( 5868.0, 2432.0)
Center ( 2934.0, 1216.0)
Band 1 Block=5868x16 Type=Byte, ColorInterp=Red
Band 2 Block=5868x16 Type=Byte, ColorInterp=Green
Band 3 Block=5868x16 Type=Byte, ColorInterp=Blue
so the file is just a Tiff image, not a GTiff file. It has no
information on its placing in space or dimensions. The table at:
http://mrdata.usgs.gov/radiometric/
actually says that it is a Tiff file, matched by Geosoft Grid files,
discussed in a thread resolved by Barry Rowlingson:
https://stat.ethz.ch/pipermail/r-sig-geo/2013-April/018157.html
apparently by the same person who is puzzled now. The resolution is
probably the same, so I'm not sure why the question is being repeated.
Roger
The warning message refers to missing "GeoTransform" values. I find that suggestive of information about the coordinate system. The website also has a link to download a "TFW", which I believe contains coordinate system information. This is supported by the absence of proj4string info in your summary info. Try downloading the TFW file, putting it in the same directory as the tif, and then try reading again with rgdal. Instead, you might consider reading the file using the raster package; conversion to a suitable data frame might be simpler from that point. -Don