[R-sig-Geo] Properly closing GDAL datasets
Roger Bivand
Roger.Bivand at nhh.no
Sun Aug 10 19:18:19 CEST 2014
On Sat, 9 Aug 2014, Christopher Swingley wrote:
> Roger,
>
> On Sat, Aug 9, 2014 at 11:25 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>> You need to provide full information from sessionInfo() such as platform and
>> rgdal version, the messages displayed when rgdal is loaded, and how you
>> installed GDAL. The answer will depend on these, not least because recent
>> rgdal versions clean up better than earlier versions.
>
> Sorry about that. I figured it was something more general I was doing
> incorrectly. Based on your suggestion, I upgraded rgdal to the latest
> version (0.8-16), and I'm not seeing extra file descriptors, which
> makes me think that this has solved the problem.
>
> Does that mean my method of reading, overwriting and writing is an
> acceptable method for what I'm trying to do, which is write a new
> raster with all the same parameters but new data?
Well, if it works, that suggests that it is OK, but whether it is the most
efficient way of doing it is a different question.
>
> For reference, here's my old environment, where I had the problem.
>
>> sessionInfo()
> R version 3.0.2 (2013-09-25)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
>> library(rgdal)
> Loading required package: sp
> rgdal: version: 0.8-11, (SVN revision 479M)
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.7.3, released 2010/11/10
> Path to GDAL shared files: /usr/share/gdal/1.7
> GDAL does not use iconv for recoding strings.
> Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 470]
> Path to PROJ.4 shared files: (autodetected)
>
> The server has GDAL 1.11.0 and 1.9.1 installed in /usr/local, in
> addition to 1.7.3, which is the system-level Ubuntu package that is
> installed, and which appears to be what rgdal linked against. I might
> see some benefit to linking against a newer version, I expect.
>
It is typical of Debian/Ubuntu that multiple GDAL are installed because
some other binary packages depend on aged versions. You would do best to
remove all older than the most recent, to be sure that bug fixes are
applied, that drivers are up to date, and that metadata are the most
recent (for example the EPSG files used by GTiff). However, this may mean
that you have to re-install other software from source, which takes time.
Do look at the ordering of the GDAL versions on the LD library path, and
if possible adjust this so that 1.11.0 is both the one found when
installing rgdal and the one loaded when rgdal loads.
Roger
> Thanks,
>
> Chris
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list