You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recent issue #3653 prompted me to think a little deeper about mixing sf and non-sf layers. Currently, we can mix these layers if the non-sf layers are properly projected.
It would be great (and make life easier in many ways) if non-sf layers could also be transformed by coord_sf(). However, this poses a problem: The sf layers carry information about their crs, and therefore coord_sf() can figure out if and how they should be transformed. The non-sf layers don't carry that information, and thus whatever coord_sf() does will be wrong in some cases. We could add a crs argument to all layers, but that seems ugly since it breaks orthogonality between different parts of the API.
The recent shader experiments by @thomasp85 got me thinking that maybe the right approach is to modify layers, as he does there. What if we added a with_sf() function that can take any ordinary layer and turn it into one whose coordinates get transformed by coord_sf()? The API would be something like this:
Another, perhaps simpler approach to implement could be simply to enable a default crs that is picked up by coord_sf() when it can't figure out what the crs should be. There are two ways I could see:
options(default.crs=4326) which could then be picked up on by coord_sf()
Supply the default instead to coord_sf() as an argument e.g.
coord_sf(default.crs=4326,crs=2264)
I think the second option is probably the more transparent of the two to the user... It doesn't let you do layer-by-layer specification of crs, but if you wanted to do that, you should probably be feeding in sf objects...
The recent issue #3653 prompted me to think a little deeper about mixing sf and non-sf layers. Currently, we can mix these layers if the non-sf layers are properly projected.
Created on 2019-12-04 by the reprex package (v0.3.0)
It would be great (and make life easier in many ways) if non-sf layers could also be transformed by
coord_sf()
. However, this poses a problem: The sf layers carry information about their crs, and thereforecoord_sf()
can figure out if and how they should be transformed. The non-sf layers don't carry that information, and thus whatevercoord_sf()
does will be wrong in some cases. We could add acrs
argument to all layers, but that seems ugly since it breaks orthogonality between different parts of the API.The recent shader experiments by @thomasp85 got me thinking that maybe the right approach is to modify layers, as he does there. What if we added a
with_sf()
function that can take any ordinary layer and turn it into one whose coordinates get transformed bycoord_sf()
? The API would be something like this:We could also enable the following:
The text was updated successfully, but these errors were encountered: