Returns a point that always lies on the geometry, unlike ga_centroid(),
which can return a point outside a concave shape.
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.
See also
Other query:
ga_closest_point(),
ga_is_convex(),
ga_line_locate_point()
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)