R/generics.R
, R/SpatialPolygons2PolySet.R
SpatialPolygons2PolySet.Rd
This function converts spatial sp::SpatialPolygons()
and
sp::SpatialPolygonsDataFrame()
objects to
PBSmapping::PolySet()
objects.
SpatialPolygons2PolySet(x, n_preallocate) # S3 method for SpatialPolygonsDataFrame SpatialPolygons2PolySet(x, n_preallocate = 10000L) # S3 method for SpatialPolygons SpatialPolygons2PolySet(x, n_preallocate = 10000L)
x 


n_preallocate 

PBSmapping::PolySet()
object.
Be aware that this function is designed to be as fast as possible, but as a result it depends on C++ code and if used inappropriately this function will crash R.
For a slower, more stable equivalent see
maptools::SpatialPolygons2PolySet
.
# generate SpatialPolygons object sim_pus < sim.pus(225L) # convert to PolySet x < SpatialPolygons2PolySet(sim_pus)