Error in CRS("EPSG:4326") : no arguments in initialization list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in CRS("EPSG:4326") : no arguments in initialization list

Tomislav Hengl-5
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Error in CRS("EPSG:4326") : no arguments in initialization list

Roger Bivand
Administrator
Tom,

Your package code itself runs lots of stuff in R/AAA.R that it doesn't
need to. Here you could simply put the output string of:

> rgdal::CRSargs(sp::CRS("EPSG:4326"))
[1] "+proj=longlat +datum=WGS84 +no_defs"

instead of going out to sp/rgdal/PROJ. In this case, sp and rgdal
shouldn't let you do this on a system running PROJ 5.2.0 (and I'll look at
that), but your work-around is the bare Proj4 string, which is the same in
any case. The error message is from PROJ, returned from rgdal to sp. If
you want to condition on PROJ version, you can do that, but instantiating
CRS is costly, and here lazy-loading is trying to save time by
pre-filling the value.

If this isn't enough, please let me know and I'll install the same PROJ
and GDAL versions as used for Solaris checks locally, and try to resolve
the problem in those packages. That will however take time. I'm assuming
that sp and rgdal are the current CRAN versions 1.4-5 and 1.5-23 on
Solaris, both of those pass on that platform.

Hope this helps,

Roger

On Wed, 28 Apr 2021, Tomislav Hengl wrote:

>
> Hi Roger et al,
>
> We are experiencing some problems with committing plotKML to CRAN. Automated
> check reports:
>
> "Error in CRS("EPSG:4326") : no arguments in initialization list"
>
> See:
>
> https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/plotKML-00install.html
> https://github.com/Envirometrix/plotKML/issues/5
>
> I assume it has to do with the proj / rgdal versions? Should I switch to
> using again CRS("+init=epsg:4326")? Seems that different operating systems
> now have different issues.
>
> On R-forge plotKML installs without problems:
>
> https://r-forge.r-project.org/R/?group_id=1106
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Roger Bivand
Emeritus Professor
Department of Economics, Norwegian School of Economics,
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: Error in CRS("EPSG:4326") : no arguments in initialization list

Tomislav Hengl-5
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Error in CRS("EPSG:4326") : no arguments in initialization list

Roger Bivand
Administrator
On Thu, 29 Apr 2021, Tomislav Hengl wrote:

>
> Thanks Roger. If I understand correctly, I should simply replace
> 'CRS("EPSG:4326")' with 'CRS("+proj=longlat +datum=WGS84 +no_defs")'.
> Otherwise the EPSG codes should work in R with any version correct?

No, just assign "+proj=longlat +datum=WGS84 +no_defs", no CRS(), no
CRSargs() at all, so preventing CRS() reaching out through rgdal to PROJ.
It probably shouldn't be canned anyway, but should rather be generated at
run time not install time (and CRSargs() should be deprecated as it
removes WKT2 representations). Note that +datum=WGS84 is very imprecise,
as it varies by epoch, and is from EPSG 10 a datum ensemble rather than a
datum.

EPSG codes given as CRS("EPSG:4326") work sp >= 1.4 and rgdal >= 1.5 with
PROJ >= 6 and GDAL >= 3. The puzzle here is how CRS() mistakes the setting
and tries to retrieve "EPSG:4326" from PROJ < 6.

Roger

>
>
> On 4/28/21 8:48 PM, Roger Bivand wrote:
>>  Tom,
>>
>>  Your package code itself runs lots of stuff in R/AAA.R that it doesn't
>>  need to. Here you could simply put the output string of:
>>
>>>  rgdal::CRSargs(sp::CRS("EPSG:4326"))
>>  [1] "+proj=longlat +datum=WGS84 +no_defs"
>>
>>  instead of going out to sp/rgdal/PROJ. In this case, sp and rgdal
>>  shouldn't let you do this on a system running PROJ 5.2.0 (and I'll look
>>  at that), but your work-around is the bare Proj4 string, which is the
>>  same in any case. The error message is from PROJ, returned from rgdal
>>  to sp. If you want to condition on PROJ version, you can do that, but
>>  instantiating CRS is costly, and here lazy-loading is trying to save
>>  time by pre-filling the value.
>>
>>  If this isn't enough, please let me know and I'll install the same PROJ
>>  and GDAL versions as used for Solaris checks locally, and try to
>>  resolve the problem in those packages. That will however take time. I'm
>>  assuming that sp and rgdal are the current CRAN versions 1.4-5 and
>>  1.5-23 on Solaris, both of those pass on that platform.
>>
>>  Hope this helps,
>>
>>  Roger
>>
>>  On Wed, 28 Apr 2021, Tomislav Hengl wrote:
>>
>>>
>>>  Hi Roger et al,
>>>
>>>  We are experiencing some problems with committing plotKML to CRAN.
>>>  Automated check reports:
>>>
>>>  "Error in CRS("EPSG:4326") : no arguments in initialization list"
>>>
>>>  See:
>>>
>>>  https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/plotKML-00install.html 
>>>
>>>  https://github.com/Envirometrix/plotKML/issues/5
>>>
>>>  I assume it has to do with the proj / rgdal versions? Should I switch
>>>  to using again CRS("+init=epsg:4326")? Seems that different operating
>>>  systems now have different issues.
>>>
>>>  On R-forge plotKML installs without problems:
>>>
>>>  https://r-forge.r-project.org/R/?group_id=1106
>>>
>>>  _______________________________________________
>>>  R-sig-Geo mailing list
>>>  [hidden email]
>>>  https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>

--
Roger Bivand
Emeritus Professor
Department of Economics, Norwegian School of Economics,
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: Error in CRS("EPSG:4326") : no arguments in initialization list

Tomislav Hengl-5
CONTENTS DELETED
The author has deleted this message.