[R-sig-Geo] a problem with readOGR
Roger Bivand
Roger.Bivand at nhh.no
Fri Jan 18 15:32:08 CET 2013
On Fri, 18 Jan 2013, Roger Bivand wrote:
> On Fri, 18 Jan 2013, Pascal Oettli wrote:
>
>> Hello,
>>
>> To me, the following works:
>>
>> setwd("D:/mydirectory/")
>> carte = readOGR(getwd(),layer="COMMUNE")
>
> Yes, thanks for the reports. In the changes made for 0.8-*, an attempt is
> made for the ESRI Shapefile driver to read the LDID byte in the *.dbf file to
> indicate which character set is used for encoding. The current code is:
>
> con <- file(paste(dsn, .Platform$file.sep, layer, ".dbf", sep=""), "rb")
>
> which will fail if dsn is the shapefile itself, but pass if dsn is the data
> source name (the directory in which the shapefiles are placed). I'll try to
> patch this so that both ways of reading shapefiles work again, and report
> back when the fix is committed. The failure was in ogrInfo() inside readOGR()
> - running traceback() after the error would show this.
rgdal version 0.8-4 will resolve the problem, SVN revision 431. It has
been submitted to CRAN. This is also related to
https://stat.ethz.ch/pipermail/r-sig-geo/2013-January/017210.html
https://stat.ethz.ch/pipermail/r-sig-geo/2012-December/016942.html
Roger
>
> Best wishes,
>
> Roger
>
>>
>> HTH,
>> Pascal
>>
>> Le 18/01/2013 08:35, Julien Salanié a écrit :
>>> Hello,
>>>
>>> I was working on a script (which was working perfectly). For some reason
>>> I updated my packages and readOGR() is not working anymore. I was able
>>> to read those data before. I decided to reinstall everything, and it is
>>> still not working. Does anyone has the same problem. Here is the code,
>>> the warning and session info :
>>>
>>> CODE:
>>> setwd("D:/mydirectory");
>>> carte = readOGR("COMMUNE.shp",layer="COMMUNE");
>>>
>>> COMMUNE.shp .dbf. and all other required files are in D:/mydirectory. I
>>> was able to build the map before the problem arised.
>>>
>>> WARNING:
>>> [8] ERREUR:
>>> impossible d'ouvrir la connexion
>>>
>>> That is : "Impossible to open connection".
>>>
>>> SESSION INFO:
>>> > sessionInfo();
>>> R version 2.15.2 (2012-10-26)
>>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>>
>>> locale:
>>> [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
>>> LC_MONETARY=French_France.1252 LC_NUMERIC=C
>>> LC_TIME=French_France.1252
>>>
>>> attached base packages:
>>> [1] splines grid stats graphics grDevices utils datasets
>>> methods base
>>>
>>> other attached packages:
>>> [1] mgcv_1.7-22 sfsmisc_1.0-23 spdep_0.5-56 coda_0.16-1
>>> deldir_0.0-21 maptools_0.8-22 foreign_0.8-52 nlme_3.1-107
>>> Matrix_1.0-9 boot_1.3-7
>>> [11] rgdal_0.8-3 lattice_0.20-13 geoR_1.7-4 sp_1.0-5
>>> Rcmdr_1.9-3 car_2.0-15 nnet_7.3-5 MASS_7.3-22
>>>
>>> loaded via a namespace (and not attached):
>>> [1] LearnBayes_2.12 RandomFields_2.0.59 splancs_2.01-32 tcltk_2.15.2
>>>
>>>
>>> Thank you very much for your help. Best regards. Julien
>>>
>>>
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list