[R-sig-Geo] spTransform error
Roger Bivand
Roger.Bivand at nhh.no
Thu May 23 11:12:01 CEST 2013
On Thu, 23 May 2013, Ross Ahmed wrote:
> Just an update from me. I've tried following the installation guidelines
> here, but following this, spTrasform is still giving the same error:
> https://sites.google.com/site/eospansite/rspatial_gis/rgdalmac
As Agus notes at the head of the page (he wrote it some years ago), it
isn't needed (and the NOTE 20110011 is also out of date and does not
work).
>
> In addition, I've posted on r-sig-mac for help on how to solve the
> problem, but have not had a response as yet:
> https://stat.ethz.ch/pipermail/r-sig-mac/2013-May/010115.html
Thanks - next time only post plain text, as the contents of your posting
are only linked to the archive, rather than being visible. Simon Urbanek
replied to a posting on R-sig-Mac yesterday, but I'm sure he has plenty to
do, and will get to this when he can.
As an emergency work-around for the brave, I've bundled the two missing
directories with contents from my Linux machine as:
http://spatial.nhh.no/misc/rgdal-proj-gdal.tar.gz
which someone could unpack within the installed rgdal/ package directory.
The owner and permissions of the files in the archive may need attention.
If someone tries this, please report back in-thread.
Roger
>
> Ross
>
> On 22 May 2013, at 20:34, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>
>> On Wed, 22 May 2013, Agustin Lobo wrote:
>>
>>> Just got the very same problem on osx:
>>> CRS("+init=epsg:3857")
>>> Error in CRS("+init=epsg:3857") : no system list, errno: 2
>>
>> I have given the diagnosis in detail - the OSX CRAN rgdal binary has been built without the required configure argument --with-data-copy=yes. I am awaiting a response from the OSX maintainer (of all of R, not just rgdal). When he gets back to me, we'll know more about when the binary package can be rebuilt. While waiting, consider other OS, or consider installing William Kyngesburye's framework-based rgdal 0.8-8 for R 3.0 with GDAL 1.10 (64-bit only).
>>
>> Roger
>>
>>>
>>> I've reinstalled rgdal (using RStudio) but the error persists.
>>> I also have the autodetected in the path:
>>>> require(rgdal)
>>> Loading required package: rgdal
>>> Loading required package: sp
>>> rgdal: version: 0.8-9, (SVN revision 470)
>>> Geospatial Data Abstraction Library extensions to R successfully loaded
>>> Loaded GDAL runtime: GDAL 1.9.2, released 2012/10/08
>>> Path to GDAL shared files:
>>> Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
>>> Path to PROJ.4 shared files: (autodetected)
>>>
>>> Is there anything I can do or should I wait for a newer version of
>>> rgdal to be on cran?
>>> Not a big problem if have to wait, can use a linux machine.
>>>
>>> Thanks
>>>
>>> Agus
>>>
>>>> sessionInfo()
>>> R version 3.0.0 (2013-04-03)
>>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>>
>>> locale:
>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>
>>> attached base packages:
>>> [1] stats graphics grDevices utils datasets methods base
>>>
>>> other attached packages:
>>> [1] raster_2.1-16 rgdal_0.8-9 sp_1.0-9
>>>
>>> loaded via a namespace (and not attached):
>>> [1] grid_3.0.0 lattice_0.20-15 tools_3.0.0
>>>
>>> On Wed, May 15, 2013 at 10:23 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>>>> On Wed, 15 May 2013, Ross Ahmed wrote:
>>>>
>>>>> I¹ve recently reinstalled QGIS - might this have anything to do with it?
>>>>
>>>>
>>>> Probably not.
>>>>
>>>>
>>>>>
>>>>>
>>>>> # spTransform() works fine in the other example I posted to the group
>>>>> yesterday:
>>>>>
>>>>> library(sp); library(rgeos); library(rgdal)
>>>>> polygonCoords <- matrix(c(-1.9450, -1.9075, -1.9075, -1.9450, -1.9450,
>>>>> 55.72476, 55.72476, 55.70267, 55.70267, 55.72476), ncol=2)
>>>>> p = Polygon(polygonCoords)
>>>>> myPolygon = Polygons(list(p),1)
>>>>> myPolygonSpatial = SpatialPolygons(list(myPolygon))
>>>>> proj4string(myPolygonSpatial) <- CRS("+proj=longlat +datum=WGS84
>>>>> +ellps=WGS84 +towgs84=0,0,0")
>>>>> gArea(spTransform(myPolygonSpatial, CRS("+proj=laea +lon_0=-1.92
>>>>> +lat_0=55.7 +datum=WGS84")))/1e6
>>>>> #[1] 5.796854
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> # But spTransform() fails in all other instances, for example:
>>>>>
>>>>> Library(maptools)
>>>>> data(wrld_simpl)
>>>>> spTransform(wrld_simpl[1,], CRS("+init=epsg:4326"))
>>>>> # Error in spTransform(wrld_simpl[1, ], CRS("+init=epsg:4326")) :
>>>>> # error in evaluating the argument 'CRSobj' in selecting a method for
>>>>> function 'spTransform': Error in CRS("+init=epsg:4326") : no system list,
>>>>> errno: 2
>>>>
>>>> The failure is caused by no proj (or gdal) data files being available.
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> # rgdal() start up message
>>>>>
>>>>> library(rgdal)
>>>>> Loading required package: sp
>>>>> rgdal: version: 0.8-9, (SVN revision 470)
>>>>> Geospatial Data Abstraction Library extensions to R successfully loaded
>>>>> Loaded GDAL runtime: GDAL 1.9.2, released 2012/10/08
>>>>> Path to GDAL shared files:
>>>>> Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
>>>>> Path to PROJ.4 shared files: (autodetected)
>>>>
>>>> These are the clues:
>>>>
>>>>
>>>> Path to GDAL shared files:
>>>> Path to PROJ.4 shared files: (autodetected)
>>>>
>>>> which should not look like this if you are on:
>>>>
>>>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>>>
>>>> and installed rgdal as an OSX binary from CRAN. The current OSX binary is
>>>> packaged without the proj/ and gdal/ subdirectories. I'll try to get them
>>>> reinstated.
>>>>
>>>> Roger
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> # sessionInfo() output
>>>>>
>>>>> sessionInfo()
>>>>>
>>>>> R version 3.0.0 (2013-04-03)
>>>>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>>>>
>>>>> locale:
>>>>> [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
>>>>>
>>>>> attached base packages:
>>>>> [1] tcltk stats4 splines grid stats graphics grDevices utils datasets
>>>>> methods
>>>>> [11] base
>>>>>
>>>>> other attached packages:
>>>>> [1] Hmisc_3.10-1.1 adehabitat_1.8.12 shapefiles_0.7 tkrplot_0.0-23
>>>>> [5] ggmap_2.3 formatR_0.7 lme4_0.999999-2 Matrix_1.0-12
>>>>> [9] adehabitatHR_0.4.7 adehabitatLT_0.3.11 CircStats_0.2-4 MASS_7.3-26
>>>>> [13] adehabitatMA_0.3.6 ade4_1.5-2 spatialsegregation_2.38 dismo_0.8-11
>>>>> [17] raster_2.1-25 geosphere_1.2-28 knitr_1.2 lubridate_1.3.0
>>>>> [21] stringr_0.6.2 boot_1.3-9 coin_1.0-22 modeltools_0.2-19
>>>>> [25] mvtnorm_0.9-9994 survival_2.37-4 gmodels_2.15.4 ggplot2_0.9.3.1
>>>>> [29] spatstat_1.31-2 deldir_0.0-22 mgcv_1.7-22 bibtex_0.3-5
>>>>> [33] plyr_1.8 reshape2_1.2.2 ProjectTemplate_0.4-2 testthat_0.7.1
>>>>> [37] maptools_0.8-23 lattice_0.20-15 foreign_0.8-53 rgdal_0.8-9
>>>>> [41] rgeos_0.2-17 sp_1.0-9
>>>>>
>>>>> loaded via a namespace (and not attached):
>>>>> [1] cluster_1.14.4 colorspace_1.2-2 dichromat_2.0-0 digest_0.6.3
>>>>> evaluate_0.4.3
>>>>> [6] gdata_2.12.0.2 gtable_0.1.2 gtools_2.7.1 labeling_0.1 mapproj_1.2-1
>>>>> [11] maps_2.3-2 munsell_0.4 nlme_3.1-109 png_0.1-4 proto_0.3-10
>>>>> [16] RColorBrewer_1.0-5 RgoogleMaps_1.2.0.3 rjson_0.2.12 scales_0.2.3
>>>>> tools_3.0.0
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 14/05/2013 22:33, "Roger Bivand" <Roger.Bivand at nhh.no> wrote:
>>>>>
>>>>>> On Tue, 14 May 2013, Ross Ahmed wrote:
>>>>>>
>>>>>>> I get the following error when running SpTransform, and error is
>>>>>>> occurring
>>>>>>> not matter what object I try to transform:
>>>>>>>
>>>>>>> Error in spTransform(columbus, CRS("+init=epsg:27700 +datum=WGS84")) :
>>>>>>> error in evaluating the argument 'CRSobj' in selecting a method for
>>>>>>> function 'spTransform': Error in CRS("+init=epsg:27700 +datum=WGS84") :
>>>>>>> no
>>>>>>> system list, errno: 2
>>>>>>
>>>>>> You must include all of the important information: all of sessionInfo()
>>>>>> output, all of the startup messages given by rgdal on loading, and a
>>>>>> reasonable example (this one isn't, the actual projection is unknown). I
>>>>>> think you have installed rgdal from source on a system without the
>>>>>> necessary extra files, but without knowledge of how you installed rgdal,
>>>>>> it is not possible to tell.
>>>>>>
>>>>>> Roger
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I?ve tried to replicate my code using the columbus
>>>>>>> SpatialPolygonsDataFrame
>>>>>>> from maptools package:
>>>>>>>
>>>>>>> setwd(system.file("shapes", package="maptools"))
>>>>>>> columbus <- readShapeSpatial(?columbus.shp?)
>>>>>>> proj4string(columbus) <- CRS("+proj=longlat +datum=WGS84 +ellps=WGS84
>>>>>>> +towgs84=0,0,0")
>>>>>>> spTransform(columbus, CRS("+init=epsg:4326?))
>>>>>>>
>>>>>>> Error in spTransform(columbus, CRS("+init=epsg:27700 +datum=WGS84")) :
>>>>>>> error in evaluating the argument 'CRSobj' in selecting a method for
>>>>>>> function 'spTransform': Error in CRS("+init=epsg:27700 +datum=WGS84") :
>>>>>>> no
>>>>>>> system list, errno: 2
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I?m using R 3.0.0
>>>>>>>
>>>>>>> Ross
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> [[alternative HTML version deleted]]
>>>>>>
>>>>>> --
>>>>>> Roger Bivand
>>>>>> Department of Economics, NHH Norwegian School of Economics,
>>>>>> 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
>>>>
>>>> --
>>>> Roger Bivand
>>>> Department of Economics, NHH Norwegian School of Economics,
>>>> 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
>> Department of Economics, NHH Norwegian School of Economics,
>> 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
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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
More information about the R-sig-Geo
mailing list