I am trying to create a PPP in spatstat using my study area (a large polygon made up of individual polygons) from a shape file from GIS.
I have been following: Handling shapeles in the spatstat package Adrian Baddeley, Rolf Turner and Ege Rubak 2022-11-08 spatstat version 3.0-2
#load packages install.packages("spatstat") library(spatstat) install.packages("maptools") library(maptools) #will get warning message about rgdal instead, stick with maptools install.packages(sp) library(sp)
#import shapefile
UMshape1<-readShapeSpatial('F:/GIS/export_shape/Clipped_urban_matrix.shp')
#check class
class(UMshape1)
#returned: [1] "SpatialPolygonsDataFrame
#following code from guidance to convert Objects of class SpatialPolygonsDataFrame
UM1 <- as(UMshape1, "SpatialPolygons")
UM1regions <- slot(UM1, "polygons") UM1regions <- lapply(UM1regions, function(x) { SpatialPolygons(list(x)) }) UM1windows <- lapply(UM1regions, as.owin)
#checked class of each of these file types
class(UM1)
#"SpatialPolygons"
class(UM1regions)
#"list"
class(UM1windows)
"list"
#from guidance 'The result is a list of objects of class owin. Often it would make sense to convert this to a tessellation object, by typing':
#so I enter the code for my data
teUM1 <-tess(tiles = UM1windows)
This last command (tess) has now been running for 48 hours (red stop box). I did not created a progress bar.
Is this the right thing to do so that I can then created my owin study area? So that I can then create a PPP in spatstat?