Skip to content
Back to formatted view

Raw Message

Message-ID: <CAHT1vpgggTbOZ0EAfcOLKFfRJS74GCpUgG56xJJ0ydJWtXZC1g@mail.gmail.com>
Date: 2013-04-13T17:20:15Z
From: Roman Luštrik
Subject: trailing slash when writing shapefiles with writeOGR

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.