
Perform a Spatial Join of Points with GADM Administrative Boundaries
spatial_join_gadm.RdThis function downloads GADM administrative boundary data for specified countries
and performs a spatial join to add administrative information to a dataset containing
geographic coordinates. Optionally, an sf object can be provided instead of downloading data.
Usage
spatial_join_gadm(
country_codes = c("AUT", "BIH", "BGR", "CHE", "CZE", "DEU", "HUN", "HRV", "MDA", "MNE",
"POL", "ROU", "SRB", "SVK", "SVN", "UKR"),
coords_df,
lat_col = "decimalLatitude",
lon_col = "decimalLongitude",
sf_gadm = NULL,
timeout = 600
)Arguments
- country_codes
A character vector of ISO3 country codes for which GADM data will be downloaded. Defaults to the countries in the Danube River Basin.
- coords_df
A data frame containing coordinates to spatially join with GADM administrative data. It must include columns for latitude and longitude.
- lat_col
The name of the column in
coords_dfcontaining latitude values. Defaults to "decimalLatitude".- lon_col
The name of the column in
coords_dfcontaining longitude values. Defaults to "decimalLongitude".- sf_gadm
Optional
sfobject containing GADM administrative boundaries. If provided, it is used directly for the spatial join. Defaults toNULL.- timeout
Timeout in seconds for downloads. Defaults to 600 (10 minutes).