What does the unzip(temp, "Brasil.shp") function produce? A "shapefile" is actually several files, and all must be present in order to read the "shapefile".
I'd also suggest r-sig-geo for this kind of question. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 12/28/12 11:14 PM, "d...@riseup.net" <d...@riseup.net> wrote: >Dear all, I've been puzzled why I not able to load a shapefile from a >connection. Does anyone here can give a reasonable answer? >When I try the following script I got this error: >Error in getinfo.shape(fn) : Error opening SHP file > > >#Reproduction > >temp <- tempfile() >download.file("http://metodologiapolitica.com/download/Brasil.zip",temp) >shp.br <- readShapePoly(unzip(temp, "Brasil.shp")) >unlink(temp) > >Just for acknowledgement, I successful can load the file whenever I open >it from the disk. > >______________________________________________ >R-help@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.