Skip to contents

Returns one coordinate per row. Each function returns NA for any geometry that is not a single point, and for any null or empty point.

Usage

ga_x(geometry)

ga_y(geometry)

Arguments

geometry

a GeoArrow point array

Value

a double array of the same length as geometry

Details

Both functions accept either coordinate encoding and return the same values whether the point array holds a struct of two double columns or interleaved values.

Use ga_coords() for the vertices of a line or polygon, which returns a multipoint per row rather than a single number.

See also

Examples

pts <- ga_point(c(-111.76, -112.07), c(34.87, 33.45))

as.vector(ga_x(pts))
#> [1] -111.76 -112.07
as.vector(ga_y(pts))
#> [1] 34.87 33.45