Skip to contents

Returns 0 for points, 1 for lines and curves, and 2 for surfaces.

Usage

ga_dimension(geometry)

ga_boundary_dimension(geometry)

Arguments

geometry

a GeoArrow geometry array

Value

an integer array of the same length as geometry

Details

An empty geometry has no dimension and gives NA, which is distinct from a point's 0. ga_boundary_dimension() gives the dimension of the geometry's boundary instead, so a polygon is 1 and a point is NA.

References

HasDimensions

Examples

g <- geoarrow::as_geoarrow_array(sf::st_sfc(
  sf::st_point(c(0, 0)),
  sf::st_linestring(cbind(c(0, 1), c(0, 1)))
))

as.vector(ga_dimension(g))
#> [1] 0 1