sf icon indicating copy to clipboard operation
sf copied to clipboard

Feature Request: Esri Identity Equivalent

Open Bevann opened this issue 3 years ago • 0 comments

A frequent spatial operation I use in my work is updating existing polygons with the boundaries and attributes of overlapping polygons, as is achieved with the Arc Gis function "identity" I can achieve this using a combination of st_instersection and st_difference :

arc.ident <- function(layer_a, layer_b){
  int_a_b <- st_intersection(layer_a, layer_b)
  rest_of_a <- st_difference(layer_a, st_union(layer_b))
  output <- bind_rows(int_a_b, rest_of_a)
  return(st_as_sf(output))
}

however this seems as though it could be made more efficient if "breaking up" of the geometry of the two layers was not performed multiple times. This is not a big deal for small data sets, but the extra time to process can be significant in larger datsets.

Bevann avatar Jun 16 '22 17:06 Bevann