On Wed, May 7, 2014 at 12:21 PM, Agustin Lobo <alobolistas@gmail.com> wrote:

> Does anyone know if readOGR() can be used with remote files on remote
> folders?
> The following does not work for me:
> NWEur <- readOGR(dsn="http://www.wuala.com/aloboa/NWEur
> ",layer="NWEur",stringsAsFactors=FALSE)
> Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding,
> use_iconv = use_iconv) :
>   Cannot open file
>

 That's not going to work - the dsn is passed through to OGR and it doesn't
support that kind of thing - sadly http is not a network filesystem
(although I suspect there are filesystem shims that let you mount http
servers as file systems via something like Gnome VFS - read only)...


> (note that you can paste the url into your browser and works and that
> there is no https)
>
> But actually even this example from
> https://personality-project.org/r/r.guide.html
> does not work for me:
>
> datafilename <-
> "http://personality-project.org/r/datasets/Maps.mixx.msq1.epi.bf.txt"
> person.data  <- read.table(datafilename,header=TRUE)
> Error in file(file, "rt") : cannot open the connection
>
> I also need to specify method="curl" to get download.fiel()  to work:
> download.file("https://dl.dropboxusercontent.com/u/3180464/NWEur.zip
> ","NWEur.zip",method="curl")
>
> so I do not know if I have an idiosynchratic web security ward or I'm
> just not doing things right
>


help(url) says:

   Note that ‘https://’ connections are not supported except on
     Windows [with exceptions]

and although your URL starts http that actually gets a "302 redirect"
response to an https - here's some output from wget:

HTTP request sent, awaiting response... 302 Found
Location:
https://personality-project.org/r/datasets/Maps.mixx.msq1.epi.bf.txt[following]

I don't know if read.table is failing because it can't follow the redirect
or because it does follow and then fails because its an https...

Barry

	[[alternative HTML version deleted]]

