Learn R Programming

sf (version 0.5-3)

as_Spatial: Methods to coerce simple feature objects to Spatial* objects

Description

Methods to coerce simple feature objects to Spatial* objects

Usage

as_Spatial(from, cast = TRUE, IDs = paste0("ID", 1:length(from)))

Arguments

from

object of class sfc_POINT, sfc_MULTIPOINT, sfc_LINESTRING, sfc_MULTILINESTRING, sfc_POLYGON, or sfc_MULTIPOLYGON.

cast

logical; if TRUE, st_cast from before converting, so that e.g. GEOMETRY objects with a mix of POLYGON and MULTIPOLYGON are cast to MULTIPOLYGON.

IDs

character vector with IDs for the Spatial* geometries

Value

geometry-only object deriving from Spatial, of the appropriate class