Error in ogrInfo (dsn = dsn,

0

Colleagues.

When I read another file that is in the same folder in the work environment, it appears:

source("Functions.R")
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  : 
  Cannot open data source

I switched computers and now do not read the functions

    
asked by Semillaca 03.08.2017 в 21:05
source

1 answer

1

I've noticed that rgdal functions work differently on different operating systems. Check how dsn is defined in the script and maybe there may be the problem.

I can tell you about my experience working on both OS X and Windows. To read a shapefile, it is executed as a generic:

library(rgdal)

readOGR(dsn,layer)

In OS X, none of the following options raise an error:

readOGR(dsn='/ruta/a/carpeta/',layer='prueba')
readOGR(dsn='/ruta/a/carpeta',layer='prueba')

In Windows, the second works for me without problems, but the first throws the following error:

Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  : 
  Cannot open layer

So if the work folder contains a / at the end, it could be that it is generating an error in your case.

    
answered by 03.08.2017 в 22:10