Dear Roger,

Indeed. I understand it correctly now. In my case, removing the 
reference to the shape file works well, as Pascal Oettli and Tom 
Philippi suggested. I haven't really notice the importance in the syntax 
change. I now use (as suggested by Pascal, but Tom's solution works 
equivalently well) :

setwd("D:/mydirectory/")
carte = readOGR(getwd(),layer="COMMUNE") and everything works well.

Thank you very much for both your efforts in making all this work and 
for your disponibility.
All the Best. Julien


Le 18/01/2013 12:45, Roger Bivand a écrit :
> 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.
>
> 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@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>

-- 
Julien Salanié
Maître de conférences en économie

GRANEM (UMR MA n°49) - Université d'Angers et Agrocampus Ouest
http://ead.univ-angers.fr/~granem08/

AGROCAMPUS OUEST - Centre d'Angers
Institut National d'Horticulture et de Paysage
2 rue Le Nôtre
ANGERS 49045 cedex 01
tel: +33 (0)2 41 22 55 17
fax: +33 (0)2 41 22 54 13
http://www.agrocampus-ouest.fr

European Consortium on Landscape Economics
http://www.ceep-europe.org


	[[alternative HTML version deleted]]

