[R-sig-Geo] Help when moving from PROJ4 to PROJ6

Gilberto Camara g||berto@c@m@r@@|npe @end|ng |rom gm@||@com
Tue Jul 28 13:29:37 CEST 2020


Dear R-SIG-GEO (esp. Roger and Edzer)

I am having problems with “raster”, “rgdal”, and “sf” when moving from PROJ4 to PROJ6. Roger’s explanation on the r-spatial blog ("https://www.r-spatial.org/r/2020/03/17/wkt.html”) and the rgdal blog (http://rgdal.r-forge.r-project.org/articles/PROJ6_GDAL3.html <http://rgdal.r-forge.r-project.org/articles/PROJ6_GDAL3.html>) are clear on the reasons why there are problems with CRS. As Roger points out, “package maintainers will need to review their use of crs objects”. So very true!

I appreciate the tremendous effort of Edzer and Roger for moving from PROJ4 to PROJ6. 

However, I am failing to understand what is happening in the following example:

================================================
library(sf)
> longitude <- -55.62277
> latitude  <- -11.75932

> st_point <- sf::st_point(c(longitude, latitude))
> ll_sfc   <- sf::st_sfc(st_point, crs = "EPSG:4326")

> ll_sfc[[1]]
POINT (-55.55527 -11.51782)

> ll_sfc2 <- sf::st_sfc(st_point, crs = "+proj=longlat +datum=WGS84 +no_defs”)

> ll_sfc2[[1]]
POINT (-55.62277 -11.75932)
==================================================

> sessionInfo()
R version 4.0.1 (2020-06-06)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

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

other attached packages:
[1] sf_0.9-5      sits_0.9.5.1  raster_3.3-13 rgdal_1.5-12  sp_1.4-2    
=====================================================================

Why is using the EPSG code resulting in a different behaviour that using the old PROJ4 text?

Many thanks
Gilberto

===========================
Prof Dr Gilberto Camara
Secretariat Director
GEO - Group on Earth Observations
7 bis, Avenue de La Paix
CH-1211 Geneva - Switzerland
Tel: +41227308480
www.earthobservations.org


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list