Check whether a place is a valid place or misspelling by matching against the
Google Geocoding search result. 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 long string. Then the
function pulls the
formatted_address endpoint of the API results and then
identifies and extracts the long name field from the API locality result
and compare it against the input to see if the input and output match up.
Note that you will need to pass in your Google Maps Place API key to the
A string of city name to be submitted to the Geocode API.
Optional. The state associated with the
Optional. Supply a string of ZIP code to increase precision.
A character string to be passed into
logical; Should the function return a single row tibble containing the original data sent and the multiple components returned by the Geocode API.
A logical value by default. If the city returned by the API
comes back the same as the city input, the function will evaluate to
TRUE, in all other circumstances (including API errors)
FALSE is returned.
If the the
guess argument is set to
TRUE, a tibble with 1 row and six
columns is returned:
city value sent to the API.
state value sent to the API.
zip value sent to the API.
check_city_flag: logical; whether the guessed city matches.
guess_city: The legal city guessed by the API.
guess_place: The generic locality guessed by the API.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.