Skip to contents

Returns a point that always lies on the geometry, unlike ga_centroid(), which can return a point outside a concave shape.

Usage

ga_interior_point(geometry)

Arguments

geometry

a GeoArrow geometry array

Value

a GeoArrow point array of the same length as geometry

Details

For a polygon, ga_interior_point() picks a point on the interior from the horizontal line closest to the centroid. It returns a null element for an empty or null geometry.

References

InteriorPoint

Examples

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

sf::st_as_sfc(geoarrow::as_geoarrow_vctr(ga_interior_point(g)))
#> Geometry set for 1 feature 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 2 ymin: 2 xmax: 2 ymax: 2
#> CRS:           NA
#> POINT (2 2)