-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRS() segfault on windows 64 bits #75
Comments
with former versions, do you mean also former versions of |
Well on my Windows virtual machine my packages are not always up-to-date. In some above mentioned R versions |
Which version of rgdal, how installed? The CRAN binaries of rgdal for
windows only have pre-barn workflows. With proj 6 and gdal 3, your choice
of workflow will stop working. Which other packages are involved?
Roger Bivand
Falsensvei 32
5063 Bergen
tir. 3. mar. 2020, 21.14 skrev Jean-Romain <notifications@github.com>:
… Well on my Windows virtual machine my packages are not always up-to-date.
In some above mentioned R versions sp was in version 1.3.x. In R 3.5.1 64
bits it is 1.3.2. In R 3.6.1 64 bits it is 1.4.1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#75?email_source=notifications&email_token=ACNZ3BEGHWHVEW6BTV5XZYLRFVQLRA5CNFSM4LARTCI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENU7J7Y#issuecomment-594146559>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNZ3BA3LJFFQXZ3M75TL7LRFVQLRANCNFSM4LARTCIQ>
.
|
I'm not a windows user. I only have a virtual machine to reproduce some windows specific issues. I'm installing the packages using The No other package are involved. I provided a minimal reproducible example. What do you mean by with proj 6 and gdal 3, your choice of workflow will stop working |
First, if you are a lidR developer, read r-spatial/discuss#28 and the links there to see that your workflows need careful revision to adapt to ongoing changes in sf, sp and rgdal. Then read the output messages on attaching sf or rgdal ( Look carefully at:
Can you say which dialect of WKT this is? On my rgdal, I see:
all of which drop the I can reproduce the crash on Windows 10, R 3.6.2, sp 1.4-1 and rgdal 1.4-8 (CRAN binaries), which has PROJ 4.9.3 and GDAL 2.2.3, . A work-around is to avoid going back to rgdal in To just put the trusted PROJ string into the CRS object, use the work-around. We need active collaboration to find out the dialect of your WKT string, so that our current PROJ >= 6 and GDAL >= 3 workflows do not discard |
On Windows 32-bit, I see:
which is what you see sometimes (PROJ error).
and
On Linux, with recent PROJ/GDAL:
|
My best guess is that you are feeding a very modern WKT representation into an old version of GDAL/PROJ. Turning off |
Roll-my-own Windows rgdal binary at http://spatial.nhh.no/R/rgdal/rgdal_1.5-6.zip (PROJ 4.9.3, GDAL 2.2.3), source at http://spatial.nhh.no/R/rgdal/rgdal_1.5-6.tar.gz. The CRS will be trashed, but it should stop crashes. Report back, please. |
No. Actually I have only few knowledge about projections. I didn't even know there was some dialects of WTK. My rlas package provides the ability to read the raw content of In a tryCatch(sp::CRS(paste0("+init=epsg:", epsg_code)), error = function(e) sp::CRS()) when it is a WTK string I'm doing tryCatch(sp::CRS(rgdal::showP4(wkt_string)), error = function(e) sp::CRS()) This is (almost) all the CRS related jobs done by lidR. It belongs in those 2 lines of code. The other parts being only the transfer of the CRS from the input (a point cloud) to the outputs (raster, sp, sf objects).
The wkt = "COMPD_CS[\"Projected\", PROJCS[\"UTM_10N\", GEOGCS [ \"WGS84\", DATUM [ \"WGS84\", SPHEROID [\"WGS 84\", 6378137.000, 298.257223563 ], TOWGS84 [ 0.000, 0.000, 0.000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ] ], PRIMEM [ \"Greenwich\", 0.000000 ], UNIT [ \"metres\", 1.00000000] ], PROJECTION[\"Transverse_Mercator\"], PARAMETER[\"Latitude_of_Origin\",0.0000000000], PARAMETER[\"Central_Meridian\",-123.0000000000], PARAMETER[\"Scale_Factor\",0.9996000000], PARAMETER[\"False_Easting\",500000.000], PARAMETER[\"False_Northing\",0.000], UNIT [ \"metres\", 1.00000000]] ], VERT_CS[\"NAVD88 (Geoid03) ContUS\", VERT_DATUM[\"./Resources/CoordSysData/navd88_geo03_contus.bin\", 1 ], UNIT [ \"metres\", 1.00000000] ] ]"
proj4 = rgdal::showP4(wkt)
crs = sp::CRS(proj4)
crs
#> CRS arguments:
#> +proj=tmerc +lat_0=0 +lon_0=-7047.38088010913 +k=0.9996 +x_0=500000 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
I already read those links (you reported an issue I fixed in lidR r-lidar/lidR#299) but to be honest I hardly understand a third of the problem and I'm lost with all the forthcoming changes ; the current state of the art being already confusing (as I said I'm not enough knowledgeable about CRS)
I tried in R 3.6.1 x64 and it returned |
Thanks for checking. I'll be some time before rgdal is released. The problem with the current workflows (after just glancing) is that with LAS 1.4 you will have a WKT representation with VERTCS[], but by converting to PROJ and instantiating an sp::CRS, you lose most of the important information. In principle, using development sf Unfortunately, passing both of the WKT strings you've provided to the PROJ command line application |
FYI, branch |
The las file is available here. You can read the header of the file in R with h = rlas::read.lasheader("e1054n0839.las")
h[["Variable Length Records"]][["WKT OGC CS"]][["WKT OGC COORDINATE SYSTEM"]]
#> [1] "PROJCS[\"NAD83 (2011) / Conus Albers\",GEOGCS[\"GCS_NAD_1983_2011\",DATUM[\"D_NAD_1983_2011\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101,AUTHORITY[\"EPSG\",7019]],AUTHORITY[\"EPSG\",1116]],PRIMEM[\"Greenwich\",0.0,AUTHORITY[\"EPSG\",8901]],UNIT[\"Degree\",0.0174532925199433,AUTHORITY[\"EPSG\",9102]],AUTHORITY[\"EPSG\",6318]],PROJECTION[\"Albers\",AUTHORITY[\"Esri\",43007]],PARAMETER[\"False_Easting\",0.0,AUTHORITY[\"Esri\",100001]],PARAMETER[\"False_Northing\",0.0,AUTHORITY[\"Esri\",100002]],PARAMETER[\"Central_Meridian\",-96.0,AUTHORITY[\"Esri\",100010]],PARAMETER[\"Standard_Parallel_1\",29.5,AUTHORITY[\"Esri\",100025]],PARAMETER[\"Standard_Parallel_2\",45.5,AUTHORITY[\"Esri\",100026]],PARAMETER[\"Latitude_Of_Origin\",23.0,AUTHORITY[\"Esri\",100021]],UNIT[\"Meter\",1.0,AUTHORITY[\"EPSG\",9001]]],VERTCS[\"NAVD_1988\",VDATUM[\"North_American_Vertical_Datum_1988\",AUTHORITY[\"EPSG\",5103]],PARAMETER[\"Vertical_Shift\",0.0,AUTHORITY[\"Esri\",100006]],PARAMETER[\"Direction\",1.0,AUTHORITY[\"Esri\",100007]],UNIT[\"Meter\",1.0,AUTHORITY[\"EPSG\",9001]],AUTHORITY[\"EPSG\",5703]]" I also checked the file with
As a conclusion your advice is to use wkt = "PROJCS[\"NAD83 (2011) / Conus Albers\" [...]"
proj4 = rgdal::showP4(wkt)
crs = sp::CRS(proj4, doCheckCRSArgs = FALSE)
crs
#> CRS arguments:
#> +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0
#> +ellps=GRS80 +units=m +no_defs
crs = sp::CRS(SRS_string = wkt)
crs
#> CRS arguments: NA
To me it is not a big problem:
|
None of these raw strings from LAS files (1.4, WKT specified) seem to render as expected in
|
I'm having a perhaps related issue. Using This is running with reprex: proj <- sp::CRS("+proj=longlat +datum=WGS84")
proj
#> CRS arguments:
#> +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 Created on 2020-03-24 by the reprex package (v0.3.0) But if I try to knit this document
I get. Strangely, if I remove the last line ("proj"), then I get a different error: I'm on Ubuntu 64bits and using the latest Session infodevtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.3 (2020-02-29)
#> os elementary OS 5.1.2 Hera
#> system x86_64, linux-gnu
#> ui X11
#> language en_US
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/Argentina/Buenos_Aires
#> date 2020-03-24
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
#> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
#> callr 3.4.2 2020-02-12 [1] CRAN (R 3.6.2)
#> cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.2)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0)
#> devtools 2.2.2 2020-02-17 [1] CRAN (R 3.6.3)
#> digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
#> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.2)
#> fs 1.3.2 2020-03-05 [1] CRAN (R 3.6.3)
#> glue 1.3.2 2020-03-12 [1] CRAN (R 3.6.3)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0)
#> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.1)
#> knitr 1.28 2020-02-06 [1] CRAN (R 3.6.2)
#> lattice 0.20-40 2020-02-19 [4] CRAN (R 3.6.2)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
#> pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.2)
#> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.2)
#> processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.2)
#> ps 1.3.2 2020-02-13 [1] CRAN (R 3.6.2)
#> R6 2.4.1.9000 2020-01-21 [1] Github (r-lib/R6@8e0b318)
#> Rcpp 1.0.4 2020-03-17 [1] CRAN (R 3.6.3)
#> remotes 2.1.1 2020-02-15 [1] CRAN (R 3.6.3)
#> rgdal 1.4-8 2019-11-27 [1] CRAN (R 3.6.2)
#> rlang 0.4.5 2020-03-01 [1] CRAN (R 3.6.3)
#> rmarkdown 2.1 2020-01-20 [1] CRAN (R 3.6.2)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
#> sp 1.4-1 2020-02-28 [1] CRAN (R 3.6.3)
#> stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.3)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
#> testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
#> usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.1)
#> withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0)
#> xfun 0.12 2020-01-13 [1] CRAN (R 3.6.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.2)
#>
#> [1] /home/elio/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library |
Windows!= Ubuntu.
Please report the output of the startup messages when you execute
library(rgdal). The specific versions of PROJ and GDAL matter, and how you
installed them and rgdal itself. Please run debug(sp::CRS) and see where
the branches go, and report back. Most combinations of versions of sp,
rgdal, PROJ and GDAL have been tested without error, but not GDAL 3 and
PROJ 5
which is not sensible.
Roger Bivand
Falsensvei 32
5063 Bergen
tir. 24. mar. 2020, 23.02 skrev Elio Campitelli <notifications@github.com>:
… I'm having a perhaps related issue. Using sp::CRS() crashes with strange
errors (probably at the C level, but I don't know enough to be sure) but
only when knitting!
This is running with reprex:
proj <- sp::CRS("+proj=longlat +datum=WGS84")
proj
#> CRS arguments:
#> +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
Created on 2020-03-24 by the reprex package <https://reprex.tidyverse.org>
(v0.3.0)
But if I try to knit this document
---
title: "Untitled"
output: html_document
---
```{r}
proj <- sp::CRS("+proj=longlat +datum=WGS84")
proj
```
I get. munmap_chunk(): invalid pointer.
Strangely, if I remove the last line ("proj"), then I get a different
error: double free or corruption (out). Another error I get is free():
invalid pointer. It seems that adding or removing valid R code around proj
<- sp::CRS("+proj=longlat +datum=WGS84") changes the error slightly, but
it always fails.
I'm on Ubuntu 64bits and using the latest sp package from CRAN (version
1.4-1)
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.3 (2020-02-29)
#> os elementary OS 5.1.2 Hera
#> system x86_64, linux-gnu
#> ui X11
#> language en_US
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/Argentina/Buenos_Aires
#> date 2020-03-24
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
#> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
#> callr 3.4.2 2020-02-12 [1] CRAN (R 3.6.2)
#> cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.2)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0)
#> devtools 2.2.2 2020-02-17 [1] CRAN (R 3.6.3)
#> digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
#> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.2)
#> fs 1.3.2 2020-03-05 [1] CRAN (R 3.6.3)
#> glue 1.3.2 2020-03-12 [1] CRAN (R 3.6.3)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0)
#> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.1)
#> knitr 1.28 2020-02-06 [1] CRAN (R 3.6.2)
#> lattice 0.20-40 2020-02-19 [4] CRAN (R 3.6.2)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
#> pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.2)
#> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.2)
#> processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.2)
#> ps 1.3.2 2020-02-13 [1] CRAN (R 3.6.2)
#> R6 2.4.1.9000 2020-01-21 [1] Github ***@***.***)
#> Rcpp 1.0.4 2020-03-17 [1] CRAN (R 3.6.3)
#> remotes 2.1.1 2020-02-15 [1] CRAN (R 3.6.3)
#> rgdal 1.4-8 2019-11-27 [1] CRAN (R 3.6.2)
#> rlang 0.4.5 2020-03-01 [1] CRAN (R 3.6.3)
#> rmarkdown 2.1 2020-01-20 [1] CRAN (R 3.6.2)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
#> sp 1.4-1 2020-02-28 [1] CRAN (R 3.6.3)
#> stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.3)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
#> testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
#> usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.1)
#> withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0)
#> xfun 0.12 2020-01-13 [1] CRAN (R 3.6.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.2)
#>
#> [1] /home/elio/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#75 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNZ3BF4FTQAUMVZNBYISGDRJEUY3ANCNFSM4LARTCIQ>
.
|
I believed it was to an update of either library(rgdal)
rgdal: version: 1.4-8, (SVN revision 845)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files:
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.3-2 |
It affects |
Here's the result from library(rgdal)
Running with debug didn't shine much light into the issue because when run outside markdown, it all works well. |
Try reinstalling rgdal, it was built against an earlier sp (should not
help). Then try
*install.packages("rgdal", repos="http://R-Forge.R-project.org
<http://R-Forge.R-project.org>")*
*to try the development version. This will upset your work just like sf
0.9-0, just on CRAN, and also using PROJ 6.*
Roger Bivand
Falsensvei 32
5063 Bergen
tir. 24. mar. 2020, 23.26 skrev Elio Campitelli <notifications@github.com>:
… Here's the result from library(rgdal)
> library(rgdal)
Loading required package: sp
rgdal: version: 1.4-8, (SVN revision 845)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files:
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.3-2
Running with debug didn't shine much light into the issue because when run
outside markdown, it all works well.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#75 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNZ3BFRGFFDO6UDC2I3MGDRJEXQZANCNFSM4LARTCIQ>
.
|
Reinstalling rgdal (with the usual install.packages from CRAN) fixed it! |
Thanks. I think you've found a(nother) logic bug in sp 1.4-*, that of rgdal
being stale, I'll check tomorrow. Good that re-installing helped.
Roger Bivand
Falsensvei 32
5063 Bergen
tir. 24. mar. 2020, 23.36 skrev Elio Campitelli <notifications@github.com>:
… Reinstalling rgdal (with the usual install.packages from CRAN) fixed it!
That was very weird.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#75 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNZ3BDHQM5ZE6KWOUJJAYLRJEYVRANCNFSM4LARTCIQ>
.
|
Everything looks good on my side as well. Thank you it was a very annoying trouble. |
This is a minimal reproducible example that crashes the R session on Windows 64 bits using
sp 1.4.1
but also former versionsThis issue is related to lidR #323. For the context the WKT string was read from a LAS file format 1.4.
The bug is not always reproducible. To reproduce it with certainty I restart my virtual machine and run a fresh R session in Rstudio. If I restart an R session after a crash the code fails nicely as expected.
The text was updated successfully, but these errors were encountered: