Skip to contents

Returns one multipoint per input geometry, holding that geometry's vertices in order. Each function keeps the input's length.

Usage

ga_coords(geometry)

ga_exterior_coords(geometry)

Arguments

geometry

a GeoArrow geometry array

Value

a GeoArrow multipoint array of the same length as geometry

Details

ga_exterior_coords() skips the interior rings of a polygon, so it gives the outline only. Both preserve the coordinates' storage order, so they keep a closed ring's repeated first vertex at the end.

Each function returns null for a null geometry.

References

CoordsIter

See also

Other iteration: ga_lines(), 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))))

sf::st_as_sfc(geoarrow::as_geoarrow_vctr(ga_coords(g)))
#> Geometry set for 1 feature 
#> Geometry type: MULTIPOINT
#> Dimension:     XY
#> Bounding box:  xmin: 0 ymin: 0 xmax: 2 ymax: 2
#> CRS:           NA
#> MULTIPOINT ((0 0), (2 0), (2 2), (0 2), (0 0))
as.vector(ga_n_coords(g))
#> [1] 5