R: Convert SpatialPolygons or SpatialPolygonDataFrames into WKT...

sp_convert {wicket} | R Documentation

## Convert SpatialPolygons or SpatialPolygonDataFrames into WKT objects

### Description

`sp_convert` turns objects from the `sp` package - specifically, SpatialPolygons and SpatialPolygonDataFrames - into WKT POLYGONs or MULTIPOLYGONs

### Usage

    sp_convert(x, group = TRUE)

### Arguments

`x` | a list of SP/SPDF objects (or a single object)
`group` | whether or not to group coordinates together in the case that an object in `x` has multiple sets of coordinates. If TRUE (the default), such objects will be returned as `MULTIPOLYGON`s - if FALSE, as a vector of `POLYGON`s.

### Value

either a character vector of WKT objects - one per sp object - if `group` is TRUE, or a list of vectors if `group` is FALSE.

### See Also

`bounding_wkt`, for turning bounding boxes within `sp` objects into WKT objects.

### Examples

    ## Not run:
    library(sp)
    s1 <- SpatialPolygons(list(Polygons(list(Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2)))), "s1")))
    sp_convert(s1)

    ## End(Not run)

[Package wicket version 0.4.0 Index]