I've been testing the waters and doing some basic overview on the statspat package. This is a complex package and would likely require some serious effort to jump in and then get familiar with the package.
This package seems to have some great features - including drawing a radial line from a given point at some defined angle. This feature saves the effort from doing the math to accomplish the same task. And it accomplishes the task with a simple line of code that is intuitive and very readable.
plot(0, xlim=c(0,5), ylim=c(0,5), main=" radial & sp ", xlab="", ylab="", type="n") draw.radial.line(0, 2, center=c(3,3), angle=90) # create spatstat object # create spatial linestring object and combine with the plot: p1 <- c(3,2) p2 <- c(3,4) mypt <- matrix(data = c(p1, p2), nrow = 2, ncol = 2, byrow = T) mypt.sf <- st_linestring(mypt, dim = "XY") mypt.sf plot(mypt.sf, add = TRUE)
The spatial linesting object and the radial line object both plot nicely together.
But since these two lines are different types of objects, the st_intersects() and other similar functions don't recognize the radial line. Even though these object plot together, it looks like these objects won't play together well.
The spatstat package has many features that convert spatial objects to spatstat objects, but there doesn't seem to be any similar features for converting spatstat objects back to sp objects. I looked around and haven't found any way to convert spatstat objects to sp objects.
So this question boils down to asking whether there is a way to convert a spatstat objects to spatial or simple feature object? Or is there another package that provides some simple functions similar to the spatstat, draw.radial.line() function ? And if so, do these objects convert back and forth and play well with sp or sf objects?
Link to plot link