[R-sig-Geo] rgdal_1.1-1: dsn path string problems

Rainer Hurling rhurlin at gwdg.de
Sun Nov 8 17:42:04 CET 2015


Dear Roger, dear list,

many thanks for the newest update 1.1-1 of package rgdal. It is really
helpful.

I am using rgdal with R-devel and GDAL 2.0.1, both on FreeBSD
11.0-CURRENT and Windows7. On both platforms, I have problems with path
strings in dsn.



(a) The minor problem is on Windows. While a dsn="C:/some/path" works
fine, the same path with a slash at the end (dsn="C:/some/path/") fails.

On most other software it is conventional to allow a closing slash.
Wouldn't it be nice, if rgdal would be more tolerant about it?


Now my main problem:
(b) On FreeBSD, for some time now, the dsn path can not be used anymore
to check for existence of a file.

I want to use writeOGR to overwrite an existing shapefile. I use
something like dsn="/path/to/somewhere" and layer="layername".

Within writeOGR(), R/ogr_write.R calls the C++ function
'ogrCheckExists'. ogrCheckExists is not able to return TRUE, if a
shapefile already exists. Every time its result is FALSE:

R/ogr_write.R
61:        ogrI <- .Call("ogrCheckExists", as.character(dsn),
s.character(layer), PACKAGE = "rgdal")
[1] FALSE


As far, as I can see, 'ogrCheckExists' comes from src/ogrsource.cpp.
Something must go wrong in that C++ file, at least for FreeBSD :(

Unfortunalety, I have no skills how to debug such a C++ code within an R
package ...

Any help is really appreciated. Please tell me, if I could try and test
something. My box has FreeBSD, R-devel, gcc-4.8.5, gdb-7.1.0 ...

Greetings,
Rainer Hurling



More information about the R-sig-Geo mailing list