Skip to contents

Returns one multilinestring per input geometry, whose parts are that geometry's two point segments. ga_lines() keeps the input's length.

Usage

ga_lines(geometry)

Arguments

geometry

a GeoArrow geometry array

Value

a GeoArrow multilinestring array of the same length as geometry

Details

For a polygon, ga_lines() returns the segments of every ring, including interior rings. It returns a null element for a point, which has no segments, and for a null geometry.

References

LinesIter

See also

Other iteration: ga_coords(), ga_n_coords(), ga_x()

Examples

ring <- matrix(c(0, 0, 2, 0, 2, 2, 0, 2, 0, 0), ncol = 2, byrow = TRUE)
g <- geoarrow::as_geoarrow_array(sf::st_sfc(sf::st_polygon(list(ring))))

lengths(sf::st_as_sfc(geoarrow::as_geoarrow_vctr(ga_lines(g))))
#> [1] 4