Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Andrea Gilardi
> st_transform can do transformations and conversions between different CRSs, > unit conversions is a special case of that. Dear all, I'm sorry if this is a trivial or stupid question but I was wondering if you could provide an example of using st_transform to apply a unit conversion transformat

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Edzer Pebesma
On 31/01/2023 12:12, Andrea Gilardi wrote: st_transform can do transformations and conversions between different CRSs, unit conversions is a special case of that. Dear all, I'm sorry if this is a trivial or stupid question but I was wondering if you could provide an example of using st_tr

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Andrea Gilardi
Thank you very much for your example! I briefly checked the examples reported in ?st_transform and the docs at the PROJ website around "Unit conversion" (https://proj.org/operations/conversions/unitconvert.html) and I found that the following code also seems to work (although with a warning message

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Josiah Parry
While the package interface isn't the friendliest, I think the crsuggest package may be of interest for you. It's helpful for finding an appropriate CRS in the units you need given an input CRS. https://github.com/walkerke/crsuggest I've used this to find an appropriate CRS and then transform bas

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Edzer Pebesma
Yes, the pipeline approach bypasses GDAL, and doesn't result in an object with an appropriate CRS as a consequence. On 31/01/2023 14:47, Andrea Gilardi wrote: Thank you very much for your example! I briefly checked the examples reported in ?st_transform and the docs at the PROJ website around "

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Andrea Gilardi
Thanks again to both of you for the suggestion and the explanation. Kind regards Andrea Il giorno mar 31 gen 2023 alle ore 15:28 Edzer Pebesma ha scritto: > > Yes, the pipeline approach bypasses GDAL, and doesn't result in an > object with an appropriate CRS as a consequence. > > On 31/01/2023 1

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Roger Bivand
On Tue, 31 Jan 2023, Andrea Gilardi wrote: Thanks again to both of you for the suggestion and the explanation. Using: meuse1 <- st_as_sf(meuse) meuse2 <- st_transform(meuse1, sub("units=m", "units=km", st_crs(meuse1)$proj4string)) gives st_crs(meuse2) Coordinate Reference System: User

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Andrea Gilardi
Thanks, Roger. That's not a common problem (at least for me), but it is typically useful to adjust the unit of measurement when I need to integrate sf objects with other packages (e.g. spatstat) where the numerical algorithm might benefit from rescaling. Andrea Il giorno mar 31 gen 2023 alle ore

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Steve Gutreuter
The need to re-scale the measurement units of the coordinates may not be commonplace, but it is also not unreasonable. So, given that R rgdal is to be retired in 2023, what is the "correct" way to preserve the new units and the datum? Thanks to all,Steve On Tue, 2023-01-31 at 18:36 +0100, Andrea G

Re: [R-sig-Geo] Re-scale units of coordinates in sf geometry?

2023-01-31 Thread Roger Bivand
On Tue, 31 Jan 2023, Steve Gutreuter wrote: The need to re-scale the measurement units of the coordinates may not be commonplace, but it is also not unreasonable. So, given that R rgdal is to be retired in 2023, what is the "correct" way to preserve the new units and the datum? Sorry, there is