[R-sig-Geo] trailing slash when writing shapefiles with writeOGR

Roman Luštrik roman.lustrik at gmail.com
Sat Apr 13 19:20:15 CEST 2013


I just noticed that writing to a shape file using a trailing slash in
the directory path doesn't work (with a somewhat non-informative
error):

> writeOGR(obj = pril08c2.poly, dsn = "q:/projekti/gams_eksp/analiza/", layer = "priloznostno_2008_2012_cona2", driver = "ESRI Shapefile")
Error in writeOGR(obj = pril08c2.poly, dsn =
"q:/projekti/gams_eksp/analiza/",  :
  Creation of output file failed

While this does:

> writeOGR(obj = pril08c2.poly, dsn = "q:/projekti/gams_eksp/analiza", layer = "priloznostno_2008_2012_cona2", driver = "ESRI Shapefile")
>

The only difference is the trailing slash in the `dsn` path to the
folder is missing. I hope this will save someone some time - it ate
away most of my Saturday morning.

Cheers,
Roman

-- 
In God we trust, all others bring data.



More information about the R-sig-Geo mailing list