Computes the spherical distance (in kilometers) from each PRIO-GRID cell centroid to the border of the nearest land-contiguous neighboring country using CShapes 2.0 boundary data. This implies that cells in e.g. Northern Denmark are measured to the border to Germany even if the straight-line distance to Norway (across international waters) is shorter. Cells belonging to island states with no contiguous neighboring country (e.g., New Zealand) are coded as missing. Islands within states are still measured.
Usage
bdist1(measurement_date, cshp = read_cshapes(), past_result = NULL)Arguments
- measurement_date
A single
Dateobject specifying the date for boundary analysis. Must be within CShapes temporal coverage.- cshp
An
sfobject containing CShapes 2.0 boundary data. Defaults toread_cshapes()if not provided.- past_result
A list object from a previous
bdist1calculation. If boundaries haven't changed, the function returns this result directly, avoiding recomputation. Default is NULL.
Value
A list containing three elements:
bdist1: ASpatRasterwith distances (km) from cell centroids to nearest international borders, masked to state system coverageboundaries: Ansfobject with country boundary line geometries
Details
The function includes optimization logic that reuses previous calculations if country boundaries haven't changed since the last computation, significantly reducing processing time for temporal sequences.
Distance calculations use spherical geometry (S2) for accurate measurements across the globe, particularly important for high-latitude regions.
References
Schvitz G, Girardin L, Rüegger S, Weidmann NB, Cederman L, Gleditsch KS (2022). “Mapping the International System, 1886-2019: The CShapes 2.0 Dataset.” Journal of Conflict Resolution, 66(1), 144–161. ISSN 0022-0027, doi:10.1177/00220027211013563 , 2024-11-22.
Examples
if (FALSE) { # \dontrun{
# Calculate border distances for 2010
border_dist_2010 <- bdist1(as.Date("2010-01-01"))
} # }