[Proj] problem in trunk/4.9.0 in R/rgdal

Roger Bivand Roger.Bivand at nhh.no
Thu Feb 6 15:39:02 PST 2014


Frank,

Thanks, I should have thought of trying a command line program to isolate 
the issue.

Best wishes,

Roger

On Fri, 7 Feb 2014, Frank Warmerdam wrote:

> Roger,
>
> I have reproduced a seemingly related problem with the cs2cs commandline
> program and filed a ticket:
>
>  http://trac.osgeo.org/proj/ticket/229
>
> I'll work on the problem this afternoon.
>
> Best regards,
> Frank
>
>
>
> On Thu, Feb 6, 2014 at 3:11 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>
>> On Thu, 6 Feb 2014, Roger Bivand wrote:
>>
>>> We see a problem in 4.9.0 that is not in 4.8.0 in R. The code provoking
>> the
>>> problem in rgdal 0.8-15 built against 4.9.0 (trunk):
>>>
>>> http://cran.r-project.org/src/contrib/rgdal_0.8-15.tar.gz
>>
>> A simpler example is:
>>
>> minimal install is install.packages(c("sp", "rgdal"))
>>
>> library(rgdal)
>> checkCRSArgs("+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84
>> +no_defs +towgs84=0,0,0")
>>
>> failing with:
>>
>>> library(rgdal)
>> Loading required package: sp
>> rgdal: version: 0.8-15, (SVN revision 496M)
>> Geospatial Data Abstraction Library extensions to R successfully loaded
>> Loaded GDAL runtime: GDAL 1.11dev, released 2013/04/13
>> Path to GDAL shared files: /usr/local/share/gdal
>> Loaded PROJ.4 runtime: Rel. 4.9.0, 27 October 2013, [PJ_VERSION: 490]
>> Path to PROJ.4 shared files: (autodetected)
>>> checkCRSArgs("+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84
>> +no_defs +towgs84=0,0,0")
>> [[1]]
>> [1] FALSE
>>
>> [[2]]
>> [1] "no options found in 'init' file"
>>
>> Roger
>>
>>>
>>> minimal install is install.packages(c("sp", "spacetime", "rgdal"))
>>>
>>> library(sp)
>>> library(spacetime)
>>> data(air)
>>> library(rgdal)
>>> checkCRSArgs(proj4string(rural at sp))
>>>
>>> which shows:
>>>
>>>> checkCRSArgs(proj4string(rural at sp))
>>> [[1]]
>>> [1] FALSE
>>>
>>> [[2]]
>>> [1] "no options found in 'init' file"
>>>
>>> first time round. The object rural is read in from a saved R object, and
>> has
>>> a stored projection of:
>>>
>>> "+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
>>> +towgs84=0,0,0"
>>>
>>> So when this string goes via checkCRSArgs() to C code (same function
>> name)
>>> calling:
>>>
>>>
>>> if (!(pj = pj_init_plus(CHAR(STRING_ELT(args, 0))))) {
>>>       SET_STRING_ELT(VECTOR_ELT(res, 1), 0,
>>>        COPY_TO_USER_STRING(pj_strerrno(*pj_get_errno_ref())));
>>>       UNPROTECT(1);
>>>       return(res);
>>> }
>>>
>>> where res is a list with first element FALSE by default, second contains
>> an
>>> error message on failure (or what pj_get_def() returns on success. This
>>> around line 292 in:
>>>
>>>
>> https://r-forge.r-project.org/scm/viewvc.php/pkg/src/projectit.cpp?view=markup&root=rgdal
>>>
>>> However, if we then do:
>>>
>>> checkCRSArgs("+init=epsg:4326")
>>>
>>> we tickle something in pj_init_plus() and it works, and subsequently:
>>>
>>> checkCRSArgs(proj4string(rural at sp))
>>>
>>> works. I cannot see any changes in pj_init.c in the section looking for
>> +init
>>> between 4.8.0 and 4.9.0 that might affect this. Under rgdal 0.8-15 and
>> 4.8.0,
>>> there is no trouble, but the issue arises predictably with the same rgdal
>>> 0.8-15 and current 4.9.0 trunk.
>>>
>>> I'd be grateful for any advice.
>>>
>>> Best wishes,
>>>
>>> Roger
>>>
>>>
>>
>> --
>> 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 95 43
>> e-mail: Roger.Bivand at nhh.no
>>
>> _______________________________________________
>> Proj mailing list
>> Proj at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/proj
>>
>
>
>
>

-- 
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 95 43
e-mail: Roger.Bivand at nhh.no




More information about the Proj mailing list