Skip to contents

Explode geometry to manipulate constituent elements.

Usage

st_explode(x)

Arguments

x

an sf object with LINESTRING geometries.

Value

An sf object with LINESTRING geometries with each line segment in a separate row.

Examples

exploded_geom <- st_explode(bangalore_highways)
exploded_geom
#> Simple feature collection with 1903 features and 2 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 77.5771 ymin: 12.95439 xmax: 77.59503 ymax: 12.97567
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>      osm_id     highway                       geometry
#> 1   8687347 residential LINESTRING (77.58983 12.960...
#> 2   8687347 residential LINESTRING (77.58971 12.960...
#> 3  22893740     primary LINESTRING (77.58761 12.967...
#> 4  22893740     primary LINESTRING (77.58771 12.967...
#> 5  22893740     primary LINESTRING (77.58788 12.967...
#> 6  22893740     primary LINESTRING (77.58812 12.967...
#> 7  23076921   secondary LINESTRING (77.58399 12.963...
#> 8  23076921   secondary LINESTRING (77.584 12.96395...
#> 9  23076921   secondary LINESTRING (77.58406 12.964...
#> 10 23076921   secondary LINESTRING (77.58407 12.964...