Skip to contents

This function takes latitude and longitude values and returns the corresponding municipality, province, and full country name (Darwin Core standard) using OpenStreetMap (OSM) for reverse geocoding.

Usage

extract_location_info(data, latitude = "latitude", longitude = "longitude")

Arguments

data

A data frame containing the latitude and longitude columns.

latitude

Name of the column for latitude in the data frame (as a string). Default is "latitude".

longitude

Name of the column for longitude in the data frame (as a string). Default is "longitude".

Value

A data frame with additional columns for municipality, province, and country, preserving the original rows.

Examples

if (FALSE) { # \dontrun{
points <- data.frame(
  decimalLatitude = c(48.2082, 44.7866, 48.2082),
  decimalLongitude = c(16.3738, 20.4489, 16.3738)
)
results <- extract_location_info(points, latitude = "decimalLatitude", longitude = "decimalLongitude")
print(results)
} # }