[R-sig-Geo] rgdal error in pj_transform: failed to load datum shift file

Olivia Burge olivia.burge at gmail.com
Fri Jan 27 04:04:02 CET 2017


Dear all,

Fixed eventually after using a number of different install options, of
which only this one worked:

install.packages('rgdal', type = "source", configure.args=c(

'--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
    '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
    '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib',
'--with-data-copy=yes',
'--with-proj-data=/Library/Frameworks/PROJ.framework/unix/share/proj'))

The latter two made the difference.

Note in my .bash_profile I also added the gdal path:
export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH

Regards,

Olivia

On Fri, Jan 27, 2017 at 3:02 PM Olivia Burge <olivia.burge at gmail.com> wrote:

> Dear list,
>
> I am having some trouble transforming data (ie reprojecting) after
> installing rgdal, etc on a new mac.
>
> The error message is:
> > wgs84 <- CRS("+proj=longlat +datum=WGS84 +no_defs ")
> > df <- spTransform(locs_sp, CRS = wgs84)
> Error in spTransform(xSP, CRSobj, ...) :
>   error in pj_transform: failed to load datum shift file.
>
> locs_sp dput output:
>
> new("SpatialPointsDataFrame"
>     , data = structure(list(Plot = c(1L, 2L, 3L, 4L, 5L, 6L, 1L, 1L, 4L,
> 9L,
> 19L, 20L), Wetland = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 3L,
> 4L, 4L, 4L, 4L, 4L), .Label = c("", "Awarua", "Bayswater", "Dunearn"
> ), class = "factor")), .Names = c("Plot", "Wetland"), row.names = c(NA,
> 12L), class = "data.frame")
>     , coords.nrs = numeric(0)
>     , coords = structure(c(2159130, 2159243, 2159242, 2159240, 2159504,
> 2157624,
> 2126982, 2138135, 2138087, 2137919, 2137472, 2137450, 5397279,
> 5397304, 5397304, 5392166, 5397215, 5395541, 5439946, 5456416,
> 5456657, 5456657, 5456659, 5456662), .Dim = c(12L, 2L), .Dimnames = list(
>     c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
>     "12"), c("NZMGE", "NZMGN")))
>     , bbox = structure(c(2126982, 5392166, 2159504, 5456662), .Dim = c(2L,
> 2L), .Dimnames = list(c("NZMGE", "NZMGN"), c("min", "max")))
>     , proj4string = new("CRS"
>     , projargs = "+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000
> +y_0=6023150 +ellps=intl +units=m +nadgrids=nzgd2kgrid0005.gsb"
> )
> )
>
> I have a windows computer with rgdal & R on and it works fine on there.
>
> When I load rgdal, I get:
> > require(rgdal)
> Loading required package: rgdal
> Loading required package: sp
> rgdal: version: 1.2-5, (SVN revision 648)
>  Geospatial Data Abstraction Library extensions to R successfully loaded
>  Loaded GDAL runtime: GDAL 2.1.2, released 2016/10/24
>  Path to GDAL shared files:
>  Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
>  Path to PROJ.4 shared files: (autodetected)
>  Linking to sp version: 1.2-3
>
> I have seen reference to the output of this:
> > system.file("proj", package= "rgdal")
> elsewhere. The output is simply ""
>
> SessionInfo:
> R version 3.3.2 (2016-10-31)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: macOS Sierra 10.12.1
>
> locale:
> [1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] ggmap_2.7          ggplot2_2.2.1.9000 rgdal_1.2-5        sp_1.2-4
>
>
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.9       magrittr_1.5      maps_3.1.1        munsell_0.4.3
>   colorspace_1.3-2  geosphere_1.5-5
>  [7] lattice_0.20-34   R6_2.2.0          rjson_0.2.15      jpeg_0.1-8
>    dplyr_0.5.0       stringr_1.1.0
> [13] plyr_1.8.4        tools_3.3.2       grid_3.3.2        gtable_0.2.0
>    png_0.1-7         DBI_0.5-1
> [19] lazyeval_0.2.0    assertthat_0.1    tibble_1.2        mapproj_1.2-4
>   reshape2_1.4.2    bitops_1.0-6
> [25] stringi_1.1.2     RgoogleMaps_1.4.1 scales_0.4.1      proto_1.0.0
>
> Any help would be greatly appreciated. I will be out the office for a week
> on fieldwork in a couple of hours, after which I won't be able to test
> anything until I return.
>
> Kind regards,
>
> Olivia
>
>
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list