spAsList {loon}R Documentation

Create a list of polygons or lines from a spatial data object from the sp package.

Description

spAsList is a helper function that should rarely be called directly by the user. It is an S3 generic function which takes the spatial data object and returns its components (polygons, lines, et cetera) in a list. Each element could itself be a list. Different S3 methods are implemented for various spatial data types.

Usage

spAsList(x)

Arguments

x

An sp spatial data object.

Value

A list of the relevant components of the spatial data object.

See Also

spunlist

Examples


## Not run: 
library(sp)
library(rworldmap)
world <- getMap(resolution = "coarse")
class(world)
isS4(world)
xy <- spAsList(world)

names(xy)
# because tree has same depth for every leaf unlist is ok
# This is not true otherwise.
uxy <- spunlist(xy)
unlist(xy, recursive=FALSE)
names(uxy)

# here, unlist would be wrong.

## End(Not run)


[Package loon version 1.4.3 Index]