Re: [R-SIG-Mac] rgdal problem with wintri projection (OSX, R-3.3.0, rgdal 1.1-9)

2016-05-11 Thread Roger Bivand

On Wed, 11 May 2016, Roger Bivand wrote:


On Wed, 11 May 2016, Simon Urbanek wrote:


 Thanks, that was the correct hint - updating PROJ4 to 4.9.1 seems to fix
 the issue. The new binary is now up - until all mirrors sync up please use
 the main Mac server:
 install.packages("rgdal",,"http://r.research.att.com;)

 Roger, can you, please, add a corresponding regression test to rgdal so a
 failure like the one below would be picked up on check?


Yes, of course, and thank you for resolving this so fast. The next release 
will also have extra protection contributed by Barry Rowlingson (still 
testing).


rgdal_1.1-10 submitted to CRAN with additional tests which reproduce the 
issue (as far as I can tell without being able to check directly), and 
with a fix by Barry Rowlingson for another problem identified while trying 
to add the tests. In addition, project() now has an added argument 
legacy=, which if TRUE will use PROJ.4 pj_fwd() and pj_inv(), or if FALSE 
will use pj_transform() (on Windows 32-bit it will always use 
pj_transform()).


The sources are committed to R-Forge.

Anyone able to test this version is very welcome to try it out.

Roger



Roger



 Thanks,
 Simon


 On May 11, 2016, at 7:25 AM, Daniel Kelley  wrote:

>  I apologize for not providing sufficient information in my original 
>  posting.  Below I am putting, in markdown notation, the test results 
>  with two setups.  I think the key thing is that R 3.3.0 is linking with 
>  an old version of proj (4.8.0) whereas R 3.2.1 was linking with a new 
>  version (4.9.1).
> 
> 
>  # Test 1 with R 3.2.1 (works)
> 
> R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"

> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.

> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>   Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.

> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or

> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
> >  sessionInfo()

> R version 3.2.1 (2015-06-18)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
> Running under: OS X 10.11.5 (unknown)
> 
> locale:

> [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> 
> attached base packages:

> [1] stats graphics  grDevices utils datasets  methods   base
> >  library(rgdal)
> Loading required package: sp
> rgdal: version: 0.9-3, (SVN revision 530)
>  Geospatial Data Abstraction Library extensions to R successfully 
>  loaded

>  Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
>  Path to GDAL shared files: 
>  /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/gdal

>  Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
>  Path to PROJ.4 shared files: 
>  /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/proj

>  Linking to sp version: 1.1-0
> >  lon <- 0
> >  lat <- 0
> >  proj <- "+proj=wintri"
> >  xy <- rgdal::project(cbind(lon, lat), proj=proj)
> >  print(xy)
>  [,1] [,2]
> [1,]00
> >  rgdal::project(xy, proj=proj, inv=TRUE)
>  [,1] [,2]
> [1,]00
> > 
> > 
> 
> 
> 
> 
>  # Test 2 with R 3.3.0 (seg-faults)
> 
> 
> R version 3.3.0 (2016-05-03) -- "Supposedly Educational"

> Copyright (C) 2016 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.

> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>   Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.

> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or

> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
> >  sessionInfo()

> R version 3.3.0 (2016-05-03)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.11.5 (El Capitan)
> 
> locale:

> [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> 
> attached base packages:

> [1] stats graphics  grDevices utils datasets  methods   base
> >  library(rgdal)
> Loading required package: sp
> rgdal: version: 1.1-9, (SVN revision 617M)
>  Geospatial Data Abstraction Library extensions to 

Re: [R-SIG-Mac] rgdal problem with wintri projection (OSX, R-3.3.0, rgdal 1.1-9)

2016-05-11 Thread Roger Bivand

On Wed, 11 May 2016, Simon Urbanek wrote:

Thanks, that was the correct hint - updating PROJ4 to 4.9.1 seems to fix 
the issue. The new binary is now up - until all mirrors sync up please 
use the main Mac server:

install.packages("rgdal",,"http://r.research.att.com;)

Roger, can you, please, add a corresponding regression test to rgdal so 
a failure like the one below would be picked up on check?


Yes, of course, and thank you for resolving this so fast. The next release 
will also have extra protection contributed by Barry Rowlingson (still 
testing).


Roger



Thanks,
Simon


On May 11, 2016, at 7:25 AM, Daniel Kelley  wrote:


I apologize for not providing sufficient information in my original posting.  
Below I am putting, in markdown notation, the test results with two setups.  I 
think the key thing is that R 3.3.0 is linking with an old version of proj 
(4.8.0) whereas R 3.2.1 was linking with a new version (4.9.1).


# Test 1 with R 3.2.1 (works)

   R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
   Copyright (C) 2015 The R Foundation for Statistical Computing
   Platform: x86_64-apple-darwin10.8.0 (64-bit)

   R is free software and comes with ABSOLUTELY NO WARRANTY.
   You are welcome to redistribute it under certain conditions.
   Type 'license()' or 'licence()' for distribution details.

 Natural language support but running in an English locale

   R is a collaborative project with many contributors.
   Type 'contributors()' for more information and
   'citation()' on how to cite R or R packages in publications.

   Type 'demo()' for some demos, 'help()' for on-line help, or
   'help.start()' for an HTML browser interface to help.
   Type 'q()' to quit R.


sessionInfo()

   R version 3.2.1 (2015-06-18)
   Platform: x86_64-apple-darwin10.8.0 (64-bit)
   Running under: OS X 10.11.5 (unknown)

   locale:
   [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

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

library(rgdal)

   Loading required package: sp
   rgdal: version: 0.9-3, (SVN revision 530)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
Path to GDAL shared files: 
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
Path to PROJ.4 shared files: 
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/proj
Linking to sp version: 1.1-0

lon <- 0
lat <- 0
proj <- "+proj=wintri"
xy <- rgdal::project(cbind(lon, lat), proj=proj)
print(xy)

[,1] [,2]
   [1,]00

rgdal::project(xy, proj=proj, inv=TRUE)

[,1] [,2]
   [1,]00








# Test 2 with R 3.3.0 (seg-faults)


   R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
   Copyright (C) 2016 The R Foundation for Statistical Computing
   Platform: x86_64-apple-darwin13.4.0 (64-bit)

   R is free software and comes with ABSOLUTELY NO WARRANTY.
   You are welcome to redistribute it under certain conditions.
   Type 'license()' or 'licence()' for distribution details.

 Natural language support but running in an English locale

   R is a collaborative project with many contributors.
   Type 'contributors()' for more information and
   'citation()' on how to cite R or R packages in publications.

   Type 'demo()' for some demos, 'help()' for on-line help, or
   'help.start()' for an HTML browser interface to help.
   Type 'q()' to quit R.


sessionInfo()

   R version 3.3.0 (2016-05-03)
   Platform: x86_64-apple-darwin13.4.0 (64-bit)
   Running under: OS X 10.11.5 (El Capitan)

   locale:
   [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

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

library(rgdal)

   Loading required package: sp
   rgdal: version: 1.1-9, (SVN revision 617M)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.4, released 2016/01/25
Path to GDAL shared files: 
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: 
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/proj
Linking to sp version: 1.2-3

lon <- 0
lat <- 0
proj <- "+proj=wintri"
xy <- rgdal::project(cbind(lon, lat), proj=proj)
print(xy)

lon lat
   [1,]   0   0

rgdal::project(xy, proj=proj, inv=TRUE)


*** caught segfault ***
   address 0x0, cause 'memory not mapped'

   Traceback:
1: .Call("project_inv", as.integer(nc), as.double(xy[, 1]), as.double(xy[, 2]), 
proj, as.logical(use_ob_tran), PACKAGE = "rgdal")
2: rgdal::project(xy, proj = proj, inv = TRUE)
   An irrecoverable exception occurred. R is aborting now ...


Re: [R-SIG-Mac] rgdal problem with wintri projection (OSX, R-3.3.0, rgdal 1.1-9)

2016-05-11 Thread Daniel Kelley
This is fantastic — thanks, Simon and Roger! Users of the ‘oce’ package (which 
uses rgdal for map-projection calculations) will be very grateful.

Dan.

Dan E. Kelley, Professor  and Graduate Coordinator
Oceanography Department, Dalhousie University
PO BOX 15000
Halifax, NS B3H 4R2
phone:(902)494-1694 fax:(…)-3877 dan.kel...@dal.ca  
http://oceanography.dal.ca/person/Kelley_Dan.html



___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Re: [R-SIG-Mac] rgdal problem with wintri projection (OSX, R-3.3.0, rgdal 1.1-9)

2016-05-11 Thread Simon Urbanek
Thanks, that was the correct hint - updating PROJ4 to 4.9.1 seems to fix the 
issue. The new binary is now up - until all mirrors sync up please use the main 
Mac server:
install.packages("rgdal",,"http://r.research.att.com;)

Roger, can you, please, add a corresponding regression test to rgdal so a 
failure like the one below would be picked up on check?

Thanks,
Simon


On May 11, 2016, at 7:25 AM, Daniel Kelley  wrote:

> I apologize for not providing sufficient information in my original posting.  
> Below I am putting, in markdown notation, the test results with two setups.  
> I think the key thing is that R 3.3.0 is linking with an old version of proj 
> (4.8.0) whereas R 3.2.1 was linking with a new version (4.9.1).
> 
> 
> # Test 1 with R 3.2.1 (works)
> 
>R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
>Copyright (C) 2015 The R Foundation for Statistical Computing
>Platform: x86_64-apple-darwin10.8.0 (64-bit)
> 
>R is free software and comes with ABSOLUTELY NO WARRANTY.
>You are welcome to redistribute it under certain conditions.
>Type 'license()' or 'licence()' for distribution details.
> 
>  Natural language support but running in an English locale
> 
>R is a collaborative project with many contributors.
>Type 'contributors()' for more information and
>'citation()' on how to cite R or R packages in publications.
> 
>Type 'demo()' for some demos, 'help()' for on-line help, or
>'help.start()' for an HTML browser interface to help.
>Type 'q()' to quit R.
> 
>> sessionInfo()
>R version 3.2.1 (2015-06-18)
>Platform: x86_64-apple-darwin10.8.0 (64-bit)
>Running under: OS X 10.11.5 (unknown)
> 
>locale:
>[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> 
>attached base packages:
>[1] stats graphics  grDevices utils datasets  methods   base 
>> library(rgdal)
>Loading required package: sp
>rgdal: version: 0.9-3, (SVN revision 530)
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
> Path to GDAL shared files: 
> /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/gdal
> Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
> Path to PROJ.4 shared files: 
> /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal/proj
> Linking to sp version: 1.1-0 
>> lon <- 0
>> lat <- 0
>> proj <- "+proj=wintri"
>> xy <- rgdal::project(cbind(lon, lat), proj=proj)
>> print(xy)
> [,1] [,2]
>[1,]00
>> rgdal::project(xy, proj=proj, inv=TRUE)
> [,1] [,2]
>[1,]00
>> 
>> 
> 
> 
> 
> 
> # Test 2 with R 3.3.0 (seg-faults)
> 
> 
>R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
>Copyright (C) 2016 The R Foundation for Statistical Computing
>Platform: x86_64-apple-darwin13.4.0 (64-bit)
> 
>R is free software and comes with ABSOLUTELY NO WARRANTY.
>You are welcome to redistribute it under certain conditions.
>Type 'license()' or 'licence()' for distribution details.
> 
>  Natural language support but running in an English locale
> 
>R is a collaborative project with many contributors.
>Type 'contributors()' for more information and
>'citation()' on how to cite R or R packages in publications.
> 
>Type 'demo()' for some demos, 'help()' for on-line help, or
>'help.start()' for an HTML browser interface to help.
>Type 'q()' to quit R.
> 
>> sessionInfo()
>R version 3.3.0 (2016-05-03)
>Platform: x86_64-apple-darwin13.4.0 (64-bit)
>Running under: OS X 10.11.5 (El Capitan)
> 
>locale:
>[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> 
>attached base packages:
>[1] stats graphics  grDevices utils datasets  methods   base 
>> library(rgdal)
>Loading required package: sp
>rgdal: version: 1.1-9, (SVN revision 617M)
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.11.4, released 2016/01/25
> Path to GDAL shared files: 
> /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/gdal
> Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
> Path to PROJ.4 shared files: 
> /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/proj
> Linking to sp version: 1.2-3 
>> lon <- 0
>> lat <- 0
>> proj <- "+proj=wintri"
>> xy <- rgdal::project(cbind(lon, lat), proj=proj)
>> print(xy)
> lon lat
>[1,]   0   0
>> rgdal::project(xy, proj=proj, inv=TRUE)
> 
> *** caught segfault ***
>address 0x0, cause 'memory not mapped'
> 
>Traceback:
> 1: .Call("project_inv", as.integer(nc), as.double(xy[, 1]), 
> as.double(xy[, 2]), proj, as.logical(use_ob_tran), PACKAGE = "rgdal")
> 2: rgdal::project(xy, proj = proj, inv = TRUE)
>An irrecoverable exception 

Re: [R-SIG-Mac] rgdal problem with wintri projection (OSX, R-3.3.0, rgdal 1.1-9)

2016-05-11 Thread Simon Urbanek
> rgdal::project(xy, proj=proj, inv=TRUE)
Process 6803 stopped
* thread #1: tid = 0xc72bb10, 0x, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x
error: memory read failed for 0x0
(lldb) bt
* thread #1: tid = 0xc72bb10, 0x, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x
frame #1: 0x0001068a2657 rgdal.so`pj_inv(xy=(x = 0, y = 0), 
P=0x00010070ac10) + 215 at pj_inv.c:22
frame #2: 0x000106011f2b rgdal.so`project_inv(n=, 
x=0x000105db1d28, y=0x000105db1c68, projarg=, 
ob_tran=) + 251 at projectit.cpp:300
frame #3: 0x00010007b827 libR.dylib`do_dotcall(call=0x000105b632b0, 
op=, args=, env=) + 327 at dotcode.c:1251
frame #4: 0x0001000a8e4c libR.dylib`Rf_eval(e=0x000105b632b0, 
rho=0x000105b7a408) + 988 at eval.c:713

I'll look into the PROJ4 version issue as well and keep you posted.

Cheers,
Simon


On May 11, 2016, at 6:44 AM, Roger Bivand  wrote:

> David Winsemius  comcast.net> writes:
> 
>> 
>> 
>>> On May 10, 2016, at 7:36 AM, Daniel Kelley  Dal.Ca> wrote:
>>> 
>>> On OSX, I find that inverse projections yield segmentation faults with
> the newly-released R (version
>> 3.3.0). This works with both rgdal 1.1-8 and also with 1.1-9 (released
> yesterday).
>>> 
> 
> ...
> 
> 
 rgdal::project(xy, proj=proj, inv=TRUE)
>>> 
>>> *** caught segfault ***
>>> address 0x0, cause 'memory not mapped'
>>> 
>>> Traceback:
>>> 1: .Call("project_inv", as.integer(nc), as.double(xy[, 1]),
> as.double(xy[, 2]), proj,
>> as.logical(use_ob_tran), PACKAGE = "rgdal")
>>> 2: rgdal::project(xy, proj = proj, inv = TRUE)
>>> An irrecoverable exception occurred. R is aborting now ...
>>> Segmentation fault: 11
>> 
> 
> This appears to affect 1.1-9 on OSX. As rgdal maintainer, obviously I'd like
> to resolve this, but have mo access to OSX hardware at all. I'm assuming
> that the rgdal version is installed as binary from CRAN (thanks to Simon for
> providing the binary package!).
> 
> Do we know whether the OSX version matters?
> 
> Do we know that the same rgdal version 1.1-9 installed from source suffers
> from the same problem; if it does, is 1.1-8 free of the problem (as with the
> CRAN binary)?
> 
> There may be a user-facing work-around - use spTransform (or rawTransform())
> rather than project(), but I cannot check it myself:
> 
> xy <- rawTransform("+proj=longlat", "+proj=wintri", n=1L, x=0, y=0)
> rawTransform("+proj=wintri", "+proj=longlat", n=1L, x=xy[[1]][1], 
> y=xy[[2]][1])
> 
> This is using different functions in the PROJ.4 library.
> 
> If anyone could provide gdb or similar output of a backtrace, that would be
> very helpful.
> 
> Roger
> 
>> I was using slightly out of date versions of the R packages. With rgdal
> 1.1-8 and sp 1.2-3 there was no
>> segfault. I thought that the difference might be due to the fact that I'm
> using a later version of PROJ.4
>> runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492].  However,
> "updating" to rgdal 1.1-9 now
>> produces the same segfault.
>> 
> 
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] rgdal problem with wintri projection (OSX, R-3.3.0, rgdal 1.1-9)

2016-05-11 Thread Roger Bivand
David Winsemius  comcast.net> writes:

> 
> 
> > On May 10, 2016, at 7:36 AM, Daniel Kelley  Dal.Ca> wrote:
> > 
> > On OSX, I find that inverse projections yield segmentation faults with
the newly-released R (version
> 3.3.0). This works with both rgdal 1.1-8 and also with 1.1-9 (released
yesterday).
> > 

...


> >> rgdal::project(xy, proj=proj, inv=TRUE)
> > 
> > *** caught segfault ***
> > address 0x0, cause 'memory not mapped'
> > 
> > Traceback:
> > 1: .Call("project_inv", as.integer(nc), as.double(xy[, 1]),
as.double(xy[, 2]), proj,
> as.logical(use_ob_tran), PACKAGE = "rgdal")
> > 2: rgdal::project(xy, proj = proj, inv = TRUE)
> > An irrecoverable exception occurred. R is aborting now ...
> > Segmentation fault: 11
> 

This appears to affect 1.1-9 on OSX. As rgdal maintainer, obviously I'd like
to resolve this, but have mo access to OSX hardware at all. I'm assuming
that the rgdal version is installed as binary from CRAN (thanks to Simon for
providing the binary package!).

Do we know whether the OSX version matters?

Do we know that the same rgdal version 1.1-9 installed from source suffers
from the same problem; if it does, is 1.1-8 free of the problem (as with the
CRAN binary)?

There may be a user-facing work-around - use spTransform (or rawTransform())
rather than project(), but I cannot check it myself:

xy <- rawTransform("+proj=longlat", "+proj=wintri", n=1L, x=0, y=0)
rawTransform("+proj=wintri", "+proj=longlat", n=1L, x=xy[[1]][1], y=xy[[2]][1])

This is using different functions in the PROJ.4 library.

If anyone could provide gdb or similar output of a backtrace, that would be
very helpful.

Roger

> I was using slightly out of date versions of the R packages. With rgdal
1.1-8 and sp 1.2-3 there was no
> segfault. I thought that the difference might be due to the fact that I'm
using a later version of PROJ.4
> runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492].  However,
"updating" to rgdal 1.1-9 now
> produces the same segfault.
>

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac