Description Usage Arguments Value See Also Examples
Geocodes addresses given as character values. The geocode
function utilizes this function on addresses contained in dataframes.
See example usage in vignette("tidygeocoder")
.
Note that not all geocoding services support certain address component parameters. For example, the Census geocoder only covers the United States and does not have a "country" parameter.
Refer to api_parameter_reference, min_time_reference, and batch_limit_reference for more details on geocoding service parameters and usage.
This function uses the get_api_query, query_api, and extract_results functions to create, execute, and parse geocoder API queries.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | geo(
address = NULL,
street = NULL,
city = NULL,
county = NULL,
state = NULL,
postalcode = NULL,
country = NULL,
method = "osm",
cascade_order = c("census", "osm"),
lat = "lat",
long = "long",
limit = 1,
full_results = FALSE,
mode = "",
unique_only = FALSE,
return_addresses = TRUE,
min_time = NULL,
progress_bar = show_progress_bar(),
quiet = getOption("tidygeocoder.quiet", FALSE),
api_url = NULL,
timeout = 20,
flatten = TRUE,
batch_limit = NULL,
batch_limit_error = TRUE,
verbose = getOption("tidygeocoder.verbose", FALSE),
no_query = FALSE,
custom_query = list(),
api_options = list(),
return_type = "locations",
iq_region = "us",
geocodio_v = 1.6,
param_error = TRUE,
mapbox_permanent = FALSE,
here_request_id = NULL,
mapquest_open = FALSE
)
|
address |
single line address (ie. '1600 Pennsylvania Ave NW, Washington, DC').
Do not combine with the address component arguments below
( |
street |
street address (ie. '1600 Pennsylvania Ave NW') |
city |
city (ie. 'Tokyo') |
county |
county (ie. 'Jefferson') |
state |
state (ie. 'Kentucky') |
postalcode |
postalcode (ie. zip code if in the United States) |
country |
country (ie. 'Japan') |
method |
the geocoding service to be used. API keys are loaded from environmental variables. Run
|
cascade_order |
a vector with two character values for the
method argument in the order in which the geocoding services will be attempted for |
lat |
latitude column name. Can be quoted or unquoted (ie. |
long |
longitude column name. Can be quoted or unquoted (ie. |
limit |
maximum number of results to return per input address. For many geocoding services
the maximum value of the limit parameter is 100. Pass |
full_results |
returns all available data from the geocoding service if TRUE. If FALSE (default) then only latitude and longitude columns are returned from the geocoding service. |
mode |
set to 'batch' to force batch geocoding or 'single' to force single address
geocoding (one address per query). If not specified then batch geocoding will
be used if available (given method selected) when multiple addresses are
provided; otherwise single address geocoding will be used. For the "here" and "bing" methods the
batch mode should be explicitly specified with |
unique_only |
only return results for unique inputs if TRUE |
return_addresses |
return input addresses with results if TRUE. Note that
most services return the input addresses with |
min_time |
minimum amount of time for a query to take (in seconds). If NULL then min_time will be set to the default value specified in min_time_reference. |
progress_bar |
if TRUE then a progress bar will be displayed
for single input geocoding (1 input per query). By default the progress bar
will not be shown for code executed when knitting R Markdown files or code within
an RStudio notebook chunk. Can be set permanently with |
quiet |
if TRUE then console messages that are displayed by default
regarding queries will be suppressed. FALSE is default.
Can be set permanently with |
api_url |
custom API URL. If specified, the default API URL will be overridden. This parameter can be used to specify a local Nominatim server, for instance. |
timeout |
query timeout (in minutes) |
flatten |
if TRUE (default) then any nested dataframes in results are flattened if possible. Note that in some cases results are flattened regardless such as for Geocodio batch geocoding. |
batch_limit |
limit to the number of addresses in a batch geocoding query. Defaults to the value in batch_limit_reference if not specified. |
batch_limit_error |
if TRUE then an error is thrown if the number of addresses exceeds the batch limit. (if executing a batch query). This is reverted to FALSE when using the cascade method. |
verbose |
if TRUE then detailed logs are output to the console. FALSE is default. Can be set
permanently with |
no_query |
if TRUE then no queries are sent to the geocoding service and verbose is set to TRUE. Used for testing. |
custom_query |
API-specific parameters to be used, passed as a named list
(ex. |
api_options |
a named list of parameters specific to individual services.
(ex.
|
return_type |
|
iq_region |
|
geocodio_v |
|
param_error |
if TRUE then an error will be thrown if any address
parameters are used that are invalid for the selected service ( |
mapbox_permanent |
|
here_request_id |
|
mapquest_open |
tibble (dataframe)
geocode api_parameter_reference min_time_reference batch_limit_reference
1 2 3 4 5 6 7 8 9 10 11 12 13 | options(tidygeocoder.progress_bar = FALSE)
geo(street = "600 Peachtree Street NE", city = "Atlanta",
state = "Georgia", method = "census")
geo(address = c("Tokyo, Japan", "Lima, Peru", "Nairobi, Kenya"),
method = 'osm')
geo("100 Main St New York, NY", full_results = TRUE,
method = "census", api_options = list(census_return_type = 'geographies'))
geo(county = 'Jefferson', state = "Kentucky", country = "US",
method = 'osm')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.