fetch_city: Return Closest Match Result of Cities from Google Maps API

View source: R/fetch-city.R

fetch_cityR Documentation

Return Closest Match Result of Cities from Google Maps API

Description

Use the httr::GET() to send a request to the Google Maps API for geocoding information. The query will concatenate all the geographical information that is passed in into a single string. Then the function pulls the formatted_address endpoint of the API results and extracts the the first field of the result. Note that you will need to pass in your Google Maps Place API key with the key argument.

Usage

fetch_city(address = NULL, key = NULL)

Arguments

address

A vector of street addresses. Sent to the API as one string.

key

A character containing your alphanumeric Google Maps API key.

Value

A character vector of formatted address endpoints from Google. This will include all the fields from street address, city, state/province, zipcode/postal code to country/regions. NA_character_ is returned for all errored API calls.

See Also

https://developers.google.com/maps/documentation/geocoding/overview?csw=1

Other geographic normalization functions: abbrev_full(), abbrev_state(), check_city(), expand_abbrev(), expand_state(), normal_address(), normal_city(), normal_state(), normal_zip(), str_normal()


campfin documentation built on Oct. 20, 2023, 5:06 p.m.