<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">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 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 class="HOEnZb"><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>_______________________________________________<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><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><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: +55(55)33012083</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>
</div>