Import .gz-File
Rosi, I forgot to add that you need to install package "GEOquery" first to access gunzip function. -Ken
On 6/14/2010 12:30 PM, Kenneth Takagi wrote:
Rosi,
Try this:
#unzip "temp.gz" files and save file as "temp.txt":
gunzip(filename = "temp.gz", remove = T, overwrite = T, destname =
"temp.txt")
#now read in "temp.txt" as SpatialGridDataFrame
SGDF = read.asciigrid("temp1.txt", proj4string = CRS("+init=epsg:4322"))
This assumes that "temp.txt" is a ascii grid file.
HTH,
Ken
On 6/14/2010 11:27 AM, Roger Bivand wrote:
On Mon, 14 Jun 2010, Siber Rosi wrote:
Dear all, Is it possible to import Esri ascii files which are compressed in a .gz file direct to R? My example : 111212.asc in an .gz File I thought there might be a similar command as the "zip.file.extract"- command. I tried the "gzfile" command, but it did not work. Do you have any suggestions?
The readGDAL command in rgdal needs a file, I believe, as also does readAsciiGrid() in maptools. The header is part of the same file, so it needs to be read in different ways, first to get the metadata, then to read the data. Roger
Thank you very much in advance. Best wishes, Rosi ??? Rosi Siber Swiss Federal Institute of Aquatic Science and Technology (Eawag) Siam Ueberlandstrasse 133 8600 Duebendorf Switzerland Phone: +41 (0)44 823 5566 Fax: +41 (0)44 823 5375 rosi.siber at eawag.ch http://www.eawag.ch/~siberros [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo