Learn R Programming

placement (version 0.1.1)

pull_geo_data: Pull Google Maps data with error handling

Description

This function, primarily, is a helper for drive_time and geocode_url. It attempts to pull Google Maps data for a complete URL, recording http errors/connection failures within the status and error_message paramaters. To debug invalid signature requests, refer to the Google Developer documention.

Usage

pull_geo_data(urls_out, tmout = 10, messages = TRUE)

Arguments

urls_out
character string; a complete URL with valid character encoding.
tmout
number; the length of time, in seconds, to wait for a valid server response before triggering a connection timeout error (defaults to 10 seconds).
messages
logical; when TRUE, displays message from the API call(s). Generally, this parameter is passed from drive_time or geocode_url.

Value

A list with validly formatted JSON objects whose length equals urls_out

Examples

Run this code
## Not run: 
# # Fetch URLs contained within character vector "togoogle", waiting 20 seconds
# # before triggering a server timeout error.
# output <- pull_geo_data(togoogle, tmout=20)
# ## End(Not run)

Run the code above in your browser using DataLab