Skip to contents

This function geocodes unique locations, either by reading from an existing file or by performing geocoding and saving the results to a file.

Usage

geocode_cities(geocoded_file_path, unique_locations)

Arguments

geocoded_file_path

A string specifying the file path for geocoded cities data.

unique_locations

A data frame containing unique locations to be geocoded.

Value

A data frame with geocoded city information.

Examples

geocoded_file_path <- "path/to/geocoded_cities.csv"
unique_locations <- data.frame(
  location = c("New York, USA", "London, UK", "Paris, France")
)
geocoded_cities <- geocode_cities(geocoded_file_path, unique_locations)
#> Passing 3 addresses to the Nominatim single address geocoder
#> Query completed in: 1.8 seconds
#> Error: Cannot open file for writing:
#> * 'path/to/geocoded_cities.csv'