Re: [R-sig-Geo] as.im in spatstat::ppm not working as before

2024-05-11 Thread Edzer Pebesma
On 11/05/2024 10:21, Roozbeh Valavi wrote: This might also help: the solution below will not raise the error if x has geographic (unprojected) coordinates, a case for which you should not use spatstat. library(spatstat) library(terra) .raster_to_im <- function(x){         r <-

Re: [R-sig-Geo] as.im in spatstat::ppm not working as before

2024-05-11 Thread Roozbeh Valavi
This might also help: library(spatstat) library(terra) .raster_to_im <- function(x){ r <- as.data.frame(x, xy = TRUE) im <- spatstat.geom::as.im(r) return(im) } # to generalise the spatstat.geom::as.im to SpatRaster and RasterLayer as.im.SpatRaster <- function(x){

Re: [R-sig-Geo] as.im in spatstat::ppm not working as before

2024-05-08 Thread Roger Bivand
as.im() was in maptools, which was retired last year. If you need to recreate old work, install maptools from source from the CRAN package archive https://cran.r-project.org/src/contrib/Archive/maptools/. For non-archival work, update the workflow. See also

Re: [R-sig-Geo] as.im in spatstat::ppm not working as before

2024-05-08 Thread Edzer Pebesma
r.grid.world.SGDF.F[[1]] is a numerical vector, not even a matrix, so clearly as.im.default doesn't know what it should do with it. Maybe there was once a method as.im for r.grid.world.SGDF.F, which is of class SpatialGridDataFrame, but no longer - software evolves. A way you could approach

[R-sig-Geo] as.im in spatstat::ppm not working as before

2024-05-07 Thread Alexandre Santos via R-sig-Geo
Dear Members, I'll calculate some old codes for a paper review, and I'm astonished that as.im() for fitting the Poisson model is not working as before. In my example: library(raster) library(spatstat) # Elevation r.grid.world <-