This script combines individual transplant center buffers into unified, organ-level catchment areas.
Earlier steps created buffers (either distance-based or 60-minute travel-time isochrones) around each transplant center.
Here, those individual polygons are merged into a single combined service area for each organ, distance, and year.
---title: "Unite buffers"format: html---This script combines individual transplant center buffers into unified, organ-level catchment areas.Earlier steps created buffers (either distance-based or 60-minute travel-time isochrones) around each transplant center. Here, those individual polygons are merged into a **single combined service area** for each organ, distance, and year.::: {.Rcode title="Source code"}The full R script is available at:- [`R/unite_buffers.R`](https://github.com/VagishHemmige/HOPE-CDC-analysis-2026/blob/master/R/unite_buffers.R)The code sections below are imported directly from that script when this page is rendered.This R script file is itself reliant on the following helper files:- [`R/setup.R`](https://github.com/VagishHemmige/HOPE-CDC-analysis-2026/blob/master/R/setup.R)- [`R/functions.R`](https://github.com/VagishHemmige/HOPE-CDC-analysis-2026/blob/master/R/functions.R):::## Why “Unite” Buffers?When buffers are created around multiple centers, they often:- Overlap geographically - Cover adjacent regions - Share common areas If we simply summed tract populations within each individual buffer, overlapping areas would be **double-counted**.To prevent this, we:- Combine (union) all individual center buffers- Create a single, continuous polygon representing the **total catchment area**- Ensure that each geographic area is counted only once---## Objects CreatedFour parallel objects are constructed:- `Transplant_center_all_buffer_united`- `Transplant_centers_active_buffer_united`- `Transplant_centers_HIV_buffer_united`- `Transplant_centers_HOPE_buffer_united`Each object is indexed by:1. Organ 2. Distance 3. Year (when applicable)---## How the Union WorksFor each:- Organ- Distance- (And year, when relevant)The script:1. Takes the set of individual buffer polygons2. Applies `st_union(geometry)`3. Collapses them into one merged geometry4. Converts the result back into an [{sf}](https://r-spatial.github.io/sf/) objectThe resulting dataset contains a single row labeled:catchment_area = "All Centers"This label clarifies that the polygon represents the combined service area of all centers in that category.---## Structure of the ResultAfter processing, the structure is:- `Transplant_center_all_buffer_united[[organ]][[distance]]`- `Transplant_centers_active_buffer_united[[organ]][[distance]][[year]]`- `Transplant_centers_HIV_buffer_united[[organ]][[distance]][[year]]`- `Transplant_centers_HOPE_buffer_united[[organ]][[distance]][[year]]`Each object is a **single merged polygon** representing the total geographic coverage of that center group.---## Why This Step MattersUniting buffers allows accurate calculation of:- Total population within service areas- Total number of people living with HIV within reach- Changes in geographic access between years- Comparisons across center categories (Active vs HIV vs HOPE)Without uniting overlapping buffers, population totals would be inflated and geographic access overstated.---```{r}#| file: "../R/unite_buffers.R"#| eval: false```