Extracts highest posterior density (HPD) uncertainty regions from a BEAST continuous phylogeographic analysis. Each node may have multiple HPD polygons representing the spatial uncertainty of its location estimate.
build_hpd(
treedata,
level = "0.80",
lon = "location1",
lat = "location2",
height = "height_median",
most_recent_sample = NULL,
debug = getOption("ggphylogeo.debug", FALSE)
)treedata object with phylogeographic annotations from
treeio::read.beast()
character HPD level to use (e.g. "0.80" for 80% HPD)
name of longitude coordinate column prefix (default: "location1")
name of latitude coordinate column prefix (default: "location2")
column name for node ages (default: "height_median")
Date, numeric year, or "YYYY-MM-DD" string for calibrating ages to real dates. If NULL, ages remain as numeric heights.
logical; emit debug messages
A data.frame with columns: node, polygon, lon, lat, age, group; or NULL if no valid HPD polygons found.