I am supporting an package that serves {sf} objects using EPSG:4326 as default projection; I have little control over the setup my users have (some rely on defaults, others compile from source).
I have run into issue where EPSG:4326 as interpreted in context of PROJ 4.9.3 (the standard when using Windows binaries) looks differently from the same projection in context of higher versions of PROJ.
The PROJ 4.9.3 version of a crs object is
Coordinate Reference System:
User input: EPSG:4326
wkt:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]
while the PROJ 6.3.0 version is slightly different:
Coordinate Reference System:
User input: EPSG:4326
wkt:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
USAGE[
SCOPE["unknown"],
AREA["World"],
BBOX[-90,-180,90,180]],
ID["EPSG",4326]]
This creates all sort of inconveniences as the st_crs(x) == st_crs(y) is not TRUE
check is prone to fail for an object imported from a different PROJ environment.
Is there a way to serve CRS in a way that would be interpreted reliably the same? I am wary of reprojecting everything due to performance reasons.