I came across a case where a user would rather reproject the points to match the CRS of a raster, rather than reprojecting a raster to match the CRS of the points.
I thought transform_coords() would work, but there is no S3 method for object of class random_points. Example:
In trying to coerce the object, I also found that the object of class random_points doesn't inherit the attributes from the track_xy*, for example, the CRS.
One solution would be to write transform_coords.random_points(), but I suspect that it might be more consistent to just set the class of the object returned by random_points() to c("random_points", "track_xy", "tbl_df", "tbl", "data.frame") and transfer the attributes (maybe just the CRS) from the track_xy* to the new object. This is consistent with random_steps() returning an object of class c("random_steps", "steps_xyt", "steps_xy", "tbl_df", "tbl", "data.frame").
I came across a case where a user would rather reproject the points to match the CRS of a raster, rather than reprojecting a raster to match the CRS of the points.
I thought
transform_coords()
would work, but there is no S3 method for object of classrandom_points
. Example:In trying to coerce the object, I also found that the object of class
random_points
doesn't inherit the attributes from thetrack_xy*
, for example, the CRS.One solution would be to write
transform_coords.random_points()
, but I suspect that it might be more consistent to just set the class of the object returned byrandom_points()
toc("random_points", "track_xy", "tbl_df", "tbl", "data.frame")
and transfer the attributes (maybe just the CRS) from thetrack_xy*
to the new object. This is consistent withrandom_steps()
returning an object of classc("random_steps", "steps_xyt", "steps_xy", "tbl_df", "tbl", "data.frame")
.Are there any downsides to this I'm not seeing?