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

ga_dimension() returns NA for an empty geometry, which has no dimension, rather than a point's 0. ga_boundary_dimension() gives the dimension of the geometry's boundary instead, so it returns 1 for a polygon and NA for a point.

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