I'm looking to intersect 2 spatial layers, keeping all the non-intersecting features as well.
My first layer is the SA2 from NSW, Australia, which look like
My second layer is the Areas of Regional Koala Significance (ARKS):
When I intersect them, I get part of my desired result, which is subdividing the SA2 by the ARKS.
The thing is that I'd like to have also the rest of the SA2 polygons that don't intersect. The desired result would be a map of the SA2, where the intersecting ones would be subdivided by where they intersect to the ARKS layer, and the ones that don't intersect would contain NA. Something like in the next picture but in a single dataset instead of two: enter image description here
I post my code below:
library(sf)
SA2 <- st_read('C:/Users/Maxi/Desktop/NSW Planning/Koala/Data/SA2_2021_GDA94/SA2_2021_AUST_GDA94.shp')
ARKS <- st_read('C:/Users/Maxi/Desktop/ARKS_data/ARKS_renamedv6_PriorityPopulations_GDA94geog.shp')
ARKS <- st_transform(ARKS, 3577)
SA2 <- st_transform(SA2, 3577)
SA2 <- SA2[SA2$STE_CODE21=='1',]
intersection <- st_intersection(SA2, ARKS)
The data can be obtained from:
ARKS: https://datasets.seed.nsw.gov.au/dataset/areas-of-regional-koala-significance-arks
Hope this is enough information!