Split lines or polygons to separate segments.
SpatialLines object where each segment is represented by a separate feature
This function uses a modified version of code from the following 'r-sig-geo' post by Roger Bivand: https://stat.ethz.ch/pipermail/r-sig-geo/2013-April/017998.html
1 2 3 4 5 6 7 8
seg = toSeg(build[1, ]) plot(seg, col = sample(rainbow(length(seg)))) raster::text(rgeos::gCentroid(seg, byid = TRUE), 1:length(seg)) # Other data structures toSeg(geometry(build)) # SpatialPolygons toSeg(boston_sidewalk) # SpatialLinesDataFrame toSeg(geometry(boston_sidewalk)) # SpatialLinesDataFrame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.