[R-sig-Geo] error projecting with rgdal::project()
Roger Bivand
Roger.Bivand at nhh.no
Tue Jun 9 05:51:54 CEST 2015
On Mon, 8 Jun 2015, MacQueen, Don wrote:
> If it helps (and since I could do it quickly and easily), I have success
> with
> R 3.2.0
> gdal 1.11.2
> rgdal 0.9-3
> sp_1.1-0
> proj.4 4.9.1
> (on a Mac; see below)
>
> If I read your email correctly, that is a combination you haven't tried
> (you have rgdal 0.9-2 with R 3.2.0).
>
>
>> require(rgdal)
> Loading required package: rgdal
> Loading required package: sp
> rgdal: version: 0.9-3, (SVN revision 530)
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
> Path to GDAL shared files:
> /Users/macqueen1/Library/R/3.2/library/rgdal/gdal
> Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
> Path to PROJ.4 shared files:
> /Users/macqueen1/Library/R/3.2/library/rgdal/proj
> Linking to sp version: 1.1-0
>>
>>
>> tst <- cbind(c(-75.13574,-75.02346, -74.98747, -74.87270, -74.86581),
> + c(38.89733, 38.74623, 38.56410, 38.56395, 38.45108))
>>
>> xy <- project(tst, "+proj=tpeqd +lon_1=-80 +lat_1=33 +lon_2=-75
>> +lat_2=39")
>>
>>
>> sessionInfo()
> R version 3.2.0 (2015-04-16)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.9.5 (Mavericks)
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] rgdal_0.9-3 sp_1.1-0
>
> loaded via a namespace (and not attached):
> [1] grid_3.2.0 lattice_0.20-31
>>
>
>
>
> I don't know what "autodetected" in the path to proj.4 means, but that's
> another difference between mine and yours.
>
The interpretation of the messages is (using my rgdal - Fedora 21, PROJ.4
and GDAL installed from source):
> library(rgdal)
Loading required package: sp
* rgdal depends on sp, so attaches it if not already attached.
rgdal: version: 1.0-2, (SVN revision 532)
* the version of rgdal, together with the source code repository revision
number. In released versions of rgdal, the version and revision number
are in lockstep, in development versions not.
Geospatial Data Abstraction Library extensions to R successfully loaded
* confirmation message.
Loaded GDAL runtime: GDAL 2.0.0, released 2015/06/05
* version of GDAL runtime linked (dynamic for most source installs of
rgdal - so the GDAL found on the platform, static for CRAN Windows and
OSX binary packages, so included in the binary package)
>> * If you see: "but rgdal build and GDAL runtime not in sync: ...
consider re-installing rgdal!!", pay attention, as the version of
GDAL on your system is not the one used to compile code in the rgdal
package. Often the API does not change, but the ABI is more fragile,
and may need attention <<
Path to GDAL shared files: /usr/local/share/gdal
* value returned by getGDAL_DATA_Path() - where the GDAL metadata files
live. This is needed and if not present (a future version of rgdal will
issue a warning if not found), GDAL was not completely installed, and
gdal-config --datadir (or an environment variable) needs attention.
>> * some systems may warn: "GDAL does not use iconv for recoding strings"
>> at this point - this refers to the possibility to change the encoding
>> of data and field names read from shapefiles <<
Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
* same for PROJ.4 runtime version - version of linked runtime.
Path to PROJ.4 shared files: (autodetected)
* Either the location of PROJ.4 metadata files, for example for CRAN
Windows and OSX binaries which ship with these files. In rgdal 0.9-3, an
error in the PROJ.4 4.9.1 release is fixed. The PROJ.4 metadata file
proj/proj_def.dat was forgotten in that release, and unfortunately rgdal
used the presence of that file in the metadata folder to test whether to
set the PROJ_LIB environment variable to the rgdal package location or
not. The test is now on proj/nad.lst. A symptom of proj/proj_def.dat not
being found or present is the major axis/radius error essage from the
PROJ.4 runtime. All projection definitions should have at least one tag
defining the size of the ellipsoid, but if omitted and
proj/proj_def.dat, the default +ellps=WGS84 is added. If you see the
error in rgdal < 0.9-3, your installation of PROJ.4 (either platform or
in the CRAN OSX Mavericks binary for a few days in May 2015) is
incomplete. The best remedy is to update rgdal to >= 0.9-3 or put a copy
of the missing file in the appropriate place (in rgdal/proj/ for CRAN
OSX or Windows binaries [1].
Linking to sp version: 1.1-0
* shows the version of sp compiled code linked to rgdal compiled code.
The code used to produce the messages is in:
https://r-forge.r-project.org/scm/viewvc.php/pkg/R/AAA.R?view=markup&revision=530&root=rgdal
Hope this clarifies,
Roger
[1] https://svn.osgeo.org/metacrs/sr.org/epsg/proj/proj_def.dat
>
--
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