Convert polygons to topological boundaries (lines)
Convert polygons to topological boundaries (lines)
ms_lines(input, fields = NULL, force_FC = TRUE, sys = FALSE)
input |
input polygons object to convert to inner lines. One of:
|
fields |
character vector of field names. If left as |
force_FC |
should the output be forced to be a |
sys |
Should 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. |
topological boundaries as lines, in the same class as the input
library(geojsonio) library(sp) poly <- structure('{"type":"FeatureCollection", "features":[ {"type":"Feature", "properties":{"foo": "a"}, "geometry":{"type":"Polygon","coordinates":[[ [102,2],[102,3],[103,3],[103,2],[102,2] ]]}} ,{"type":"Feature", "properties":{"foo": "a"}, "geometry":{"type":"Polygon","coordinates":[[ [103,3],[104,3],[104,2],[103,2],[103,3] ]]}}, {"type":"Feature", "properties":{"foo": "b"}, "geometry":{"type":"Polygon","coordinates":[[ [102.5,1],[102.5,2],[103.5,2],[103.5,1],[102.5,1] ]]}}]}', class = c("json", "geo_json")) poly <- geojson_sp(poly) summary(poly) plot(poly) out <- ms_lines(poly) summary(out) plot(out)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.