0

I used st_join() to combine t1 and t2.

library(sf)
j <- st_join(
  x = t1,
  y = t2
)

t1 represents voting precincts boundaries and t2, school zone boundaries. In some cases, the boundaries of t1 fit perfectly in one school zone but because the borders touch two other zones, st_join lines up a precinct with three zones.

How can I make st_join stricter so that if a precinct in t1 is mostly or seemingly entirely within a zone boundary of t2, the precinct lines up with only that zone, no others?

2
  • Hi! I think you may want to check ?sf::st_relate and DE-9IM. Moreover, can you share an example for t1 and t2?
    – agila
    Commented Nov 12, 2020 at 9:36
  • 1
    You could merge them with st_intersection, compute the respective area size with st_area, and then select the combinations above a certain area size. If e.g. less than one percent of a voting precinct's area intersects with a certain school zone, you drop that combination.
    – user
    Commented Nov 16, 2020 at 18:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.