Skip to content

Problem with rgdal

3 messages · Michael Sumner, Agustin Lobo

#
I get this weird behaviour (on linuxmint based of ubuntu raring):
Error in spTransform(rlm1ext, CRS("+init=epsg:4326")) :
  load package rgdal for spTransform methods

despite rgdal had been loaded:
Loading required package: rgdal
rgdal: version: 0.8-16, (SVN revision 498)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.0, released 2013/04/24
Path to GDAL shared files: /usr/share/gdal/1.10
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: (autodetected)

Any suggestion on what is going wrong?
Agus
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
LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8
LC_PAPER=es_ES.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgeos_0.3-2     ggmap_2.3       ggplot2_0.9.3.1 rgdal_0.8-16
raster_2.2-31   sp_1.0-14

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4    dichromat_2.0-0     digest_0.6.4
grid_3.0.2          gtable_0.1.2
 [6] labeling_0.2        lattice_0.20-24     mapproj_1.2-1
maps_2.3-6          MASS_7.3-29
[11] munsell_0.4.2       plyr_1.8            png_0.1-7
proto_0.3-10        RColorBrewer_1.0-5
[16] reshape2_1.2.2      RgoogleMaps_1.2.0.5 rjson_0.2.13
RJSONIO_1.0-3       scales_0.2.3
[21] stringr_0.6.2       tools_3.0.2
#
I suspect that your rlm1ext is not spTransform-able.

library(rgdal)
spTransform(1, CRS("+init=epsg:4326"))
Error in spTransform(1, CRS("+init=epsg:4326")) :
  load package rgdal for spTransform methods

It might be hard to test that there couldn't ever be a method for
spTransform for some given input, but this does seem a little too
open-ended.

Cheers, Mike.
On Wed, Mar 26, 2014 at 9:56 PM, Agustin Lobo <alobolistas at gmail.com> wrote:

  
    
#
right, I had a typo in the previous line of the code:
rlm1ext <- as(extent(rlm1), 'SpatialPolygons')
projection(rlm1ext <- projection(rlm1))

instead of
projection(rlm1ext) <- projection(rlm1)

The problem is that I remembered having that error message
"load package rgdal for spTransform methods"
with gdal-related installation problems and got into a totally wrong direction,

Thanks!

Agus
On Wed, Mar 26, 2014 at 12:06 PM, Michael Sumner <mdsumner at gmail.com> wrote: