| ms_explode {rmapshaper} | R Documentation | 
Convert multipart lines or polygons to singlepart
Description
For objects of class Spatial (e.g., SpatialPolygonsDataFrame),
you may find it faster to use sp::disaggregate.
Usage
ms_explode(input, ...)
Arguments
| input | One of:
 
 geo_jsonorcharactermultipart lines, or polygons;
 multipart SpatialPolygons,SpatialLines; sforsfcmultipart lines, or polygons object
 | 
| ... | Arguments passed on to apply_mapshaper_commands 
force_FCshould the output be forced to be a FeatureCollection (or sf object or
Spatial*DataFrame) even if there are no attributes? Default TRUE. If FALSE and
there are no attributes associated with the geometries, a
GeometryCollection (or Spatial object with no dataframe, or sfc) will be output.sysShould the system mapshaper be used instead of the bundled mapshaper? Gives
better performance on large files. Requires the mapshaper node package to be installed
and on the PATH.sys_memHow much memory (in GB) should be allocated if using the system
mapshaper (sys = TRUE)? Default 8. Ignored ifsys = FALSE.
This can also be set globally with the option"mapshaper.sys_mem"quietIf sys = TRUE, should the mapshaper messages be silenced? DefaultFALSE.
This can also be set globally with the option"mapshaper.sys_quiet" | 
Details
There is currently no method for SpatialMultiPoints
Value
same class as input
Examples
library(geojsonsf)
library(sf)
poly <- "{\"type\":\"FeatureCollection\",\"features\":
          [\n{\"type\":\"Feature\",\"geometry\":{\"type\":
          \"MultiPolygon\",\"coordinates\":[[[[102,2],[102,3],
          [103,3],[103,2],[102,2]]],[[[100,0],[100,1],[101,1],
          [101,0],[100,0]]]]},\"properties\":{\"a\":0}}\n]}"
poly <- geojson_sf(poly)
plot(poly)
length(poly)
poly
# Explode the polygon
out <- ms_explode(poly)
plot(out)
length(out)
out
[Package 
rmapshaper version 0.5.0 
Index]