s2_contains(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)")
)
s2_within(
c("POINT (5 5)", "POINT (-1 1)"),
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"
)
s2_covered_by(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)")
)
s2_covers(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)")
)
s2_disjoint(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)")
)
s2_intersects(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)")
)
s2_equals(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
"POLYGON ((10 0, 10 10, 0 10, 0 0, 10 0))",
"POLYGON ((-1 -1, 10 0, 10 10, 0 10, -1 -1))"
)
)
s2_intersects(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)")
)
s2_intersects_box(
c("POINT (5 5)", "POINT (-1 1)"),
0, 0, 10, 10
)
s2_touches(
"POLYGON ((0 0, 0 1, 1 1, 0 0))",
c("POINT (0 0)", "POINT (0.5 0.75)", "POINT (0 0.5)")
)
s2_dwithin(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)"),
0 # distance in meters
)
s2_dwithin(
"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))",
c("POINT (5 5)", "POINT (-1 1)"),
1e6 # distance in meters
)
Run the code above in your browser using DataLab