sp_convert: Convert SpatialPolygons or SpatialPolygonDataFrames into WKT...

Description Usage Arguments Value See Also Examples

View source: R/sp_convert.R

Description

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

Usage

1

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 MULTIPOLYGONs - if FALSE, as a vector of POLYGONs.

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

1
2
3
4
5
6
## 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)

Example output

[1] "POLYGON((2 2,1 4,4 5,4 3,2 2))"

wicket documentation built on May 2, 2019, 11:11 a.m.