Learn R Programming

ggmap (version 3.0.0)

geocode: Geocode

Description

Geocodes (finds latitude and longitude of) a location using the Google Geocoding API. Note: To use Google's Geocoding API, you must first enable the API in the Google Cloud Platform Console. See ?register_google.

Usage

geocode(location, output = c("latlon", "latlona", "more", "all"),
  source = c("google", "dsk"), force = ifelse(source == "dsk", FALSE,
  TRUE), urlonly = FALSE, override_limit = FALSE,
  nameType = c("long", "short"), ext = "com", inject = "", ...)

mutate_geocode(data, location, ...)

geocodeQueryCheck()

Value

If output is "latlon", "latlona", or "more", a tibble (classed data frame). If "all", a list.

Arguments

location

a character vector of street addresses or place names (e.g. "1600 pennsylvania avenue, washington dc" or "Baylor University")

output

amount of output, "latlon", "latlona", "more", or "all"

source

"google" for Google (note: "dsk" is defunct)

force

force online query, even if cached (previously downloaded)

urlonly

return only the url?

override_limit

override the current query rate

nameType

in some cases, Google returns both a long name and a short name. this parameter allows the user to specify which to grab.

ext

top level domain (e.g. "com", "co.nz"); helpful for non-US users

inject

character string to add to the url or named character vector of key-value pairs to be injected (e.g. c("a" = "b") get converted to "a=b" and appended to the query)

...

...

data

a data frame or equivalent

Author

David Kahle david.kahle@gmail.com

See Also