Suggestion: option overwrite=T for writeOGR()
On Mon, 13 Dec 2010, Agustin Lobo wrote:
---------- Forwarded message ---------- From: Agustin Lobo <alobolistas at gmail.com> Date: 2010/12/13 Subject: Re: [R-sig-Geo] Suggestion: option overwrite=T for writeOGR() To: Roger.Bivand at nhh.no Roger, According to Synaptic, my gdal is 1.7.3, I do not understand where the reported GDAL runtime: GDAL 1.8dev comes from. Could it have been installed by rgdal?
rgdal package binaries from CRAN for Windows are built static against GDAL, so include GDAL but not as a shared object. For OSX on CRAN extras, I'm not sure whether the binary rgdal package is built static or not, but GDAL is included. You are on Linux, so you provide GDAL yourself. If it declares on query (asking the shared object what version it is, which is what rgdal does on startup) that it is 1.8.0dev, then that is what it is. Be aware that downstream packagers may also mistake the version numbers, so asking the shared object is authoritative (unless the releasers of the original source enter the wrong string, as with the current PROJ.4, which declares that it is an as yet unreleased version, these things happen). Either revert properly to GDAL 1.7.*, or wait for me to fix this for 1.8.*, please. I'll post in this thread when I'm ready, and then you can check the rgdal source from R-Forge, OK? Roger
I've searched my disk and find gdal16 and gdal17 but not gdal18 Do you know if it is possible to tell rgdal which gdal should be used? Thanks Agus 2010/12/11 Roger Bivand <Roger.Bivand at nhh.no>:
On Fri, 10 Dec 2010, Agustin Lobo wrote:
Roger, I was not aware that 1.8dev is actually older than 1.7.2 I'll check why I have that gdal on the other machine and will try to fix that on my side on Monday. But perhaps this problem will come up again for future stable versions of 1.8.* ? Anyway, 1.8dev is clearly not a good choice and I have to change it.
As of GDAL 1.8.0 SVN revision 21234, the problem exists. I'll fix this in rgdal for the drivers I am familiar with before 1.8.0 is released. Roger
Thanks Agus 2010/12/10 Roger Bivand <Roger.Bivand at nhh.no>:
On Fri, 10 Dec 2010, Agustin Lobo wrote:
Roger, is this all you need? I thought sessionInfo was providing everything needed.
You had given sessionInfo() but that does not report which GDAL you are using. The report unfortunately does not give an svn revision, maybe gdal-config --version does? I develop using 1.7.* GDAL. Your 1.8dev is pretty old, certainly older that released 1.7.3. I can try to build a current GDAL trunk from source next week, if I get time, but this looks like something in your setup (development GDAL that is now stale?).
The driver is "ESRI Shapefile" as stated in the command, have not tested any other (it does work for raster though, as you mention):
I mentioned four variants of vector drivers, not raster. Roger
require(rgdal)
Loading required package: rgdal Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 1.8dev, released 2010/01/19 Path to GDAL shared files: /usr/local/share/gdal Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009 Path to PROJ.4 shared files: (autodetected) Thanks Agus 2010/12/10 Roger Bivand <Roger.Bivand at nhh.no>:
On Fri, 10 Dec 2010, Agustin Lobo wrote:
Roger, It does not for me. The error is solved by deleting files xygcatLO.* , while directory xygcatLO may continue to exist.
Agus, With which drivers, OGR version (in header when rgdal loads)? If I cannot reproduce this, I cannot readily help. Roger
Also, I've found that with this version the below command does not save the files within the folder indicated by dsn, but outside. This was not the case in the past, but do not know if this is because of a change in rgdal, gdal or ubuntu 10.04 (I've changed all 3 since the last time I used writeOGR()).
writeOGR(xygcatLO,dsn="xygcatLO",layer="xygcatLO", driver="ESRI Shapefile")
Error in writeOGR(xygcatLO, dsn = "xygcatLO", layer = "xygcatLO", driver = "ESRI Shapefile") : ? ? ? ?GDAL Error 1: Layer 'xygcatLO' already exists Calls: writeOGR -> .Call
sessionInfo()
R version 2.12.0 (2010-10-15) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.utf8 ? ? ? ? ?LC_NUMERIC=C [3] LC_TIME=en_US.utf8 ? ? ? ? ? LC_COLLATE=en_US.utf8 [5] LC_MONETARY=en_US.utf8 ? ? ? LC_MESSAGES=en_US.utf8 [7] LC_PAPER=en_US.utf8 ? ? ? ? ?LC_NAME=en_US.utf8 [9] LC_ADDRESS=en_US.utf8 ? ? ? ?LC_TELEPHONE=en_US.utf8 [11] LC_MEASUREMENT=en_US.utf8 ? ?LC_IDENTIFICATION=en_US.utf8 attached base packages: [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base other attached packages: [1] RANN_2.1.2 ? ? ?outliers_0.13-3 rgdal_0.6-30 ? ?raster_1.7-2 [5] sp_0.9-73 ? ? ? rkward_0.5.4 loaded via a namespace (and not attached): [1] grid_2.12.0 ? ? lattice_0.19-13 tools_2.12.0 2010/12/10 Roger Bivand <Roger.Bivand at nhh.no>:
On Thu, 9 Dec 2010, Barry Rowlingson wrote:
On Thu, Dec 9, 2010 at 8:56 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
Hi! Could an option overwrite=T (default overwrite=F) be included in writeOGR()? Thanks!
Submit a Feature Request here: http://sourceforge.net/tracker/?group_id=84716&atid=573625
No, rgdal is on R-Forge, and a list called rgdal-devel will be available from tomorrow.
It looks like it just needs to be a wrapper around OGR's delete layer function.
Contributions welcome. Note that the facility is present for rasters, which I fould out by accidentally deleting GRASS database objects (for which of course I did not have backups). Is this really needed - which drivers do not already overwrite without complaint? These do not complain for me: driver="ESRI Shapefile"; driver="KML"; driver="MapInfo File"; driver="MapInfo File", dataset_options="FORMAT=MIF". Hope this helps, Roger
Barry
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no