[R-sig-Geo] problem with function project() in package rgdal

Renaud Lancelot renaud.lancelot at cirad.fr
Fri May 15 17:54:09 CEST 2009


Dear Paul,

Thank you for you reply. Everything works fine now with the current 
versions of R, rgdal and sp:

 > library(rgdal)
Le chargement a nécessité le package : sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.6.0, released 2008/12/04
Path to GDAL shared files: C:/R/RLIBS/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
Path to PROJ.4 shared files: C:/R/RLIBS/rgdal/proj
 > data(state)
 > res <- project(cbind(state.center$x, state.center$y), "+proj=lcc 
+lat_1=48 +lat_2=33 +lon_0=-100")
 > sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252

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

other attached packages:
[1] rgdal_0.6-8    sp_0.9-36      fortunes_1.3-6

loaded via a namespace (and not attached):
[1] grid_2.9.0      lattice_0.17-22 tools_2.9.0

I don't know what happened...

Best regards,

Renaud



Paul Hiemstra a écrit :
> Hi Renaud,
> 
> I don't get the same error, the piece of code runs fine. To which 
> version of proj did you build rgdal? My versions are:
> 
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.4.4.0, released 2007/11/23
> Path to GDAL shared files: /usr/share/gdal
> Loaded PROJ.4 runtime: Rel. 4.6.0, 21 Dec 2007
> Path to PROJ.4 shared files: (autodetected)
> 
> Googleing for "major axis or radius = 0 or not given" will give you some 
> useful things to start with.
> 
> As a remark, I always transform my spatial data to sp-classes (using 
> coordinates() or gridded(), see sp-docs) and then use spTransform to 
> perform the reprojection.
> 
> cheers,
> Paul
> 
> This is my sessionInfo():
> 
> R version 2.9.0 (2009-04-17)
> i486-pc-linux-gnu
> 
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C 
> 
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] rgdal_0.6-5 sp_0.9-29
> 
> loaded via a namespace (and not attached):
> [1] grid_2.9.0      lattice_0.17-20 tools_2.9.0
> 
> 
> Renaud Lancelot wrote:
>> Dear all,
>>
>> I meet a problem with the function project() in package rgdal:
>>
>>> library(rgdal)
>>> data(state)
>>> res <- project(cbind(state.center$x, state.center$y),
>> +                "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100")
>> Error in project(cbind(state.center$x, state.center$y), "+proj=lcc
>> +lat_1=48 +lat_2=33 +lon_0=-100") :
>>   major axis or radius = 0 or not given
>>
>>
>>> sessionInfo()
>> R version 2.8.1 Patched (2009-02-17 r47956)
>> i386-pc-mingw32
>>
>> locale:
>> LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252 
>>
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods
>> [7] base
>>
>> other attached packages:
>> [1] rgdal_0.6-7    sp_0.9-34      fortunes_1.3-6
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.8.1      lattice_0.17-20 tools_2.8.1
>>>
>>
>> Is this a bug?
>>
> 
> 

-- 
Renaud Lancelot
EDEN Project, coordinator
http://www.eden-fp6project.net/

UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
Joint research unit "Control of emerging and exotic animal diseases"

CIRAD
Campus International de Baillarguet TA A-DIR / B
F34398 Montpellier
http://www.cirad.fr  http://bluetongue.cirad.fr/

Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 95
Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69



More information about the R-sig-Geo mailing list