[R-sig-Geo] readOGR does not read file names with accent

Daniel Knitter knitter at geographie.uni-kiel.de
Thu Feb 15 08:34:35 CET 2018


hi Patrick,

I think it is not about the accent but the space in your path. Try to escape this with "\" :

st_read("./Desktop/foldername\ with\ spaces/shapefile.shp")


Daniel



On Thu, 15 Feb 2018 08:20:12 +0100
Patrick Giraudoux <patrick.giraudoux at univ-fcomte.fr> wrote:

> > 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.
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 

Dr. Daniel Knitter
CRC1266 -- Scales of Transformation
Project A2 "Integrative Modeling of Socio-Environmental Dynamics"

Christian-Albrechts-Universität zu Kiel
Department of Geography
Physical Geography -- Landscape Ecology and Geoinformation
Ludewig-Meyn-Str. 14, room 109
D - 24118 Kiel, Germany

Phone: +49 431 880 2941
Email: knitter at geographie.uni-kiel.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20180215/7d4666bc/attachment.sig>


More information about the R-sig-Geo mailing list