geocode_city: Get longitude and latitude of cities

View source: R/geocode.R

geocode_cityR Documentation

Get longitude and latitude of cities

Description

Get longitude and latitude of cities

Usage

geocode_city(sheet, existing = NULL, geocode_method = c("OSM", "Google"))

Arguments

sheet

A data frame with columns "city", "state/province", and "country".

existing

A data frame with earlier output of this function, so only cities not already in the collection are geocoded.

geocode_method

Which geocoding service to use. Must be either "OSM" (OpenStreetMap) or "Google". If "Google", then an API key must be provided in environment variable 'GGMAP_GOOGLE_API_KEY'.

Value

A data frame like the internal data 'lcm_city_gc', with columns "city", "city2" (city name is concatenated to state and country in case multiple cities around the world have the same name), "state/province", "country", and "geometry" (sfc_POINT for the longitudes and latitudes).


pachterlab/museumst documentation built on April 20, 2024, 11:26 p.m.