Scenario
- use
reticulate
to importgeopandas
to read a.shp
file - works in R session within machine where shiny server sits, but fails when run as shiny server app
R session
[leungi@shiny]$ R
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (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.
> wd <- "/opt/shiny-server/samples/sample-apps/my_project"
> sections_path <- "/Data/NM.shp"
> gpd = import("geopandas")
> shp_dat <- gpd$read_file(file.path(wd, sections_path))
> head(shp_dat)
STATE COUNTY MERIDIAN TWP TDIR RNG RDIR SECT STCTY MAINT__ID OBJECT__ID
1 30 5 23 16 S 16 E 31 30005 2236037 1561107
2 30 5 23 18 S 16 E 30 30005 2260363 1564838
3 30 5 23 19 S 16 E 7 30005 2267140 1565939
4 30 5 23 19 S 16 E 6 30005 2264997 1565610
5 30 5 23 19 S 16 E 30 30005 2273561 1566964
6 30 5 23 16 S 16 E 8 30005 2227246 1559742
SNAME CNAME SHAPE_AREA SHAPE_LEN geometry
1 NEW MEXICO CHAVES 0.0001942569 0.05635857 <environment: 0x75a6d78>
2 NEW MEXICO CHAVES 0.0002301894 0.06074057 <environment: 0x75b19b8>
3 NEW MEXICO CHAVES 0.0002448596 0.06278105 <environment: 0x75ba870>
4 NEW MEXICO CHAVES 0.0002492395 0.06340133 <environment: 0x75c54e8>
5 NEW MEXICO CHAVES 0.0002513312 0.06353639 <environment: 0x75cc368>
6 NEW MEXICO CHAVES 0.0002524851 0.06380171 <environment: 0x75d9018>
Sessioninfo
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.3 (Maipo)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reticulate_1.12
loaded via a namespace (and not attached):
[1] compiler_3.6.0 Matrix_1.2-17 Rcpp_1.0.1 grid_3.6.0
[5] jsonlite_1.6 lattice_0.20-38
Shiny app /var/log/
Listening on http://127.0.0.1:44147
R: geos_ts_c.cpp:3472: int GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t, geos::geom::CoordinateSequence*, unsigned int, unsigned int, double): Assertion `0 != cs' failed.
-bash: line 1: 58500 Aborted (core dumped) R --no-save --slave -f \/opt\/shiny-server\/R\/SockJSAdapter\.R