> 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 transformation. For example, if I define something like library(sf) pt <- st_sfc(st_point(c(1500000, 5000000)), crs = 3003) # some place in North Italy st_crs(3003) # units are expressed in metres can I use st_transform to convert the unit measurement of pt from metres to km and preserve that information in the CRS? Thanks Andrea Il giorno mer 25 gen 2023 alle ore 18:58 Edzer Pebesma <edzer.pebe...@uni-muenster.de> ha scritto: > > > > On 25/01/2023 18:42, Josiah Parry wrote: > > I wonder if `units::set_units()` is a better fit for the job > > https://r-quantities.github.io/units/articles/measurement_units_in_R.html > > It could definitely tell you which number to choose when going from, > say, US feet to km. Coordinates in sf geometries are not stored as units > objects, unit info is encoded in the CRS. st_transform can do > transformations and conversions between different CRSs, unit conversions > is a special case of that. > > > > > On Wed, Jan 25, 2023 at 12:37 PM Steve Gutreuter <sgutreu...@gmail.com> > > wrote: > > > >> Is it safe to re-scale sf geometry coordinates from meters to > >> kilometers using, for example: > >> > >> sfobj$geometry <- sfobj$geometry / 1000 > >> > >> It seems to work, but I understand too little about spatial data to > >> know whether that practice is actually safe. I am working with spatial > >> data in a continental-scale equidistant conic projection, and the units > >> are meters. It seems that kilometers would be better suited stochastic > >> partial differential equation modeling on a finite-element mesh, but > >> maybe that is a moot point. > >> > >> Any and all advice will be much appreciated. > >> > >> Thanks! > >> -- > >> Steve Gutreuter > >> > >> [[alternative HTML version deleted]] > >> > >> _______________________________________________ > >> R-sig-Geo mailing list > >> R-sig-Geo@r-project.org > >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo > >> > > > > [[alternative HTML version deleted]] > > > > _______________________________________________ > > R-sig-Geo mailing list > > R-sig-Geo@r-project.org > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > -- > Edzer Pebesma > Institute for Geoinformatics > Heisenbergstrasse 2, 48151 Muenster, Germany > Phone: +49 251 8333081 > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo