Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

explode

Explodes multipart features


Description

Explodes multipart features into single part

Usage

explode(x, sp = FALSE)

Arguments

x

sp or sf multipart (MULTIPOLYGON, MULTIPOINT, MULTILINE) object

sp

(FALSE/TRUE) output as sp class object, else is sf class

Value

A single part sp or sf object (polygons or points)

Note

Multipart geometries are a data structure where a single attribute shares multiple features (polygons, points, lines). This function dissaggregates the data into a one-to-one match.

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

library(sf)
library(sp)

dim( p.sf <- st_read(system.file("shapes/sids.shp", package = "spData")[1]) )
dim( p.sf <- explode(p.sf) )

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.