query_api {tidygeocoder} | R Documentation |
Execute a geocoder API query
Description
The get_api_query function can create queries for this function to execute.
Usage
query_api(
api_url,
query_parameters,
mode = "single",
batch_file = NULL,
input_list = NULL,
content_encoding = "UTF-8",
timeout = 20,
method = ""
)
Arguments
api_url |
Base URL of the API. query parameters are appended to this |
query_parameters |
api query parameters in the form of a named list |
mode |
determines the type of query to execute - "single": geocode a single input (all methods) - "list": batch geocode a list of inputs (ex. geocodio) - "file": batch geocode a file of inputs (ex. census) |
batch_file |
a csv file of input data to upload (for |
input_list |
a list of input data (for |
content_encoding |
Encoding to be used for parsing content |
timeout |
timeout in minutes |
method |
if 'mapquest' or 'arcgis' then the query status code is changed appropriately |
Value
a named list containing the response content (content
) and the HTTP request status (status
)
See Also
get_api_query extract_results extract_reverse_results geo reverse_geo
Examples
raw1 <- query_api("http://nominatim.openstreetmap.org/search",
get_api_query("osm", list(address = 'Hanoi, Vietnam')))
raw1$status
extract_results('osm', jsonlite::fromJSON(raw1$content))
raw2 <- query_api("http://nominatim.openstreetmap.org/reverse",
get_api_query("osm", custom_parameters = list(lat = 38.895865, lon = -77.0307713)))
extract_reverse_results('osm', jsonlite::fromJSON(raw2$content))
[Package tidygeocoder version 1.0.5 Index]