-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New representation of crs objects #1225
Comments
My plan is to merge this into branch |
This looks like a great idea @edzer. What would be the best approach for data packages such as |
Thanks Andy! In the end I guess yes; a more flexible solution that may work with both old and new |
I agree; packages with canned data can revise defensively in sf and sp workflows by re-creating the crs/CRS on load. Please explore how this might be done, it'll be very useful in giving other packages in the same position a working example. I'm unsure how to add an R command to a straight |
Oh that's a more flexible idea... thanks! |
Implemented in |
Branch |
TL;DR:
crs
objects with two fields:input
for user input / short description, andwkt
for communicating to/from GDALCurrently,
crs
objects have two fields:epsg
(integer) andproj4string
(character). Branchwkt2
added a third,wkt2
(character) with the WKT-2 representation. This tries to merge the PROJ.4 world view. where CRS are expressed as proj4strings, and the PROJ ( >= 6) world, where proj4strings are considered legacy (if not to be deprecated). As expected, this turned out to be very messy; see #1146.Spawning from branch wkt2, I created a branch
SetFromUserInput
which rethinkscrs
objects. In short, in this branchcrs
objects have twocharacter
fields:input
: the string with which the object was initialised by the user, or the string that characterizes the CRS briefly when an object was read through GDAL; it is meant to be the human-readable version of the CRS (as opposed to WKT).wkt
: the wkt (or wkt2 in GDAL3/PROJ6) description of the CRS, which is meant to be communicate the entire CRS to and from GDALOnly
input
is ever to be set by users, e.g. as in(where 4326 is converted to
EPSG:4326
) and input is passed on to OGRSpatialReference::SetFromUserInput. This means that not only proj4strings and EPSG IDs can be input, but also WKT(2), OGC urns, PROJJSON and even non-EPSG CRS's (in total 10 formats), e.g.:This broadens the scope of
crs
objects in terms of interoperability, can also work with GDAL 2, and allows everyone to move away from proj4strings on their own pace. For convenience, the$
method forcrs
objects does a bit more than extracinginput
orwkt
, but can generate some fields that help backward compatibility:What messes up backward compatibility to reverse dependencies is stored legacy objects, e.g. in package
tmap
, and possibly data packages such asbcmaps
. E.g.These should ideally have been generated at package load rather than stored, to be robust against changes like this. I might be able to do an auto-conversion + warning for backward compatibility in packages that I control and that use them (sf, lwgeom).
This is related to #1033, #1146 and #1187.
The text was updated successfully, but these errors were encountered: