<div dir="ltr">Luciano, boa tarde!<div><br></div><div>Acredito que a solução é essa mesmo. No seu primeiro email você estava tratando o gzip como zip. Você poderia pensar em usar gzfile(), mas o raster() não interpreta esse tipo de conexão.</div><div><br></div><div>Nos comandos abaixo, fiz opção por manter o arquivo .gz e não descompactar o arquivo no diretório corrente.</div><div><br><div><div><span style="font-family:monospace,monospace">url2 <- "<a href="ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz">ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz</a>"</span><br></div><div><font face="monospace, monospace">file2 <- basename(url2)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">setInternet2(F) ### para baixar do ftp no RStudio Windows!</font></div><div><font face="monospace, monospace">if (!file.exists(file2)) download.file(url2, destfile=file2, mode='wb')</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">sapply(c("raster", "R.utils"), require, char=T)</font></div><div><font face="monospace, monospace">r2 <- raster(gunzip(file2, remove=F, temp=T, over=T))</font></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Éder Comunello <<a href="mailto:comunello.eder@gmail.com" target="_blank">c</a><a href="mailto:omunello.eder@gmail.com" target="_blank">omunello.eder@gmail.com</a>> <br>Dourados, MS - [22 16.5'S, 54 49'W]<br></div></div></div>
<br><div class="gmail_quote">Em 10 de abril de 2015 12:07, Luciano F. Sgarbi <span dir="ltr"><<a href="mailto:luciano.f.sgarbi@gmail.com" target="_blank">luciano.f.sgarbi@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Oi Jônatan.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Muito obrigado pela solução...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Agora a pouco eu tentei desempacotar os arquivos via terminal (linux) e ele retornou a seguinte mensagem:</div><div class="gmail_default"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><font face="verdana, sans-serif" color="#ff0000">aa@aa:~/temp$ unzip -tq \*.zip</font></div><div class="gmail_default"><font face="verdana, sans-serif" color="#ff0000"><font face="arial, sans-serif"><span style="font-size:12.8000001907349px">[</span></font>SRTM_fB01_n000w177<font face="arial, sans-serif"><span style="font-size:12.8000001907349px">.zip]</span></font></font></div></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><font face="verdana, sans-serif" color="#ff0000">End-of-central-directory signature not found. Either this file is not</font></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><font face="verdana, sans-serif" color="#ff0000"> a zipfile, or it constitutes one disk of a multi-part archive. In the</font></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><font face="verdana, sans-serif" color="#ff0000"> latter case the central directory and zipfile comment will be found on</font></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><font face="verdana, sans-serif" color="#ff0000"> the last disk(s) of this archive.</font></div></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Assumindo que era um erro no formato de arquivo, eu cheguei até a seguinte solução:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><span class=""><div class="gmail_default">url2<-"<a href="ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz" target="_blank">ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz</a>"</div><div class="gmail_default">file2<-'SRTM_fB01_n000w177'##Tamanho do arquivo: 66k</div></span><div class="gmail_default">utils::download.file(url2,destfile=file2,mode='b',method='wget')</div><div class="gmail_default">R.utils::gunzip(file2,paste(file2,'.tif',sep=''))</div><div class="gmail_default">raster(paste(file2,'.tif',sep=''))</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default">Mas se alguém tiver uma solução mais 'elegante', por favor, fique a vontade!</div><div class="gmail_default">Abraços</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">Em 10 de abril de 2015 12:53, Jônatan <span dir="ltr"><<a href="mailto:jdtatsch@gmail.com" target="_blank">jdtatsch@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Eu sugiro dar uma olhada em ?getData do pacote raster.</div><div><br></div><div><br></div><div><br></div><div>url2<-"<a href="ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz" target="_blank">ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz</a>"</div><div><br></div><div># file2<-'SRTM_fB01_n000w177'##Tamanho do arquivo: 66k</div><div>file2 <- basename(url2)</div><div><br></div><div># utils::download.file(url2,destfile=paste(file2,".zip",sep=""),mode='b',method='wget')</div><div>utils::download.file(url2, destfile = file2, mode='b', method='wget')</div><div><br></div><div>#r2<-raster::raster(unzip(paste(file2,".zip",sep=""),paste(file2,".tif",sep="")))</div><div>## unzip: Extract files from or list a <b>zip archive</b>.</div><div><br></div><div>## alternativa com gunzip</div><div>cmd <- paste("gunzip", file2)</div><div>system(cmd) </div><div>r2 <- raster::raster(gsub("\\.gz", "", file2))</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-10 11:05 GMT-03:00 Luciano F. Sgarbi <span dir="ltr"><<a href="mailto:luciano.f.sgarbi@gmail.com" target="_blank">luciano.f.sgarbi@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Bom dia pessoal.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Gostaria de saber se algum de vocês tem a solução para o seguinte problema:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Estou baixando uns arquivos raster (pelo R) e gostaria de salva-los em uma pasta para posteriormente usá-los.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">O problema é que para um formato de arquivo e site eu estou conseguindo (Exemplo 1 no código abaixo), entretanto, para o outro conjunto eu não consigo ler os arquivos de jeito nenhum.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Qualquer ajuda sera super bem vinda..</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">###</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="verdana, sans-serif">##Inicio: Exemplo 1</font></div><div class="gmail_default"><font face="verdana, sans-serif">require(raster)</font></div><div class="gmail_default"><font face="verdana, sans-serif">url1<-"<a href="ftp://srtm.csi.cgiar.org/SRTM_v41/SRTM_Data_ArcASCII/srtm_03_08.zip" target="_blank">ftp://srtm.csi.cgiar.org/SRTM_v41/SRTM_Data_ArcASCII/srtm_03_08.zip</a>"</font></div><div class="gmail_default"><font face="verdana, sans-serif">file1<-'srtm_03_08'##Tamanho do arquivo: 395k</font></div><div class="gmail_default"><font face="verdana, sans-serif">utils::download.file(url1,destfile=paste(file1,".zip",sep=""),mode='b',method='wget')</font></div><div class="gmail_default"><font face="verdana, sans-serif">r1<-raster::raster(unzip(paste(file1,".zip",sep=""),paste(file1,".asc",sep="")))</font></div><div class="gmail_default"><font face="verdana, sans-serif">r1</font></div><div class="gmail_default"><font face="verdana, sans-serif">##Fim: Exemplo 1</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">##Aqui está o problema</font></div><div class="gmail_default"><font face="verdana, sans-serif">##Tentativa 1</font></div><div class="gmail_default"><font face="verdana, sans-serif">url2<-"<a href="ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz" target="_blank">ftp://ftp.glcf.umd.edu/glcf/SRTM/media/GLCF.TSM.B3-010.00.Finished_B-01sec-Degree-United_States/Degree_Tiles/n000/SRTM_fB01_n000w177/SRTM_fB01_n000w177.tif.gz</a>"</font></div><div class="gmail_default"><font face="verdana, sans-serif">file2<-'SRTM_fB01_n000w177'##Tamanho do arquivo: 66k</font></div><div class="gmail_default"><font face="verdana, sans-serif">utils::download.file(url2,destfile=paste(file2,".zip",sep=""),mode='b',method='wget')</font></div><div class="gmail_default"><font face="verdana, sans-serif">r2<-raster::raster(unzip(paste(file2,".zip",sep=""),paste(file2,".tif",sep="")))</font></div><div class="gmail_default"><font face="verdana, sans-serif">zip.file.extract(paste(file2,".zip",sep=""),paste(file2,".tif",sep=""))</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">##Tentativa 2</font></div><div class="gmail_default"><font face="verdana, sans-serif">temp<-tempfile()</font></div><div class="gmail_default"><font face="verdana, sans-serif">utils::download.file(url2,destfile=temp,mode='b',method='wget')</font></div><div class="gmail_default"><font face="verdana, sans-serif">raster::raster(temp)</font></div><div class="gmail_default"><font face="verdana, sans-serif">raster(paste(temp,'/',file2,".tif",sep=""))</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">###Informações do OS</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif"><div class="gmail_default"> sysname release </div><div class="gmail_default"> "Linux" "3.2.0-39-generic-pae" </div><div class="gmail_default"> version nodename </div><div class="gmail_default">"#62-Ubuntu SMP Wed Feb 27 22:25:11 UTC 2013" "aa" </div><div class="gmail_default"> machine login </div><div class="gmail_default"> "i686" "unknown" </div><div class="gmail_default"> user effective_user </div><div class="gmail_default"> "aa" "aa" </div><div class="gmail_default"><br></div><div class="gmail_default">> sessionInfo()</div><div class="gmail_default">R version 3.1.3 (2015-03-09)</div><div class="gmail_default">Platform: i686-pc-linux-gnu (32-bit)</div><div class="gmail_default">Running under: Ubuntu precise (12.04.5 LTS)</div><div class="gmail_default"><br></div><div class="gmail_default">locale:</div><div class="gmail_default"> [1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C LC_TIME=pt_BR.UTF-8 LC_COLLATE=pt_BR.UTF-8 </div><div class="gmail_default"> [5] LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=pt_BR.UTF-8 LC_PAPER=pt_BR.UTF-8 LC_NAME=C </div><div class="gmail_default"> [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C </div><div class="gmail_default"><br></div><div class="gmail_default">attached base packages:</div><div class="gmail_default">[1] stats graphics grDevices utils datasets methods base </div><div class="gmail_default"><br></div><div class="gmail_default">other attached packages:</div><div class="gmail_default">[1] RCurl_1.95-4.1 bitops_1.0-6 rgdal_0.9-2 raster_2.2-31 sp_1.0-15 downloader_0.3</div><div class="gmail_default"><br></div><div class="gmail_default">loaded via a namespace (and not attached):</div><div class="gmail_default">[1] digest_0.6.4 grid_3.1.3 lattice_0.20-30 tools_3.1.3 </div></font></div></div><span><font color="#888888"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div><br></div>-- <br><div><div dir="ltr"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote><div><font color="#444444" face="comic sans ms, sans-serif"><i><span style="font-size:12.7272720336914px">Luciano F. Sgarbi</span></i></font></div><div><font color="#444444" face="comic sans ms, sans-serif"><i><a href="http://lattes.cnpq.br/9788198135883354" target="_blank"> Currículo Lattes</a></i></font></div><div><font face="comic sans ms, sans-serif"><font color="#444444"><i>Laboratório de Ecologia Teórica e Síntese<br style="font-size:12.7272720336914px;background-color:rgb(255,255,255)"></i></font><i style="color:rgb(68,68,68)"><span style="font-size:12.7272720336914px">Departamento de Ecologia, </span><span style="font-size:12.7272720336914px">Instituto de Ciências Biológicas V.</span></i><font color="#444444"><i><br></i></font></font><div style="background-color:rgb(255,255,255)"><i><font color="#444444" face="comic sans ms, sans-serif"><font style="font-size:12.7272720336914px">Universidade Federal de Goiás, campus II, Goiânia-GO, </font>Brasil</font></i></div></div></div></div>
</font></span></div>
<br></div></div>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<span><font color="#888888"><br></font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><font style="font-family:arial">###############################################################</font><br><span style="font-family:arial;font-size:small">## </span><span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Jônatan Dupont Tatsch</span></div><div><span style="font-family:arial;font-size:small">## </span><span style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Professor do Departamento de Física</span><font face="arial" style="font-size:small"><br></font></div><div><span style="font-size:small;font-family:arial">## </span><span style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Centro de Ciências Exatas e Naturais (CCNE)</span><br></div><div><span style="font-size:small;font-family:arial">## </span><span style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Universidade Federal de Santa Maria</span></div><div><span style="font-family:arial;font-size:small">## </span><span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Faixa de Camobi, Prédio 13 - Campus UFSM - </span><span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Santa Maria, RS, Brasil - 97105-900</span><br></div><div style="font-family:arial;font-size:small">## <span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Telefone: <a href="tel:%2B55%2855%2933012083" value="+555533012083" target="_blank">+55(55)33012083</a></span><br></div><div style="font-family:arial;font-size:small">## <span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px"><a href="http://www.ufsm.br/meteorologia" target="_blank">www.ufsm.br/meteorologia</a></span></div><div style="font-family:arial;font-size:small">###############################################################</div></div></div>
</font></span></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"></blockquote><div><font color="#444444" face="comic sans ms, sans-serif"><i><span style="font-size:12.727272033691406px">Luciano F. Sgarbi</span></i></font></div><div><font color="#444444" face="comic sans ms, sans-serif"><i><a href="http://lattes.cnpq.br/9788198135883354" target="_blank"> Currículo Lattes</a></i></font></div><div><font face="comic sans ms, sans-serif"><font color="#444444"><i>Laboratório de Ecologia Teórica e Síntese<br style="font-size:12.727272033691406px;background-color:rgb(255,255,255)"></i></font><i style="color:rgb(68,68,68)"><span style="font-size:12.727272033691406px">Departamento de Ecologia, </span><span style="font-size:12.727272033691406px">Instituto de Ciências Biológicas V.</span></i><font color="#444444"><i><br></i></font></font><div style="background-color:rgb(255,255,255)"><i><font color="#444444" face="comic sans ms, sans-serif"><font style="font-size:12.727272033691406px">Universidade Federal de Goiás, campus II, Goiânia-GO, </font>Brasil</font></i></div></div></div></div>
</div>
</div></div><br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>