[R-sig-Geo] rgdal, PROJ6 and "+init=epsg" syntax on Jupyter/conda
James Sample
j@me@@e@@@mp|e @end|ng |rom gm@||@com
Thu Sep 12 17:10:22 CEST 2019
After going round in circles most of the day, I finally discovered that the
PROJ_LIB environment variable within my Dockerfile did not match my conda
environment. When I loaded rgdal I saw
Path to PROJ.4 shared files: (autodetected)
in the output and assumed all was OK, but having explicitly set the
environment variable I now see
Path to PROJ.4 shared files: /opt/conda/share/proj
and everything works as expected.
On a related note, some of my Python code also has started to give errors
similar to those reported by Edzer e.g.
init=epsg:/init=IGNF: syntax not supported in non-PROJ4 emulation mode
I suspect these issues probably *are *caused by API changes in PROJ6, but
my original issue is unrelated and was due to incorrect paths in my
conda/Docker environment.
Thanks for your help, Edzer! I look forward to working more with R spatial
tools in the future :-)
James.
On Thu, 12 Sep 2019 at 12:30, Edzer Pebesma <edzer.pebesma using uni-muenster.de>
wrote:
> CRAN, btw, reports similar errors on all debian testing platforms, of
> the kind
>
> > st_crs("+init=epsg:3857")$epsg
> proj_create: init=epsg:/init=IGNF: syntax not supported in non-PROJ4
> emulation mode
>
> see
>
> https://cran.r-project.org/web/checks/check_results_edzer.pebesma_at_uni-muenster.de.html#sf
>
> I failed to reproduce these because I can't build the CRAN debian
> testing docker image from https://github.com/jeroen/rcheckserver ,
> reported here: https://github.com/jeroen/rcheckserver/issues/2
>
> I would appreciate any help here.
>
> On 9/12/19 11:08 AM, Edzer Pebesma wrote:
> >
> >
> > On 9/12/19 10:55 AM, James Sample wrote:
> >> Thanks Edzer - that's very helpful!
> >>
> >> Would it be possible for you to link/share your Ubuntu Dockerfile,
> please?
> >> (I completely understand if you'd rather not, of course).
> >
> > https://github.com/r-spatial/sf/tree/master/inst/docker/gdal
> >
> >>
> >> Perhaps if I can see how you're setting thing up in Ubuntu I can modify
> my
> >> Jupyter Dockerfile accordingly, and if I can convince myself that this
> is a
> >> actually conda-forge/build issue (rather than my own mistake) I can
> open an
> >> issue on the conda r-rgdal feedstock (
> >> https://github.com/conda-forge/r-rgdal-feedstock).
> >
> > Great, please also report back here!
> >
> >>
> >> Thanks again for your help!
> >>
> >> Best wishes,
> >>
> >>
> >> James.
> >>
> >>
> >>
> >> On Wed, 11 Sep 2019 at 23:10, Edzer Pebesma <
> edzer.pebesma using uni-muenster.de>
> >> wrote:
> >>
> >>> On an ubuntu docker image with gdal 3.0.1 and PROJ 6.2.0, I see:
> >>>
> >>>> library(rgdal)
> >>> Loading required package: sp
> >>> rgdal: version: 1.4-6, (SVN revision (unknown))
> >>> Geospatial Data Abstraction Library extensions to R successfully
> loaded
> >>> Loaded GDAL runtime: GDAL 3.0.1, released 2019/06/28
> >>> Path to GDAL shared files:
> >>> GDAL binary built with GEOS: FALSE
> >>> Loaded PROJ.4 runtime: Rel. 6.2.0, September 1st, 2019, [PJ_VERSION:
> 620]
> >>> Path to PROJ.4 shared files: (autodetected)
> >>> Linking to sp version: 1.3-1
> >>>> CRS("+init=epsg:3035")
> >>> CRS arguments:
> >>> +init=epsg:3035 +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000
> >>> +y_0=3210000 +ellps=GRS80 +units=m +no_defs
> >>>
> >>> but also a warning with sf:
> >>>
> >>>> library(sf)
> >>> Linking to GEOS 3.7.2, GDAL 3.0.1, PROJ 6.2.0
> >>>> st_crs("+init=epsg:3035")
> >>> Coordinate Reference System:
> >>> No EPSG code
> >>> proj4string: "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000
> +y_0=3210000
> >>> +ellps=GRS80 +units=m +no_defs"
> >>> Warning message:
> >>> In CPL_crs_from_proj4string(x) :
> >>> GDAL Message 1: +init=epsg:XXXX syntax is deprecated. It might return
> >>> a CRS with a non-EPSG compliant axis order.
> >>>
> >>> so it feels like a combination of how PROJ has been installed, and how
> >>> it has been compiled into the R packages.
> >>>
> >>>
> >>> On 9/11/19 9:38 PM, James Sample wrote:
> >>>> Dear all,
> >>>>
> >>>> I am trying to setup R and rgdal within a JupyterLab environment
> >>> alongside
> >>>> my usual Python tools. I realise this is probably an unfamiliar setup
> for
> >>>> many, but I hope someone might be able to help nevertheless.
> >>>>
> >>>> I'm using a Docker container based on Ubuntu 18.04 and derived from
> the
> >>>> Jupyter Data Science Notebook (
> >>>>
> >>>
> https://github.com/jupyter/docker-stacks/tree/master/datascience-notebook
> >>> ).
> >>>> I have Python 3.7 and R 3.6 installed, and I'm using "conda" as my
> >>> package
> >>>> manager.
> >>>>
> >>>> I have successfully installed GDAL and PROJ, together with various
> Python
> >>>> and R packages, including 'sp' and 'rgdal'. When I run
> >>>>
> >>>> require(rgdal)
> >>>>
> >>>> I see the following
> >>>>
> >>>> Loading required package: rgdal
> >>>> Loading required package: sp
> >>>> rgdal: version: 1.4-4, (SVN revision 833)
> >>>> Geospatial Data Abstraction Library extensions to R successfully
> loaded
> >>>> Loaded GDAL runtime: GDAL 2.4.2, released 2019/06/28
> >>>> Path to GDAL shared files: /opt/conda/share/gdal
> >>>> GDAL binary built with GEOS: TRUE
> >>>> Loaded PROJ.4 runtime: Rel. 6.1.0, May 15th, 2019, [PJ_VERSION: 610]
> >>>> Path to PROJ.4 shared files: (autodetected)
> >>>> Linking to sp version: 1.3-1
> >>>>
> >>>>
> >>>> which seems OK. Most things work as expected, but this
> >>>>
> >>>> CRS("+init=epsg:3035")
> >>>>
> >>>> gives an exception
> >>>>
> >>>> Error in CRS("+init=epsg:3035"): no arguments in initialization
> list
> >>>>
> >>>> The same code works fine in R-Studio, although I note that my R-Studio
> >>>> installation has PROJ 4.9.2 (with the same versions of rgdal and sp as
> >>>> listed above). Unfortunately I can't downgrade PROJ, since some of my
> >>>> Python packages require version 6.1.
> >>>>
> >>>> I have read that rgdal is compatible with PROJ6 and I haven't been
> able
> >>> to
> >>>> find (m)any similar issues online, so I assume I'm doing something
> wrong.
> >>>> As a workaround, this runs successfully
> >>>>
> >>>> showP4(showWKT("+init=epsg:3035"))
> >>>>
> >>>> But the original syntax is cleaner and I'd rather not refactor all my
> old
> >>>> code if I can help it. Can anyone point me in the right direction,
> >>> please?
> >>>> Is the "+init=epsg" syntax supported with PROJ 6, or should I be
> using an
> >>>> alternative?
> >>>>
> >>>> Thanks and best wishes,
> >>>>
> >>>>
> >>>> James.
> >>>>
> >>>> [[alternative HTML version deleted]]
> >>>>
> >>>> _______________________________________________
> >>>> R-sig-Geo mailing list
> >>>> R-sig-Geo using r-project.org
> >>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>>>
> >>>
> >>> --
> >>> Edzer Pebesma
> >>> Institute for Geoinformatics
> >>> Heisenbergstrasse 2, 48151 Muenster, Germany
> >>> Phone: +49 251 8333081
> >>> _______________________________________________
> >>> R-sig-Geo mailing list
> >>> R-sig-Geo using r-project.org
> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>>
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> _______________________________________________
> >> R-sig-Geo mailing list
> >> R-sig-Geo using r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>
> >
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> Edzer Pebesma
> Institute for Geoinformatics
> Heisenbergstrasse 2, 48151 Muenster, Germany
> Phone: +49 251 8333081
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list