I used st_join() to combine t1 and t2.

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?

  • 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 Nov 12 '20 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. – Chr Nov 16 '20 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.