2

I would like to experiment a bit with different and less-frequently used projections in R for global maps, but I am playing a guessing game as of which are actually working.

I tried to look up ESRI or EPSG codes in https://spatialreference.org/ or https://epsg.io/, but some work and some don't. For example, ESRI:102017 works with vectors (sf package), but not with raster (terra package), ESRI:54099 doesn't work at all.

library(giscoR)
projected = st_transform(gisco_coastallines, "EPSG:9794")
ggplot()+geom_sf(data=projected)

Is there a comprehensive list of map projections available that work in R, so we do not need to go through trial and error?

Some of the projections I would like to use are Guyou, Gringorten, alternative oblique arrangement, Gott-Mugnolo Azimuthal.

1 Answer 1

4

The projections and projection operations are not implemented in R directly - but in PROJ, which is a standalone library at system level. This library is integrated with R somewhat loosely - you can end up with different versions of PROJ running in two separate installations with the same version of R packages such as {sf} and {terra}. It is a known source of issues.

You will find a list of projections that the current PROJ versions supports at https://proj.org/en/9.3/operations/projections/index.html

Note that you will have to make sure that:

  1. you have current (enough) version of PROJ installed - it need not be the latest, but newer versions have more features (and bugs, but I digress)
  2. that your {sf} and {terra} are using the same instance of PROJ; this may involve compiling both R packages from source.
2
  • thank you that is useful. However some projections to not work correctly even if just apply to SF objects. For example I have tried the Guyou projection but it cuts off some continents. Maybe R is not really suited for this kind of maps. Nov 24, 2023 at 11:46
  • The commonly used projections are usually OK - but yes, there may be a problem with some of the more exotic ones. I can confirm that I can't make Guyou work either. Nov 24, 2023 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.