Skip to contents

Returns "inside", "outside", or "boundary" for each pair.

Usage

ga_coordinate_position(geometry, point)

Arguments

geometry

a GeoArrow geometry array

point

a GeoArrow point array; length 1 or the same length as geometry

Value

a string array of the same length as geometry

Details

This is the three way form of a point in polygon test, distinguishing a point that lies exactly on an edge from one strictly inside. point is recycled against geometry. A null geometry or a null point gives NA.

References

CoordinatePosition

Examples

ring <- rbind(c(0, 0), c(4, 0), c(4, 4), c(0, 4), c(0, 0))
square <- sf::st_polygon(list(ring))
g <- geoarrow::as_geoarrow_array(sf::st_sfc(square, square, square))

# inside, on the edge, and outside
p <- ga_xy(c(2, 0, 9), c(2, 2, 9))
as.vector(ga_coordinate_position(g, p))
#> [1] "inside"   "boundary" "outside"