[R-sig-Geo] how to find projections supported by sf::st_crs()?

Daniel Kelley D@n@Ke||ey @end|ng |rom D@|@C@
Tue Jan 21 15:45:30 CET 2020


I am pondering the use of `sf::sf_project()` for map-projection calculations within the `oce` package. My impression is that `sf::st_crs()` ought to be used to process projection strings, instead of handing strings directly to `sf::sf_project()`.  (I think the idea is that this will lead to the addition of extra information about the ellipse model, etc., and perhaps do some checks for errors in the string.)

However, my tests show that `sf::st_crs()` balks at some projections, such as `wintri`, as shown in the code snippets given near the end of this email.  (Those snippets also show that `sf::sf_project()` handles the wintri projection, as does `rgdal::project()`, so the warning does not mean that `sf` will refuse to do the projection.)

This leads me to three questions, that I'm hoping others can shed light on.

1. Am I right in thinking that I ought to use `sf::sf_crs()` to "clean up" my projection specifications?

2. Is there a way to find the list of projections that `sf::sf_crs()` accepts without producing `NA` results and warnings?

3. Should I avoid using projections that `sf::sf_crs()` warns about?

I apologize if I ought to have gathered the results from my reading.  I could be looking in the wrong places.

Thanks in advance for any advice!  -- Dan.

```R
> library(sf)
Linking to GEOS 3.8.0, GDAL 2.4.2, PROJ 6.2.1

> sf::sf_project("+proj=lonlat", "+proj=wintri", cbind(0,0))
     [,1] [,2]
[1,]    0    0

> sf::st_crs("+proj=wintri")
Coordinate Reference System: NA
Warning message:
In CPL_crs_from_proj4string(x) :
  GDAL cannot import PROJ.4 string `+proj=wintri': returning missing CRS
```

Dan E. Kelley [he/him/his 314ppm]
Dalhousie University



More information about the R-sig-Geo mailing list