readOGR does not read file names with accent
Please try to install a draft version of rgdal at: https://win-builder.r-project.org/vvWJdd1isnsR and report on its performance for your charset: ogrInfo("./track g?n?t/g?linotte/2017/Tr?montagne", "trac?_chaux_du_dombief") ogrListLayers("./track g?n?t/g?linotte/2017/Tr?montagne") etc. Beware that my email is probably encoded in UTF-8, so enter the diacriticals on your own machine. Roger
On Thu, 15 Feb 2018, Patrick Giraudoux wrote:
PS: surprisingly, the files with accent are well read from QGIS (however QGIS uses gdal as workhorse...) Le 15/02/2018 ? 08:20, Patrick Giraudoux a ?crit?:
Patrick: Is there also a space in the file path? What is the locale, I guess CP1252?
My locale is fr;Fran?ais (France) Le 15/02/2018 ? 07:57, Roger Bivand a ?crit?:
... and could you try sf::st_read(), as it uses enc2utf8() internally? If that works, the same may be used in rgdal.
st_read has the same issue: reads the file with no accent but not with
accent:
library(sf)
st_read("./track
g?n?t/g?linotte/2017/Tr?montagne","trace_chaux_du_dombief")
Reading layer `trace_chaux_du_dombief' from data source
`U:\Users\pgiraudo2\Documents\Tetra\Master Tony Vialet\track
g??n??t\g??linotte\2017\Tr??montagne' using driver `ESRI Shapefile'
Simple feature collection with 1 feature and 5 fields
geometry type: LINESTRING
dimension: XY
bbox: xmin: 870249.9 ymin: 2180142 xmax: 871070 ymax: 2180930
epsg (SRID): NA
proj4string: NA
but
st_read("./track
g?n?t/g?linotte/2017/Tr?montagne","trac?_chaux_du_dombief")
Cannot open layer trac?_chaux_du_dombief
Error in CPL_read_ogr(dsn, layer, as.character(options), quiet, type,
: Opening layer failed.
Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no http://orcid.org/0000-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en