Problems with randomPolygons()

16 views
Skip to first unread message

Tati Micheletti

unread,
Apr 25, 2018, 6:57:37 PM4/25/18
to SpaDES Users
Hi SpaDERS,

I am having problems with randomPolygons(). I have a raster that I want to use as a "template", but it is not working. I am attaching a reproducible example:

library(SpaDES)

resolution <- sqrt(pi*10^4)
ext <- c(0, 1000, 0, 1000)
ext2 <- c(-682368.7,-484031.2,7512969.0,7686846.7)


ras1 <- randomPolygons(ras = raster(extent(0, 1000, 0, 1000), res = resolution, vals = 0), numTypes = 8) # WORKING
ras2 <- randomPolygons(ras = raster(extent(ext), res = resolution, vals = 0), numTypes = 8) # NOT WORK
ras3 <- randomPolygons(ras = raster(extent(ext2), res = resolution, vals = 0), numTypes = 8) # NOT WORKING
ras4 <- randomPolygons(ras = raster(extent(-682368.7,-484031.2,7512969.0,7686846.7), res = resolution, vals = 0), numTypes = 8) #NOT WORKING

Plot(ras1)
Plot(ras2)
Plot(ras3)
Plot(ras4)

Any thoughts?
Reply all
Reply to author
Forward
0 new messages